Class Transporter
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.spatial.SpatialModelElement
-
- jsl.modeling.elements.spatial.AbstractMover
-
- jsl.modeling.elements.spatial.transporter.Transporter
-
- All Implemented Interfaces:
MoverIfc
,PositionIfc
,SpatialElementIfc
,VelocityIfc
,ObservableIfc
,GetNameIfc
,IdentityIfc
public class Transporter extends AbstractMover
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Transporter.Allocated
protected class
Transporter.AllocatedMovingEmpty
protected class
Transporter.AllocatedMovingLoaded
protected class
Transporter.Created
protected class
Transporter.Idle
protected class
Transporter.Inactive
protected class
Transporter.MovingIdle
protected class
Transporter.TransporterState
-
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 Modifier and Type Field Description protected Transporter.AllocatedMovingEmpty
myAllocatedMovingEmptyState
Busy (allocated) but moving emptyprotected Transporter.AllocatedMovingLoaded
myAllocatedMovingLoadedState
Allocated (busy) and moving loadedprotected Transporter.Allocated
myAllocatedState
Represents the state of being allocated to do a transport Busy, but not yet movingprotected Transporter.Created
myCreatedState
The created state is used when the transporter is first created.protected Path
myCurrentPath
A variable that can be used to hold the path once foundprotected EmptyMoveCompletionIfc
myEmptyMoveCompletionListener
Can be supplied to give logic for the transporter for when an empty move is completed.protected IdleMoveCompletionIfc
myIdleMoveCompletionListener
Can be supplied to give logic for the transporter when an idle move is completedprotected Transporter.Idle
myIdleState
Represents the state of being active but not busy Can become inactive, moving idle, or allocatedprotected Transporter.Inactive
myInactiveState
Inactive means that it is unavailable.protected TransportCompletionIfc
myLoadedMoveCompletionListener
Can be supplied to provide logic for the transporter for when a loaded move is completedprotected State
myLoadingState
Can be used by clients to collect the time spent loadingprotected Transporter.MovingIdle
myMovingIdleState
Not-busy but movingprotected PathFinder
myPathFinder
An object that knows how to find the path for this transporterprotected Transporter.TransporterState
myPreviousState
The previous state for the transporterprotected Transporter.TransporterState
myState
A reference to the current state of the iterative processprotected java.util.Set<TransporterSet>
myTransporterSets
The list of transporter sets currently holding this transporterprotected State
myUnloadingState
Can be used by clients to collect the time spent unloadingstatic int
STATE_CHANGE
Indicates that the transporter has changed state to its observers-
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 Transporter(ModelElement parent)
Creates a Transporter2D with (0.0, 0.0) position.Transporter(ModelElement parent, double x, double y)
Creates a Transporter2D with the given (x,y) position.Transporter(ModelElement parent, java.lang.String name)
Creates a Transporter2D with (0.0, 0.0) position.Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel)
Creates a Transporter2D with the given parent and SpatialModel2D.Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel, double x, double y)
Creates a Transporter2D with the given parent and SpatialModel2D.Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel, double x, double y, double z)
Creates a Transporter2D with the given parent and SpatialModel2D.Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel, CoordinateIfc coordinate)
Creates a Transporter2D with the given parent and SpatialModel2D.Transporter(ModelElement parent, CoordinateIfc position)
Creates a Transporter2D with at the coordinates of the supplied position.Transporter(ModelElement parent, SpatialModel spatialModel)
Creates a Transporter2D with the given parent and SpatialModel2D.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
protected boolean
addTransporterSet(TransporterSet set)
protected void
afterTripEnds()
Can be used by subclasses to invoke logic after a trip endsvoid
allocate()
void
beginLoading()
Allows the client to indicate that the transporter is loading It is up to the client to also indicate that loading has endedvoid
beginUnloading()
Allows the client to indicate that the transporter is unloading It is up to the client to also indicate that unloading has ended This has no tie to the underlying state transition for the transportervoid
endLoading()
Allows the client to indicate that the transporter is done loading.void
endUnloading()
Allows the client to indicate that the transporter is done unloading.void
free()
void
inactivate()
protected void
initialize()
This method should be overridden by subclasses that need actions performed to initialize prior to a replication.boolean
isAllocated()
boolean
isAllocatedMovingEmpty()
boolean
isAllocatedMovingLoaded()
boolean
isBusy()
boolean
isCreated()
boolean
isIdle()
boolean
isInactive()
boolean
isLoading()
Checks if a client has indicated that the transporter is loadingboolean
isMovingIdle()
boolean
isUnloading()
Checks if a client has indicated that the transporter is unloadingvoid
moveEmpty(CoordinateIfc destination, EmptyMoveCompletionIfc emptyMoveCompletionListener)
void
moveIdle(CoordinateIfc destination, IdleMoveCompletionIfc idleMoveCompletionListener)
protected void
notifyTransporterSetsOfIdleness()
protected void
notifyTransporterSetsOfNonIdleness()
protected boolean
removeTransporterSet(TransporterSet set)
protected void
setState(Transporter.TransporterState state)
void
transport(CoordinateIfc destination, TransportCompletionIfc loadedMoveCompletionListener)
protected void
warmUp()
This method should be overridden by subclasses that need actions performed at the warm up event during each replication.-
Methods inherited from class jsl.modeling.elements.spatial.AbstractMover
afterMovementEnds, 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, 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_, 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
-
-
-
-
Field Detail
-
STATE_CHANGE
public static final int STATE_CHANGE
Indicates that the transporter has changed state to its observers
-
myTransporterSets
protected java.util.Set<TransporterSet> myTransporterSets
The list of transporter sets currently holding this transporter
-
myCurrentPath
protected Path myCurrentPath
A variable that can be used to hold the path once found
-
myPathFinder
protected PathFinder myPathFinder
An object that knows how to find the path for this transporter
-
myState
protected Transporter.TransporterState myState
A reference to the current state of the iterative process
-
myPreviousState
protected Transporter.TransporterState myPreviousState
The previous state for the transporter
-
myCreatedState
protected Transporter.Created myCreatedState
The created state is used when the transporter is first created. Can transition to inactive state or idle state
-
myIdleState
protected Transporter.Idle myIdleState
Represents the state of being active but not busy Can become inactive, moving idle, or allocated
-
myInactiveState
protected Transporter.Inactive myInactiveState
Inactive means that it is unavailable. Can only transition to active state
-
myAllocatedState
protected Transporter.Allocated myAllocatedState
Represents the state of being allocated to do a transport Busy, but not yet moving
-
myMovingIdleState
protected Transporter.MovingIdle myMovingIdleState
Not-busy but moving
-
myAllocatedMovingEmptyState
protected Transporter.AllocatedMovingEmpty myAllocatedMovingEmptyState
Busy (allocated) but moving empty
-
myAllocatedMovingLoadedState
protected Transporter.AllocatedMovingLoaded myAllocatedMovingLoadedState
Allocated (busy) and moving loaded
-
myIdleMoveCompletionListener
protected IdleMoveCompletionIfc myIdleMoveCompletionListener
Can be supplied to give logic for the transporter when an idle move is completed
-
myEmptyMoveCompletionListener
protected EmptyMoveCompletionIfc myEmptyMoveCompletionListener
Can be supplied to give logic for the transporter for when an empty move is completed.
-
myLoadedMoveCompletionListener
protected TransportCompletionIfc myLoadedMoveCompletionListener
Can be supplied to provide logic for the transporter for when a loaded move is completed
-
myLoadingState
protected State myLoadingState
Can be used by clients to collect the time spent loading
-
myUnloadingState
protected State myUnloadingState
Can be used by clients to collect the time spent unloading
-
-
Constructor Detail
-
Transporter
public Transporter(ModelElement parent)
Creates a Transporter2D with (0.0, 0.0) position. The SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parent
-
Transporter
public Transporter(ModelElement parent, java.lang.String name)
Creates a Transporter2D with (0.0, 0.0) position. The SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentname
- the name of the transporter
-
Transporter
public Transporter(ModelElement parent, double x, double y)
Creates a Transporter2D with the given (x,y) position. The SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentx
- the initial x positiony
- the initial y position
-
Transporter
public Transporter(ModelElement parent, CoordinateIfc position)
Creates a Transporter2D with at the coordinates of the supplied position. The SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentposition
- the initial position
-
Transporter
public Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel)
Creates a Transporter2D with the given parent and SpatialModel2D. The default position is (0.0, 0.0). If the SpatialModel2D is null, the SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentname
- the name of the transporterspatialModel
- the spatial model
-
Transporter
public Transporter(ModelElement parent, SpatialModel spatialModel)
Creates a Transporter2D with the given parent and SpatialModel2D. The default position is (0.0, 0.0). If the SpatialModel2D is null, the SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentspatialModel
- the spatial model
-
Transporter
public Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel, double x, double y)
Creates a Transporter2D with the given parent and SpatialModel2D. If the SpatialModel2D is null, the SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentname
- the name of the transporterspatialModel
- the spatial modelx
- the initial x positiony
- the initial y position
-
Transporter
public Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel, double x, double y, double z)
Creates a Transporter2D with the given parent and SpatialModel2D. If the SpatialModel2D is null, the SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentname
- the name of the transporterspatialModel
- the spatial modelx
- the initial x positiony
- the initial y positionz
- the initial z position
-
Transporter
public Transporter(ModelElement parent, java.lang.String name, SpatialModel spatialModel, CoordinateIfc coordinate)
Creates a Transporter2D with the given parent and SpatialModel2D. If the SpatialModel2D is null, the SpatialModel2D of the parent is used as the SpatialModel2D. If the parent does not have a SpatialModel2D, then an IllegalArgumentException is thrown- Parameters:
parent
- the parentname
- the name of the transporterspatialModel
- the spatial modelcoordinate
- the initial coordinate
-
-
Method Detail
-
isCreated
public final boolean isCreated()
-
isIdle
public final boolean isIdle()
-
isBusy
public final boolean isBusy()
-
isInactive
public final boolean isInactive()
-
isAllocated
public final boolean isAllocated()
-
isAllocatedMovingEmpty
public final boolean isAllocatedMovingEmpty()
-
isAllocatedMovingLoaded
public final boolean isAllocatedMovingLoaded()
-
isMovingIdle
public final boolean isMovingIdle()
-
activate
public void activate()
-
inactivate
public void inactivate()
-
allocate
public void allocate()
-
moveIdle
public void moveIdle(CoordinateIfc destination, IdleMoveCompletionIfc idleMoveCompletionListener)
-
moveEmpty
public void moveEmpty(CoordinateIfc destination, EmptyMoveCompletionIfc emptyMoveCompletionListener)
-
transport
public void transport(CoordinateIfc destination, TransportCompletionIfc loadedMoveCompletionListener)
-
free
public void free()
-
beginLoading
public final void beginLoading()
Allows the client to indicate that the transporter is loading It is up to the client to also indicate that loading has ended
-
endLoading
public final void endLoading()
Allows the client to indicate that the transporter is done loading. This has no tie to the underlying state transition for the transporter
-
isLoading
public final boolean isLoading()
Checks if a client has indicated that the transporter is loading- Returns:
- true if loading
-
beginUnloading
public final void beginUnloading()
Allows the client to indicate that the transporter is unloading It is up to the client to also indicate that unloading has ended This has no tie to the underlying state transition for the transporter
-
endUnloading
public final void endUnloading()
Allows the client to indicate that the transporter is done unloading. This has no tie to the underlying state transition for the transporter
-
isUnloading
public final boolean isUnloading()
Checks if a client has indicated that the transporter is unloading- Returns:
- true if unloading
-
initialize
protected void initialize()
Description copied from class:ModelElement
This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called- Overrides:
initialize
in classAbstractMover
-
warmUp
protected void warmUp()
Description copied from class:ModelElement
This method should be overridden by subclasses that need actions performed at the warm up event during each replication. It is called once during each replication if the model element reacts to warm up actions.- Overrides:
warmUp
in classModelElement
-
setState
protected final void setState(Transporter.TransporterState state)
-
afterTripEnds
protected void afterTripEnds()
Description copied from class:AbstractMover
Can be used by subclasses to invoke logic after a trip ends- Overrides:
afterTripEnds
in classAbstractMover
-
addTransporterSet
protected final boolean addTransporterSet(TransporterSet set)
-
removeTransporterSet
protected final boolean removeTransporterSet(TransporterSet set)
-
notifyTransporterSetsOfIdleness
protected final void notifyTransporterSetsOfIdleness()
-
notifyTransporterSetsOfNonIdleness
protected final void notifyTransporterSetsOfNonIdleness()
-
-