|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimnet.LinkProcessor
simnet.RoundRobin
A link processor that checks links sequentially for available frames. To make RoundRobin work we must do the following: 1. iterate through Links and if a frame is found return it 2. each time the Link Processor is called (with getFrame) it must start cycling from where it left off the previous time. Neither the Enumeration nor the Iterator classes allow us to do anything like that so we use an array and keep state instead. To use the array we have to copy all the Links from the Link table to a link array. We can' t do it when the RoundRobin object is instantiated because at that time the link table is empty (it gets filled as Links get created) so we need to do the copying only once all the links are present in the Link Table. The only time at which this is garanteed is when getFrame() is called. So we have to do the copying the first time getFrame() is called.
| Field Summary | |
(package private) Link[] |
link_array
An array containing all the Node' s Links |
(package private) java.util.Hashtable |
links
The link table that holds all the Node' s Links |
private int |
mark
A variable that keeps track of where the RoundRobin processor left off |
private boolean |
rebuild
Keeps track of whether the Link array has been built or not |
| Fields inherited from class simnet.LinkProcessor |
NODE_ID, parent_node |
| Constructor Summary | |
RoundRobin()
|
|
| Method Summary | |
Frame |
getFrame()
Returns a Frame from one of the Node' s Links |
void |
initialize(java.util.Hashtable link_table,
Node parent)
Initializes a new RoundRobin link processor by initializing its link_table and node fields. |
boolean |
prePlugout(java.lang.Object replacement)
Nothing special for replacing, clean up some memory when removing. |
void |
rebuild()
Constructs the Link Array |
| Methods inherited from class simnet.LinkProcessor |
finalize, plugoutNotification |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
java.util.Hashtable links
Link[] link_array
private int mark
private boolean rebuild
| Constructor Detail |
public RoundRobin()
| Method Detail |
public void initialize(java.util.Hashtable link_table,
Node parent)
initialize in class LinkProcessorlink_table - the owner' s (Node) Link tableparent - the Node that owns this LinkProcessorpublic void rebuild()
public Frame getFrame()
getFrame in class LinkProcessorpublic boolean prePlugout(java.lang.Object replacement)
prePlugout in interface Pluggable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||