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


Variable Index

 o MAX_ENTRIES
The maximum number of entries allowed out of internal reasons

Constructor Index

 o RoundRobin(int)

Method Index

 o applyAll(Object)
Powerfull mechanism of applying some function on all the Objects in the structure.
 o getCurrent()
Gets the current Object.
 o getMaxSize()
Gets the maximum entries allowed in this structure.
 o getNext()
Gets the next Object in the structure.
 o Insert(Object)
Inserts new Object AFTER the current one.
 o isEmpty()
Tests if structure is empty.
 o isFull()
Tests if structure is full.
 o Remove()
Removes CURRENT Object.
 o Remove(Object)
Removes the specified Object.
 o Size()
The number of Objects in the structure

Variables

 o MAX_ENTRIES
 public static final int MAX_ENTRIES
The maximum number of entries allowed out of internal reasons

Constructors

 o RoundRobin
 public RoundRobin(int max_entries)
Parameters:
max_entries - Maximum entries in the structure

Methods

 o isEmpty
 public synchronized boolean isEmpty()
Tests if structure is empty.

 o isFull
 public synchronized boolean isFull()
Tests if structure is full.

 o Size
 public synchronized int Size()
The number of Objects in the structure

Returns:
The current number of entries in the structure
 o 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 .

 o getCurrent
 public synchronized Object getCurrent() throws EmptyException
Gets the current Object.

Returns:
The current Object
Throws: EmptyException
If the structure is empty
 o 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
 o Remove
 public synchronized void Remove() throws EmptyException
Removes CURRENT Object. After removing, the PREVIOUS becomes current.

Throws: EmptyException
If the structure is empty
 o 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
 o 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
 o 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