Class RoundRobin
java.lang.Object
|
+----RoundRobin
- public class RoundRobin
- extends Object
A synchronized class used in reprezenting a circular list of Objects optimized for round robin parsing.
Written: Radu Sion
Version: 0.22
Source: RoundRobin.java
-
MAX_ENTRIES
- The maximum number of entries allowed out of internal reasons
-
RoundRobin(int)
-
-
applyAll(Object)
- Powerfull mechanism of applying some function on all the Objects in the structure.
-
getCurrent()
- Gets the current Object.
-
getMaxSize()
- Gets the maximum entries allowed in this structure.
-
getNext()
- Gets the next Object in the structure.
-
Insert(Object)
- Inserts new Object AFTER the current one.
-
isEmpty()
- Tests if structure is empty.
-
isFull()
- Tests if structure is full.
-
Remove()
- Removes CURRENT Object.
-
Remove(Object)
- Removes the specified Object.
-
Size()
- The number of Objects in the structure
MAX_ENTRIES
public static final int MAX_ENTRIES
- The maximum number of entries allowed out of internal reasons
RoundRobin
public RoundRobin(int max_entries)
- Parameters:
- max_entries - Maximum entries in the structure
isEmpty
public synchronized boolean isEmpty()
- Tests if structure is empty.
isFull
public synchronized boolean isFull()
- Tests if structure is full.
Size
public synchronized int Size()
- The number of Objects in the structure
- Returns:
- The current number of entries in the structure
getMaxSize
public synchronized int getMaxSize()
- Gets the maximum entries allowed in this structure.
This value is the value passed to the constructor or MAX_ENTRIES .
getCurrent
public synchronized Object getCurrent() throws EmptyException
- Gets the current Object.
- Returns:
- The current Object
- Throws: EmptyException
- If the structure is empty
getNext
public synchronized Object getNext() throws EmptyException
- Gets the next Object in the structure. (round robin parsing)
- Returns:
- The next Object
- Throws: EmptyException
- If the structure is empty
Remove
public synchronized void Remove() throws EmptyException
- Removes CURRENT Object. After removing, the PREVIOUS becomes current.
- Throws: EmptyException
- If the structure is empty
Remove
public synchronized void Remove(Object ooo) throws EmptyException
- Removes the specified Object. After removing, if the Object was
the current one then the PREVIOUS becomes current, otherwise the
current remains unchanged. The Objects are compared via ==
comparision. Only the first occurence is removed !!!
- Parameters:
- ooo - The objetc to remove.
- Throws: EmptyException
- If the structure is empty
Insert
public synchronized void Insert(Object ooo) throws FullException
- Inserts new Object AFTER the current one. After inserting, the current will remain THE SAME.
- Parameters:
- ooo - Object to insert
- Throws: FullException
- If the structure is full
applyAll
public synchronized int applyAll(Object ooo)
- Powerfull mechanism of applying some function on all the Objects in the structure. (not implemented yet)
This method is NOT FOR GENERAL USE (because it's synchronized and blocks the whole structure)
- Parameters:
- ooo - Object that gives the function to apply (but how ?)
- Returns:
- A indicator that shows how many objects were processed