public class Condition
extends java.util.Observable
| Constructor and Description |
|---|
Condition(boolean val)
Constructs a new Condition with initial value val, linked with the default simulator.
|
Condition(boolean val,
java.lang.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,
java.lang.String name)
Constructs a new Condition with initial value val,
identifier name and linked with simulator sim.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.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. |
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,
java.lang.String name)
val - initial state of the conditionname - identifier or name for the conditionpublic Condition(ProcessSimulator sim, boolean val, java.lang.String name)
sim - current simulator of the variableval - initial state of the conditionname - identifier or name for the conditionpublic 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 java.lang.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 OFFTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.