Package jsl.modeling.elements.spatial
Class MobileResource
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.entity.Resource
-
- jsl.modeling.elements.spatial.MobileResource
-
- All Implemented Interfaces:
SeizeIfc,MoverIfc,PositionIfc,SpatialElementIfc,VelocityIfc,ObservableIfc,GetNameIfc,IdentityIfc
public abstract class MobileResource extends Resource implements MoverIfc
-
-
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.entity.Resource
myAllocations, myResourceSets, myWaitingRequests
-
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 MobileResource(ModelElement parent)Creates a MobileResource with capacity 1 at the default position in the spatial model.MobileResource(ModelElement parent, int capacity)Creates a MobileResource with the given capacity at the default position in the spatial model.MobileResource(ModelElement parent, int capacity, double x, double y)Creates a MobileResource with the given capacity and (x,y) position.MobileResource(ModelElement parent, int capacity, java.lang.String name)Creates a MobileResource with the given capacity at the default position in the spatial model.MobileResource(ModelElement parent, int capacity, java.lang.String name, double x, double y)Creates a MobileResource with the given capacity and (x,y) position.MobileResource(ModelElement parent, int capacity, java.lang.String name, CoordinateIfc position)Creates a MobileResource with capacity 1 at the given coordinates.MobileResource(ModelElement parent, int capacity, java.lang.String name, SpatialModel spatialModel)Creates a MobileResource with the given capacity at the default coordinates in the supplied spatial model.MobileResource(ModelElement parent, int capacity, java.lang.String name, SpatialModel spatialModel, double x, double y, double z)Creates a MobileResource with the given capacity at the (x,y,z) coordinates in the supplied spatial model.MobileResource(ModelElement parent, int capacity, java.lang.String name, SpatialModel spatialModel, CoordinateIfc coordinate)Creates a MobileResource with the given capacity at the supplied coordinates in the supplied spatial model.MobileResource(ModelElement parent, int capacity, CoordinateIfc position)Creates a MobileResource with the given capacity at the given coordinates.MobileResource(ModelElement parent, int capacity, SpatialElementIfc position)Creates a MobileResource with the given capacity at the coordinates of the given spatial element The spatial model of the parent is used as the spatial model.MobileResource(ModelElement parent, int capacity, SpatialModel spatialModel)Creates a MobileResource with the given capacity at the default coordinates in the supplied spatial model.MobileResource(ModelElement parent, java.lang.String name)Creates a MobileResource with capacity 1 at the default position in the spatial model.MobileResource(ModelElement parent, java.lang.String name, double x, double y)Creates a MobileResource with capacity 1 and (x,y) position.MobileResource(ModelElement parent, java.lang.String name, CoordinateIfc position)Creates a MobileResource with capacity 1 at the given coordinates.MobileResource(ModelElement parent, SpatialElementIfc position)Creates a MobileResource with the given capacity at the coordinates of the given spatial element The spatial model of the parent is used as the spatial model.MobileResource(ModelElement parent, SpatialElementIfc position, java.lang.String name)Creates a MobileResource with the given capacity at the coordinates of the given spatial element The spatial model of the parent is used as the spatial model.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidattachPositionObserver(ObserverIfc observer)Implementor of this interface should allow Observers to be attached.voidchangeSpatialModel(SpatialModel spatialModel, CoordinateIfc coordinate)Changes the spatial model for this element and places the element at the supplied coordinate within the new spatial model.doubledistanceTo(CoordinateIfc coordinate)This is a "convenience" method for getting the distance from this element to the supplied coordinate within the underlying spatial modeldoubledistanceTo(SpatialElementIfc element)This is a "convenience" method for getting the distance from this element to the supplied element within the underlying spatial model Requirement: The elements must be in the same spatial model.protected abstract voidemptyMoveCompleted()Subclasses must override this method to react to the end of an empty moveCollisionDetectorIfcgetCollisionDetector()CollisionHandlerIfcgetCollisionHandler()CoordinateIfcgetDestination()Gets a reference to the CoordinateIfc representing the destination of the moverCoordinateIfcgetFuturePosition(double time)Returns a CoordinateIfc that represents the future position of the spatial element at the given time.CoordinateIfcgetInitialPosition()SpatialModelgetInitialSpatialModel()Returns the spatial model that should hold this element at the beginning of each replication of a simulationModelElementgetModelElement()Gets the ModelElement associated with this spatial element May be nullMovementControllerIfcgetMovementController()doublegetMovementDistance()Gets the distance associated with the current movementdoublegetMovementStartTime()Get the time that the current movement starteddoublegetMovementTime()Gets the time length for the current movementdoublegetMovementVelocity()Gets the velocity of the movement that is in progressOutsideSpatialModelHandlerIfcgetOSMHandler()Get the object the handles when the movement takes the element outside the boundaries of the current spatial modelCoordinateIfcgetPosition()CoordinateIfcgetPreviousPosition()protected TransportergetTransporter()Subclasses can use this to access the underlying Transporterprotected voidinitialize()This method should be overridden by subclasses that need actions performed to initialize prior to a replication.voidinitializeSpatialElement()This method should be called to initialize the spatial element prior to running a simulationbooleanisMoving()Indicates whether or not the element is currently movingbooleanisOnTrip()Indicates whether or not the element is currently on a tripbooleanisPositionEqualTo(CoordinateIfc coordinate)Returns true if the position of this element is the same as supplied coordinate within the underlying spatial model.booleanisPositionEqualTo(SpatialElementIfc element)Returns true if the position of this element is the same as the position of the supplied element within the underlying spatial model.protected voidmoveEmpty(CoordinateIfc coordinate)Tells the resource to move empty to the supplied coordinatesprotected voidmoveEmpty(SpatialElementIfc element)Tells the resource to move empty to the coordinates of the supplied spatial elementvoidremovePositionObserver(ObserverIfc observer)Remove the observer from this PositionIfcvoidsetCollisionDetector(CollisionDetectorIfc collisionDetector)Sets the collision detector.voidsetCollisionHandler(CollisionHandlerIfc collisionHandler)Sets the collision handler, if null then no collision handling is performedvoidsetInitialPosition(CoordinateIfc coordinate)Sets the initial position of the element.voidsetMovement(double velocity, CoordinateIfc position)Sets up the movement before it gets processed.voidsetMovementController(MovementControllerIfc movementController)Set the movement controller.voidsetOSMHandler(OutsideSpatialModelHandlerIfc OSMHandler)Set the handler for taking care of when the element goes outside the boundaries of its spatial model.voidsetVelocityInitialRandomSource(RandomIfc source)Sets the random source associated with the velocity used at the beginning of each replicationvoidsetVelocityRandomSource(RandomIfc source)Sets the random source associated with the velocity.protected voidtransport(CoordinateIfc coordinate)Tells the resource to transport to the supplied coordinatesprotected voidtransport(SpatialElementIfc element)Tells the resource to transport to the coordinates of the supplied spatial elementprotected abstract voidtransportCompleted()Subclasses must override this method to react to the end of a transport-
Methods inherited from class jsl.modeling.elements.entity.Resource
addAllocation, addWaitingRequest, allocate, allocate, asString, attachResourceSet, attachStateChangeListener, decrementNumberBusy, detachResourceSet, detachStateChangeListener, getCapacity, getInitialCapacity, getMaximumCapacity, getNumberAvailable, hasAvailableUnits, incrementNumberBusy, isBusy, isFailed, isIdle, isInactive, notifyResourceSets, notifyStateChangeListeners, partiallyAllocate, peekNextRequest, processWaitingRequests, release, release, release, removeAllocation, removeNextRequest, removeWaitingRequest, seize, seize, seize, seize, seize, setInitialCapacity, setMaximumCapacity, setState
-
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, 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.MoverIfc
cancelTrip, getVelocity
-
Methods inherited from interface jsl.modeling.elements.spatial.SpatialElementIfc
getObserverState, getSpatialModel
-
Methods inherited from interface jsl.modeling.elements.spatial.VelocityIfc
getVelocityChangeFactor, getVelocityInitialRandomSource, getVelocityRandomSource, setVelocityChangeFactor
-
-
-
-
Constructor Detail
-
MobileResource
public MobileResource(ModelElement parent)
Creates a MobileResource with capacity 1 at the default position in the spatial model. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-
-
MobileResource
public MobileResource(ModelElement parent, java.lang.String name)
Creates a MobileResource with capacity 1 at the default position in the spatial model. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-name-
-
MobileResource
public MobileResource(ModelElement parent, int capacity)
Creates a MobileResource with the given capacity at the default position in the spatial model. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, java.lang.String name)
Creates a MobileResource with the given capacity at the default position in the spatial model. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-name-
-
MobileResource
public MobileResource(ModelElement parent, java.lang.String name, CoordinateIfc position)
Creates a MobileResource with capacity 1 at the given coordinates. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-name-position-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, java.lang.String name, CoordinateIfc position)
Creates a MobileResource with capacity 1 at the given coordinates. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-name-position-
-
MobileResource
public MobileResource(ModelElement parent, java.lang.String name, double x, double y)
Creates a MobileResource with capacity 1 and (x,y) position. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-name-x-y-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, java.lang.String name, double x, double y)
Creates a MobileResource with the given capacity and (x,y) position. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-name-x-y-
-
MobileResource
public MobileResource(ModelElement parent, SpatialElementIfc position)
Creates a MobileResource with the given capacity at the coordinates of the given spatial element The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-position-
-
MobileResource
public MobileResource(ModelElement parent, SpatialElementIfc position, java.lang.String name)
Creates a MobileResource with the given capacity at the coordinates of the given spatial element The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-position-name-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, SpatialElementIfc position)
Creates a MobileResource with the given capacity at the coordinates of the given spatial element The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-position-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, CoordinateIfc position)
Creates a MobileResource with the given capacity at the given coordinates. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-position-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, double x, double y)
Creates a MobileResource with the given capacity and (x,y) position. The spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-x-y-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, SpatialModel spatialModel)
Creates a MobileResource with the given capacity at the default coordinates in the supplied spatial model. The supplied is used unless it is null, then the spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-spatialModel-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, java.lang.String name, SpatialModel spatialModel)
Creates a MobileResource with the given capacity at the default coordinates in the supplied spatial model. The supplied is used unless it is null, then the spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-name-spatialModel-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, java.lang.String name, SpatialModel spatialModel, double x, double y, double z)
Creates a MobileResource with the given capacity at the (x,y,z) coordinates in the supplied spatial model. The supplied is used unless it is null, then the spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-name-spatialModel-x-y-z-
-
MobileResource
public MobileResource(ModelElement parent, int capacity, java.lang.String name, SpatialModel spatialModel, CoordinateIfc coordinate)
Creates a MobileResource with the given capacity at the supplied coordinates in the supplied spatial model. The supplied is used unless it is null, then the spatial model of the parent is used as the spatial model. If the parent does not have a spatial model, then an IllegalArgumentException is thrown- Parameters:
parent-capacity-name-spatialModel-coordinate-
-
-
Method Detail
-
getCollisionDetector
public final CollisionDetectorIfc getCollisionDetector()
- Specified by:
getCollisionDetectorin interfaceMoverIfc- Returns:
- Returns the collisionDetector.
-
getCollisionHandler
public final CollisionHandlerIfc getCollisionHandler()
- Specified by:
getCollisionHandlerin interfaceMoverIfc- Returns:
- Returns the collisionHandler.
-
getDestination
public final CoordinateIfc getDestination()
Description copied from interface:MoverIfcGets a reference to the CoordinateIfc representing the destination of the mover- Specified by:
getDestinationin interfaceMoverIfc- Returns:
- the CoordinateIfcIfc for this element
-
getFuturePosition
public final CoordinateIfc getFuturePosition(double time)
Description copied from interface:MoverIfcReturns a CoordinateIfc that represents the future position of the spatial element at the given time.- Specified by:
getFuturePositionin interfaceMoverIfc- Parameters:
time- Must be greater than or equal to zero- Returns:
- the coordinate of the future position
-
getMovementController
public final MovementControllerIfc getMovementController()
- Specified by:
getMovementControllerin interfaceMoverIfc- Returns:
- Returns the movementController.
-
getMovementDistance
public final double getMovementDistance()
Description copied from interface:MoverIfcGets the distance associated with the current movement- Specified by:
getMovementDistancein interfaceMoverIfc- Returns:
- Returns the movementDistance.
-
getMovementStartTime
public final double getMovementStartTime()
Description copied from interface:MoverIfcGet the time that the current movement started- Specified by:
getMovementStartTimein interfaceMoverIfc- Returns:
- Returns the movementStartTime.
-
getMovementTime
public final double getMovementTime()
Description copied from interface:MoverIfcGets the time length for the current movement- Specified by:
getMovementTimein interfaceMoverIfc- Returns:
- Returns the movementTime
-
getMovementVelocity
public final double getMovementVelocity()
Description copied from interface:MoverIfcGets the velocity of the movement that is in progress- Specified by:
getMovementVelocityin interfaceMoverIfc- Returns:
- Returns the movementVelocity.
-
getOSMHandler
public final OutsideSpatialModelHandlerIfc getOSMHandler()
Description copied from interface:MoverIfcGet the object the handles when the movement takes the element outside the boundaries of the current spatial model- Specified by:
getOSMHandlerin interfaceMoverIfc- Returns:
- Returns the OSMHandler.
-
isMoving
public final boolean isMoving()
Description copied from interface:MoverIfcIndicates whether or not the element is currently moving
-
isOnTrip
public final boolean isOnTrip()
Description copied from interface:MoverIfcIndicates whether or not the element is currently on a trip
-
setCollisionDetector
public final void setCollisionDetector(CollisionDetectorIfc collisionDetector)
Description copied from interface:MoverIfcSets the collision detector. If null no detection is used- Specified by:
setCollisionDetectorin interfaceMoverIfc- Parameters:
collisionDetector- The collisionDetector to set.
-
setCollisionHandler
public final void setCollisionHandler(CollisionHandlerIfc collisionHandler)
Description copied from interface:MoverIfcSets the collision handler, if null then no collision handling is performed- Specified by:
setCollisionHandlerin interfaceMoverIfc- Parameters:
collisionHandler- The collisionHandler to set.
-
setMovement
public final void setMovement(double velocity, CoordinateIfc position)Description copied from interface:MoverIfcSets up the movement before it gets processed. Takes in a velocity for the movement (which must be > 0) and the coordinate where the movement should end. This method should be used by MovementControllers to set the movement characteristics prior to the move. This method sets: 1) the velocity of the move 2) the distance of the move 3) the direction of the move 4) the time the move starts 5) the total time to move to the position at the given velocity- Specified by:
setMovementin interfaceMoverIfc- Parameters:
velocity- Must be > 0position- Must not be null
-
setMovementController
public final void setMovementController(MovementControllerIfc movementController)
Description copied from interface:MoverIfcSet the movement controller. If null, then the default movement uses the point to point distance at velocity 1.- Specified by:
setMovementControllerin interfaceMoverIfc- Parameters:
movementController- The movementController to set.
-
setOSMHandler
public final void setOSMHandler(OutsideSpatialModelHandlerIfc OSMHandler)
Description copied from interface:MoverIfcSet the handler for taking care of when the element goes outside the boundaries of its spatial model. If null, then an exception will be thrown if the element tries to go outside its spatial element.- Specified by:
setOSMHandlerin interfaceMoverIfc- Parameters:
OSMHandler- The OSMHandler to set.
-
setVelocityInitialRandomSource
public final void setVelocityInitialRandomSource(RandomIfc source)
Description copied from interface:MoverIfcSets the random source associated with the velocity used at the beginning of each replication- Specified by:
setVelocityInitialRandomSourcein interfaceMoverIfc- Specified by:
setVelocityInitialRandomSourcein interfaceVelocityIfc- Parameters:
source- the source of the randomness
-
setVelocityRandomSource
public void setVelocityRandomSource(RandomIfc source)
Description copied from interface:MoverIfcSets the random source associated with the velocity. This is reset at the beginning of each replication to the value set with setVelocityInitialRandomSource()- Specified by:
setVelocityRandomSourcein interfaceMoverIfc- Specified by:
setVelocityRandomSourcein interfaceVelocityIfc- Parameters:
source- the source of the randomness
-
attachPositionObserver
public final void attachPositionObserver(ObserverIfc observer)
Description copied from interface:SpatialElementIfcImplementor of this interface should allow Observers to be attached. For example, the observers should be notified when the position changes. It is the responsibility of implementers to properly notify the observers.- Specified by:
attachPositionObserverin interfaceSpatialElementIfc- Parameters:
observer- the observer
-
changeSpatialModel
public final void changeSpatialModel(SpatialModel spatialModel, CoordinateIfc coordinate)
Description copied from interface:SpatialElementIfcChanges the spatial model for this element and places the element at the supplied coordinate within the new spatial model. Throws IllegalArgumentException if the coordinate is not valid for the supplied spatial model. This spatial element becomes a child element of the new spatial model.- Specified by:
changeSpatialModelin interfaceSpatialElementIfc- Parameters:
spatialModel- the spatial modelcoordinate- the coordinate
-
distanceTo
public final double distanceTo(CoordinateIfc coordinate)
Description copied from interface:SpatialElementIfcThis is a "convenience" method for getting the distance from this element to the supplied coordinate within the underlying spatial model- Specified by:
distanceToin interfaceSpatialElementIfc- Parameters:
coordinate- the coordinate to check- Returns:
- the distance
-
distanceTo
public final double distanceTo(SpatialElementIfc element)
Description copied from interface:SpatialElementIfcThis is a "convenience" method for getting the distance from this element to the supplied element within the underlying spatial model Requirement: The elements must be in the same spatial model. The distance should be calculated by the spatial model. If they are not in the same spatial model this method will throw and IllegalArgumentException- Specified by:
distanceToin interfaceSpatialElementIfc- Parameters:
element- the element to check- Returns:
- the distance
-
getPosition
public final CoordinateIfc getPosition()
- Specified by:
getPositionin interfacePositionIfc- Specified by:
getPositionin interfaceSpatialElementIfc- Returns:
- Returns the current Position.
-
getInitialPosition
public final CoordinateIfc getInitialPosition()
- Specified by:
getInitialPositionin interfaceSpatialElementIfc- Returns:
- Returns the initialPosition.
-
setInitialPosition
public void setInitialPosition(CoordinateIfc coordinate)
Description copied from interface:SpatialElementIfcSets the initial position of the element. This position should be used when initializeSpatialElement() is called, typically at the beginning of a replication.- Specified by:
setInitialPositionin interfaceSpatialElementIfc- Parameters:
coordinate- the coordinate
-
getInitialSpatialModel
public final SpatialModel getInitialSpatialModel()
Description copied from interface:SpatialElementIfcReturns the spatial model that should hold this element at the beginning of each replication of a simulation- Specified by:
getInitialSpatialModelin interfaceSpatialElementIfc- Returns:
- the spatial model
-
getModelElement
public final ModelElement getModelElement()
Description copied from interface:SpatialElementIfcGets the ModelElement associated with this spatial element May be null- Specified by:
getModelElementin interfaceSpatialElementIfc- Returns:
- the model element
-
getPreviousPosition
public final CoordinateIfc getPreviousPosition()
- Specified by:
getPreviousPositionin interfaceSpatialElementIfc- Returns:
- Returns the previousPosition.
-
initializeSpatialElement
public final void initializeSpatialElement()
Description copied from interface:SpatialElementIfcThis method should be called to initialize the spatial element prior to running a simulation- Specified by:
initializeSpatialElementin interfaceSpatialElementIfc
-
isPositionEqualTo
public final boolean isPositionEqualTo(CoordinateIfc coordinate)
Description copied from interface:SpatialElementIfcReturns true if the position of this element is the same as supplied coordinate within the underlying spatial model. This is not necessarily object reference equality, but rather whether or not the positions within the underlying spatial model can be considered the same (equivalent).- Specified by:
isPositionEqualToin interfaceSpatialElementIfc- Parameters:
coordinate- the coordinate to check- Returns:
- true if position is equal
-
isPositionEqualTo
public final boolean isPositionEqualTo(SpatialElementIfc element)
Description copied from interface:SpatialElementIfcReturns true if the position of this element is the same as the position of the supplied element within the underlying spatial model. This is not necessarily object reference equality, but rather whether or not the positions within the underlying spatial model can be considered the same (equivalent). Requirement: The elements must be in the same spatial model. If they are not in the same spatial model, then this method should return false.- Specified by:
isPositionEqualToin interfaceSpatialElementIfc- Parameters:
element- the element to check- Returns:
- the distance
-
removePositionObserver
public final void removePositionObserver(ObserverIfc observer)
Description copied from interface:SpatialElementIfcRemove the observer from this PositionIfc- Specified by:
removePositionObserverin interfaceSpatialElementIfc- Parameters:
observer- the observer
-
initialize
protected void initialize()
Description copied from class:ModelElementThis 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:
initializein classResource
-
getTransporter
protected final Transporter getTransporter()
Subclasses can use this to access the underlying Transporter- Returns:
- Returns the Transporter.
-
moveEmpty
protected void moveEmpty(CoordinateIfc coordinate)
Tells the resource to move empty to the supplied coordinates- Parameters:
coordinate-
-
moveEmpty
protected void moveEmpty(SpatialElementIfc element)
Tells the resource to move empty to the coordinates of the supplied spatial element- Parameters:
element-
-
transport
protected void transport(CoordinateIfc coordinate)
Tells the resource to transport to the supplied coordinates- Parameters:
coordinate-
-
transport
protected void transport(SpatialElementIfc element)
Tells the resource to transport to the coordinates of the supplied spatial element- Parameters:
element-
-
emptyMoveCompleted
protected abstract void emptyMoveCompleted()
Subclasses must override this method to react to the end of an empty move
-
transportCompleted
protected abstract void transportCompleted()
Subclasses must override this method to react to the end of a transport
-
-