public class RandomSequence extends Sequence
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
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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) |
addSteppable, addSteppables, addSteppables, getEnsuresOrder, getUsesSets, loadSteps, removeSteppable, removeSteppables, removeSteppables, replaceSteppables, replaceSteppables, setEnsuresOrder, setUsesSets
public RandomSequence(Steppable[] steps)
public RandomSequence(Steppable[] steps, boolean shouldSynchronize)
public RandomSequence(java.util.Collection steps)
public RandomSequence(java.util.Collection steps, boolean shouldSynchronize)
protected boolean canEnsureOrder()
Sequence
canEnsureOrder
in class Sequence