Package jsl.modeling.elements.spatial
Class Mover
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.spatial.SpatialModelElement
-
- jsl.modeling.elements.spatial.AbstractMover
-
- jsl.modeling.elements.spatial.Mover
-
- All Implemented Interfaces:
MoverIfc
,PositionIfc
,SpatialElementIfc
,VelocityIfc
,ObservableIfc
,GetNameIfc
,IdentityIfc
public class Mover extends AbstractMover
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsl.simulation.ModelElement
ModelElement.EventBuilderIfc<T>, ModelElement.EventScheduler<T>, ModelElement.ModelElementComparator, ModelElement.RequestBuilder, ModelElement.RequestDurationIfc, ModelElement.RequestTimeIfc, ModelElement.RequestUsingIfc, ModelElement.TimedUpdateEventAction, ModelElement.TimeUnitIfc<T>, ModelElement.WarmUpEventAction
-
-
Field Summary
-
Fields inherited from class jsl.modeling.elements.spatial.AbstractMover
MOVE_ENDED, MOVE_STARTED, myCollisionDetector, myCollisionHandler, myMovementController, myOSMHandler, mySEDestination, myTotalTripDist, myTripCounter, myTripDist, TRIP_CANCELED, TRIP_ENDED, TRIP_STARTED
-
Fields inherited from class jsl.simulation.ModelElement
AFTER_EXPERIMENT, AFTER_REPLICATION, BEFORE_EXPERIMENT, BEFORE_REPLICATION, CONDITIONAL_ACTION_REGISTRATION, DEFAULT_TIMED_EVENT_PRIORITY, INITIALIZED, MONTE_CARLO, myAfterExperimentOption, myAfterReplicationOption, myBeforeExperimentOption, myBeforeReplicationOption, myInitializationOption, myLengthOfWarmUp, myModelElements, myMonteCarloOption, myObservableComponent, myReplicationEndedOption, myTimedUpdateActionListener, myTimedUpdateEvent, myTimedUpdateInterval, myTimedUpdateOption, myTimedUpdatePriority, myWarmUpActionListener, myWarmUpEvent, myWarmUpIndicator, myWarmUpOption, myWarmUpPriority, NONE, REMOVED_FROM_MODEL, REPLICATION_ENDED, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIMED_UPDATE, UPDATE, WARMUP
-
-
Constructor Summary
Constructors Constructor Description Mover(ModelElement parent)
Creates a Mover with the default position within its spatial model.Mover(ModelElement parent, java.lang.String name)
Creates a Mover with the default position within its spatial model.Mover(ModelElement parent, java.lang.String name, SpatialModel spatialModel)
Creates a Mover with the default position within the given spatial model.Mover(ModelElement parent, java.lang.String name, SpatialModel spatialModel, CoordinateIfc coordinate)
Creates a Mover with the given coordinates within the given spatial model.Mover(ModelElement parent, CoordinateIfc coordinate)
Creates a Mover at the given coordinate within its spatial model.Mover(ModelElement parent, SpatialModel spatialModel)
Creates a Mover with the default position within the given spatial model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
travelTo(CoordinateIfc destination)
Causes the element to travel from its current position to the coordinates specified.-
Methods inherited from class jsl.modeling.elements.spatial.AbstractMover
afterMovementEnds, afterTripEnds, asString, beforeMovementStarts, beforeTripStarts, cancelTrip, checkForCollision, collectTripStats, computeMovement, getCollisionDetector, getCollisionHandler, getDestination, getFuturePosition, getMaxNumTrips, getMovementController, getMovementDistance, getMovementStartTime, getMovementTime, getMovementVelocity, getNumTripsCompleted, getOSMHandler, getVelocity, getVelocityChangeFactor, getVelocityInitialRandomSource, getVelocityRandomSource, handleCollision, hasNextTrip, initialize, isDefaultNextTripOptionOn, isMoving, isOnTrip, isTripStatOptionOn, moveDeltaX1, moveDeltaX1X2, moveDeltaX2, moveTo, moveTo, outsideSpatialModelHandler, replicationEnded, setCollisionDetector, setCollisionHandler, setDefaultNextTripOption, setMaxNumTrips, setMovement, setMovementController, setOSMHandler, setVelocityChangeFactor, setVelocityInitialRandomSource, setVelocityRandomSource, startNextTrip, tripCanceled, turnOnTripStatistics, updatePosition
-
Methods inherited from class jsl.modeling.elements.spatial.SpatialModelElement
attachPositionObserver, changeSpatialModel, distanceTo, distanceTo, getInitialPosition, getInitialSpatialModel, getModelElement, getPosition, getPreviousPosition, getSpatialElement, initializeSpatialElement, isPositionEqualTo, isPositionEqualTo, removePositionObserver, setCurrentPosition, setInitialPosition, setModelElement, setSpatialElement
-
Methods inherited from class jsl.simulation.SchedulingElement
cancelEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent
-
Methods inherited from class jsl.simulation.ModelElement
addObserver, addObserverToModelElements, afterExperiment, afterExperiment_, afterReplication, afterReplication_, beforeExperiment, beforeExperiment_, beforeReplication, beforeReplication_, buildEventGenerator, cancelTimedUpdateEvent, cancelWarmUpEvent, changeParentModelElement, checkForAfterExperiment, checkForAfterReplication, checkForBeforeExperiment, checkForBeforeReplication, checkForConditionalActionRegistration, checkForInitialize, checkForMonteCarlo, checkForRemoveFromModel, checkForReplicationEnded, checkForTimedUpdate, checkForUpdate, checkForWarmUp, checkObserverState, checkWarmUpOption, clearModelElementObservers, contains, countObservers, createEntity, createEntity, createQObject, day, deleteObserver, deleteObserverFromModelElements, deleteObservers, findModelElementWithWarmUpEvent, getAfterExperimentOption, getAfterReplicationOption, getAllCounters, getAllModelElements, getAllRandomElements, getAllResponseVariables, getAllVariables, getBeforeExperimentOption, getBeforeReplicationOption, getChildModelElementIterator, getCurrentReplicationNumber, getDefaultEntityType, getExecutive, getExperiment, getId, getInitializationOption, getInitializationOrderAsString, getLeftPreOrderTraversalCount, getLengthOfWarmUp, getModel, getModelElementCompartor, getModelElementsAsString, getModelElementsAsString, getModelElementsAsString, getMonteCarloOption, getName, getNumberOfModelElements, getObserverState, getParentModelElement, getPreviousObserverState, getReplicationEndedOption, getRightPreOrderTraversalCount, getSimulation, getSpatialModel, getStringLabel, getThisElementsCounters, getThisElementsModelElements, getThisElementsRandomVariables, getThisElementsResponseVariables, getThisElementsVariables, getTime, getTimedUpdateInterval, getTimedUpdateOption, getUpdateNotificationFlag, getVariable, getWarmUpEventTime, getWarmUpOption, hour, indent, initialize_, isTimedUpdateEventScheduled, isWarmedUp, isWarmUpEventScheduled, isWarmUpScheduled, millisecond, minute, montecarlo, montecarlo_, notifyAfterExperimentObservers, notifyAfterReplicationObservers, notifyBeforeExperimentObservers, notifyBeforeReplicationObservers, notifyConditionalActionRegistrationObservers, notifyInitializationObservers, notifyMonteCarloObservers, notifyObservers, notifyObservers, notifyRemovingFromModelObservers, notifyReplicationEndedObservers, notifyTimedUpdateObservers, notifyUpdateObservers, notifyWarmUpObservers, registerConditionalActions, registerConditionalActions_, removedFromModel, removeFromModel, replicationEnded_, schedule, second, seize, setAfterExperimentOption, setAfterExperimentOptionForModelElements, setAfterReplicationOption, setAfterReplicationOptionForModelElements, setBeforeExperimentOption, setBeforeExperimentOptionForModelElements, setBeforeReplicationOption, setBeforeReplicationOptionForModelElements, setInitializationOption, setInitializationOptionForModelElements, setLengthOfWarmUp, setModel, setMonteCarloOption, setMonteCarloOptionForModelElements, setName, setObserverState, setParentModelElement, setReplicationEndedOption, setReplicationEndedOptionForModelElements, setSpatialModel, setStringLabel, setTimedUpdateInterval, setTimedUpdateOption, setTimedUpdateOptionForModelElements, setUpdateNotificationFlag, setWarmUpOption, setWarmUpOptionForModelElements, stopExecutive, stopExecutive, timedUpdate, timedUpdate_, toString, update, useControls, warmUp, warmUp_, week
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsl.utilities.GetNameIfc
getName
-
Methods inherited from interface jsl.utilities.IdentityIfc
getId
-
Methods inherited from interface jsl.modeling.elements.spatial.SpatialElementIfc
attachPositionObserver, changeSpatialModel, distanceTo, distanceTo, getInitialPosition, getInitialSpatialModel, getModelElement, getObserverState, getPosition, getPreviousPosition, getSpatialModel, initializeSpatialElement, isPositionEqualTo, isPositionEqualTo, removePositionObserver, setInitialPosition
-
-
-
-
Constructor Detail
-
Mover
public Mover(ModelElement parent)
Creates a Mover with the default position within its spatial model. The spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown- Parameters:
parent
-
-
Mover
public Mover(ModelElement parent, java.lang.String name)
Creates a Mover with the default position within its spatial model. The spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown- Parameters:
parent
-name
-
-
Mover
public Mover(ModelElement parent, CoordinateIfc coordinate)
Creates a Mover at the given coordinate within its spatial model. The spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown- Parameters:
parent
-coordinate
-
-
Mover
public Mover(ModelElement parent, java.lang.String name, SpatialModel spatialModel)
Creates a Mover with the default position within the given spatial model. If the supplied spatial model is null the spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown- Parameters:
parent
-name
-spatialModel
-
-
Mover
public Mover(ModelElement parent, SpatialModel spatialModel)
Creates a Mover with the default position within the given spatial model. If the supplied spatial model is null the spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown- Parameters:
parent
-spatialModel
-
-
Mover
public Mover(ModelElement parent, java.lang.String name, SpatialModel spatialModel, CoordinateIfc coordinate)
Creates a Mover with the given coordinates within the given spatial model. If the supplied spatial model is null the spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown- Parameters:
parent
-name
-spatialModel
-coordinate
-
-
-
Method Detail
-
travelTo
public final void travelTo(CoordinateIfc destination)
Causes the element to travel from its current position to the coordinates specified. This starts a trip. A trip is a series of movements to move from the current position to the specified coordinates. At the beginning of a trip, trip start observers are notified. If the trip is broken down into movements, then each movement can have its own velocity, distance, and direction (as long as the final movement ends at the destination). If the destination is the same as the current position of the element then no trip is started and no movement occurs, i.e. nothing occurs If the specified coordinates are not in the element's associated spatial model then outsideSpatialModelHandler() is called. The default action is to throw an exception but this can be overridden in outsideSpatialModelHandler().- Parameters:
destination
- Must not be null
-
-