Package jsl.modeling.elements.spatial
Class AbstractRG2DMover
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.spatial.SpatialModelElement
-
- jsl.modeling.elements.spatial.AbstractMover
-
- jsl.modeling.elements.spatial.AbstractRG2DMover
-
- All Implemented Interfaces:
MoverIfc
,PositionIfc
,SpatialElementIfc
,VelocityIfc
,ObservableIfc
,GetNameIfc
,IdentityIfc
- Direct Known Subclasses:
RG2DMover
public abstract class AbstractRG2DMover extends AbstractMover
A base class for implementing movement within a 2D rectangular grid
-
-
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 Modifier and Type Field Description protected RectangularCell2DSelectorIfc
myCellSelector
protected RectangularGridSpatialModel2D
myGrid
protected RectangularGridModel
myGridModel
protected EuclideanStepBasedMovementController
myMoveController
protected boolean
myStartRandomlyFlag
-
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 AbstractRG2DMover(RectangularGridModel parent)
AbstractRG2DMover(RectangularGridModel parent, java.lang.String name)
AbstractRG2DMover(RectangularGridModel parent, CoordinateIfc coordinate, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RectangularCell2DSelectorIfc
getCellSelector()
RectangularCell2D
getCurrentCell()
RectangularGridModel
getGridModel()
protected java.util.List<RectangularCell2D>
getNeighborhoodList()
A list of the Moore neighborhood for this mover.CoordinateIfc
getRandomCoordinate()
Randomly generates a coordinate using the RectangularGridModelRectangularGridSpatialModel2D
getRectagularGrid()
boolean
isStartRandomlyOption()
void
moveToCenterOfCell(RectangularCell2D cell)
Move to the center of the cellvoid
moveToInsideCellRandomly(RectangularCell2D cell)
Moves to a random location within the specified cellRectangularCell2D
selectNeighborRandomly()
Does not include the core cell in the neighborhoodvoid
setCellSelector(RectangularCell2DSelectorIfc cellSelector)
void
setInitialPositionRandomly()
Randomly set the initial position using the getRandomCoordinate()void
setStartRandomlyOption(boolean startRandomlyFlag)
-
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
-
-
-
-
Field Detail
-
myGrid
protected RectangularGridSpatialModel2D myGrid
-
myGridModel
protected RectangularGridModel myGridModel
-
myCellSelector
protected RectangularCell2DSelectorIfc myCellSelector
-
myMoveController
protected EuclideanStepBasedMovementController myMoveController
-
myStartRandomlyFlag
protected boolean myStartRandomlyFlag
-
-
Constructor Detail
-
AbstractRG2DMover
public AbstractRG2DMover(RectangularGridModel parent)
-
AbstractRG2DMover
public AbstractRG2DMover(RectangularGridModel parent, java.lang.String name)
-
AbstractRG2DMover
public AbstractRG2DMover(RectangularGridModel parent, CoordinateIfc coordinate, java.lang.String name)
-
-
Method Detail
-
isStartRandomlyOption
public final boolean isStartRandomlyOption()
- Returns:
- true if initialized with random trip
-
setStartRandomlyOption
public final void setStartRandomlyOption(boolean startRandomlyFlag)
- Parameters:
startRandomlyFlag
- true means initialize with random trip
-
moveToCenterOfCell
public void moveToCenterOfCell(RectangularCell2D cell)
Move to the center of the cell- Parameters:
cell
- the cell
-
moveToInsideCellRandomly
public void moveToInsideCellRandomly(RectangularCell2D cell)
Moves to a random location within the specified cell- Parameters:
cell
- the cell to move in
-
setInitialPositionRandomly
public void setInitialPositionRandomly()
Randomly set the initial position using the getRandomCoordinate()
-
getRandomCoordinate
public CoordinateIfc getRandomCoordinate()
Randomly generates a coordinate using the RectangularGridModel- Returns:
- the coordinate
-
getGridModel
public final RectangularGridModel getGridModel()
- Returns:
- the RectangularGridSpatialModel2D
-
getCurrentCell
public final RectangularCell2D getCurrentCell()
- Returns:
- the current cell of the mover
-
getCellSelector
public RectangularCell2DSelectorIfc getCellSelector()
- Returns:
- a thing that knows how to select a cell
-
setCellSelector
public void setCellSelector(RectangularCell2DSelectorIfc cellSelector)
- Parameters:
cellSelector
- the selector
-
selectNeighborRandomly
public RectangularCell2D selectNeighborRandomly()
Does not include the core cell in the neighborhood- Returns:
- a randomly selected cell using the cell selector
-
getRectagularGrid
public final RectangularGridSpatialModel2D getRectagularGrid()
- Returns:
- the RectanularGridSpatialModel2D that contains the mover
-
getNeighborhoodList
protected java.util.List<RectangularCell2D> getNeighborhoodList()
A list of the Moore neighborhood for this mover. The core cell is not included in the list- Returns:
-
-