|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable umontreal.iro.lecuyer.simprocs.Condition
public class Condition
A Condition is a boolean indicator, with a list of processes
waiting for the indicator to be true (when it is false).
A process calling waitFor
on a condition that is currently
false is suspended until the condition becomes true.
The list of waiting processes can be accessed via waitList
.
Constructor Summary | |
---|---|
Condition(boolean val)
Constructs a new Condition with initial value val, linked with the default simulator. |
|
Condition(boolean val,
String name)
Constructs a new Condition with initial value val, identifier name and linked with the default simulator. |
|
Condition(ProcessSimulator sim,
boolean val)
Constructs a new Condition with initial value val, linked with simulator sim. |
|
Condition(ProcessSimulator sim,
boolean val,
String name)
Constructs a new Condition with initial value val, identifier name and linked with simulator sim. |
Method Summary | |
---|---|
String |
getName()
Returns the name (or identifier) associated to this condition. |
void |
init(boolean val)
Reinitializes this Condition by clearing up its waiting list and resetting its state to val. |
void |
set(boolean val)
Sets the condition to val. |
void |
setBroadcasting(boolean b)
Instructs the condition to start or stop observation broadcasting. |
boolean |
state()
Returns the state (true or false) of the condition. |
void |
waitFor()
The executing process invoking this method must wait for this condition to be true. |
LinkedListStat |
waitList()
Returns the list of UserRecord
for the processes waiting for this condition. |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Condition(boolean val)
val
- initial state of the conditionpublic Condition(ProcessSimulator sim, boolean val)
sim
- current simulator of the variableval
- initial state of the conditionpublic Condition(boolean val, String name)
val
- initial state of the conditionname
- identifier or name for the conditionpublic Condition(ProcessSimulator sim, boolean val, String name)
sim
- current simulator of the variableval
- initial state of the conditionname
- identifier or name for the conditionMethod Detail |
---|
public void init(boolean val)
val
- initial state of the conditionpublic void set(boolean val)
waitFor
for this condition.
(Note that a process can never wait for more than one condition at
a time, because it cannot call waitFor
while it is suspended.
val
- new state of the conditionpublic boolean state()
public void waitFor()
waitList
list for this condition and is suspended
until the condition becomes true.
public LinkedListStat waitList()
UserRecord
for the processes waiting for this condition.
public String getName()
public void setBroadcasting(boolean b)
Boolean
observation is notified to
registered observers when the state of the condition changes. This
boolean gives the new state of the condition.
Warning: Since this can reduce program performance, this should be turned on only when there are registered observers.
b
- true to turn broadcasting ON, false to turn it OFF
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |