public class RandomLocationMoverManager extends SimEntityBase implements MoverManager
MoverManagerFactory
Modifier and Type | Field and Description |
---|---|
private RandomVariate[] |
location
A 2-dimensional array that contains a RandomVariate for the x coordinate
and the y coordinate.
|
private Mover |
mover
The Mover that this MoverManager manages.
|
private RandomVariate |
speed
The RandomVariate for the speedGen of movement.
|
private boolean |
startOnReset
If true, then after a reset, this MoverManager will re-start the motion
of the controlled Mover.
|
eventList, property
DEFAULT_ENTITY_NAME, DEFAULT_EVENT_NAME, DEFAULT_PRIORITY, EVENT_METHOD_PREFIX, NL
Constructor and Description |
---|
RandomLocationMoverManager() |
RandomLocationMoverManager(Mover mover,
RandomVariate[] location)
Creates a new instance of RandomLocationMoverManager that moves the Mover
at its maximum speedGen.
|
RandomLocationMoverManager(Mover mover,
RandomVariate[] location,
RandomVariate speed)
Creates a new instance of RandomLocationMoverManager.
|
Modifier and Type | Method and Description |
---|---|
void |
doEndMove(Mover m)
Notifies this MoverManager that the Mover has completed the current move
causing the Mover to move to another random point.
|
void |
doStart()
Causes the Mover to start moving to a random point.
|
protected java.awt.geom.Point2D |
getLocation() |
RandomVariate[] |
getLocationGenerator() |
Mover |
getMover()
The Mover that this MoverManager manages.
|
RandomVariate |
getSpeedGenerator() |
boolean |
isMoving()
True if the Mover controlled by this MoverManager is moving.
|
boolean |
isStartOnReset()
If true, then after a reset, this MoverManager re-starts the motion of
the controlled Mover.
|
void |
reset()
Cancels all pending events for this MoverManager and if startOnReset is
true, starts the Mover's motion.
|
void |
setLocationGenerator(RandomVariate[] rv)
Sets the RandomVariates used to pick the next x and y coordinates.
|
void |
setMover(Mover newMover)
Sets the Mover that this MoverManager controls.
|
void |
setSpeedGenerator(RandomVariate rv)
Sets the RandomVariate used to pick the speedGen for the next leg.
|
void |
setStartOnReset(boolean b)
If true, then after a reset, this MoverManager re-starts the motion of
the controlled Mover.
|
void |
start()
Starts the controlled Mover moving to a random location.
|
void |
stop()
Stops the Mover at its current location.
|
java.lang.String |
toString()
Returns a String containing the mover, the next position, and the transit
speedGen.
|
coldReset, dumpDoMethods, dumpDoMethodsStr, dumpNamesAndSignatures, dumpNamesAndSignaturesStr, getFullMethodName, getSignatureString, handleSimEvent, isAssignableFrom, isDebug, processSimEvent, setDebug, stopAtTime, stopOnTime
addPropertyChangeListener, addPropertyChangeListener, attemptSchedule, clearAddedProperty, compareTo, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAddedProperties, getEventList, getEventListID, getName, getPriority, getPropertiesString, getProperty, getProperty, getPropertyChangeListeners, getSerial, interrupt, interrupt, interruptAll, interruptAll, interruptAll, interruptAllWithArgs, interruptAllWithArgs, isClearAddedPropertiesOnReset, isJustDefinedProperties, isPersistant, isReRunnable, isVerbose, parametersMatch, removePropertyChangeListener, removePropertyChangeListener, resetNextSerial, setClearAddedPropertiesOnReset, setEventList, setEventListID, setJustDefinedProperties, setName, setPersistant, setPriority, setProperty, setVerbose, waitDelay, waitDelay, waitDelay, waitDelay
addSimEventListener, getSimEventListeners, notifyListeners, removeSimEventListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEventListID, setEventListID
addSimEventListener, getSimEventListeners, notifyListeners, removeSimEventListener
processSimEvent
isPersistant, isReRunnable, setPersistant
getEventList, getPriority, getSerial, handleSimEvent, interrupt, interrupt, interruptAll, interruptAll, interruptAll, interruptAllWithArgs, interruptAllWithArgs, setPriority, waitDelay, waitDelay
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getAddedProperties, getProperty, getProperty, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setProperty
private Mover mover
private RandomVariate[] location
private RandomVariate speed
private boolean startOnReset
public RandomLocationMoverManager()
public RandomLocationMoverManager(Mover mover, RandomVariate[] location, RandomVariate speed)
mover
- The Mover that this MoverManager controls.location
- A 2-dimensional array containing a RandomVariate for the
x coordinate and one for the y coordinate.speed
- The RandomVariate used to determine the speedGen of the moves.public RandomLocationMoverManager(Mover mover, RandomVariate[] location)
mover
- The Mover that this MoverManager controls.location
- A 2-dimensional array containing a RandomVariate for the
x coordinate and one for the y coordinate.public void reset()
reset
in interface ReRunnable
reset
in class BasicSimEntity
public void doStart()
public void doEndMove(Mover m)
doEndMove
in interface MoverManager
m
- Given Moverpublic Mover getMover()
getMover
in interface MoverManager
public boolean isMoving()
isMoving
in interface MoverManager
public boolean isStartOnReset()
isStartOnReset
in interface MoverManager
public void setStartOnReset(boolean b)
setStartOnReset
in interface MoverManager
b
- true if after a reset, this MoverManager will re-start the
motion of the controlled Mover.public void start()
start
in interface MoverManager
public void stop()
stop
in interface MoverManager
public void setLocationGenerator(RandomVariate[] rv)
rv
- A 2-dimensional array containing the RandomVariate for the x
and y coordinates.java.lang.NullPointerException
- If the array or either of its contents is
null.java.lang.IllegalArgumentException
- If the array does not contain at least 2
elements.public RandomVariate[] getLocationGenerator()
public void setSpeedGenerator(RandomVariate rv)
rv
- Given RandomVariate to generate speedspublic RandomVariate getSpeedGenerator()
protected java.awt.geom.Point2D getLocation()
public void setMover(Mover newMover)
setMover
in interface MoverManager
newMover
- the Mover to be controlled by this MoverManagerpublic java.lang.String toString()
toString
in class BasicSimEntity