|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.engine.Sequence
sim.engine.RandomSequence
public class RandomSequence
RandomSequence is a Sequence which executes its Steppable objects in random order each time.
The RandomSequence uses the random number generator to do its shuffling. If you use a RandomSequence within a ParallelSequence, or inside an AsynchronousSteppable, or in some other multithreaded condition, you should let the RandomSequence know this so that it will lock on the random number generator properly. This is done by setting the shouldSynchronize flag in the RandomSequence. Likewise, whenever in other threads you access the generator in a multithreaded context, you should have them synchronize on the generator first.
Be sure to read the class documentation on sim.engine.Sequence
Field Summary |
---|
Fields inherited from class sim.engine.Sequence |
---|
size, steps |
Constructor Summary | |
---|---|
RandomSequence(java.util.Collection steps)
Creates an immutable RandomSequence. |
|
RandomSequence(java.util.Collection steps,
boolean shouldSynchronize)
Creates an immutable RandomSequence. |
|
RandomSequence(Steppable[] steps)
Creates an immutable RandomSequence. |
|
RandomSequence(Steppable[] steps,
boolean shouldSynchronize)
Creates an immutable RandomSequence. |
Method Summary | |
---|---|
protected boolean |
canEnsureOrder()
If your subclass does not respect order, override this method to return false, and Sequence will ignore the ensuresOrder result. |
void |
step(SimState state)
|
Methods inherited from class sim.engine.Sequence |
---|
addSteppable, addSteppables, addSteppables, getEnsuresOrder, getUsesSets, loadSteps, removeSteppable, removeSteppables, removeSteppables, replaceSteppables, replaceSteppables, setEnsuresOrder, setUsesSets |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomSequence(Steppable[] steps)
public RandomSequence(Steppable[] steps, boolean shouldSynchronize)
public RandomSequence(java.util.Collection steps)
public RandomSequence(java.util.Collection steps, boolean shouldSynchronize)
Method Detail |
---|
protected boolean canEnsureOrder()
Sequence
canEnsureOrder
in class Sequence
public void step(SimState state)
step
in interface Steppable
step
in class Sequence
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |