org.intranet.elevator.model
Class MovableLocation
java.lang.Object
org.intranet.sim.ModelElement
org.intranet.elevator.model.Location
org.intranet.elevator.model.MovableLocation
- Direct Known Subclasses:
- Car
- public abstract class MovableLocation
- extends Location
A location that can move. The state of movement is kept between
height and destinationHeight. If they are equal, then the
MovableLocation is still. If they are not equal, then the
MovableLocation is moving.
Valid states:
State |
Variables |
Transitions |
destinationHeight |
setDestinationHeight() |
[ArrivalEvent] |
IDLE |
height |
IDLE:[arrive()] or travel(): MOVING |
Impossible |
MOVING |
other |
IDLE:[arrive()] or travel(): MOVING |
IDLE:[arrive()] |
Note that arrive()
is like an event that is picked up by the
subclass, as it is an abstract method.
Fields inherited from class org.intranet.elevator.model.Location |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
destinationHeight
private float destinationHeight
totalDistance
private float totalDistance
numTravels
private int numTravels
arrivalEvent
private Event arrivalEvent
MovableLocation
MovableLocation(EventQueue eQ,
float height,
int capacity)
getTotalDistance
public final float getTotalDistance()
getNumTravels
public final int getNumTravels()
getTravelTime
public final float getTravelTime(float distance)
setHeight
public final void setHeight(float newHeight)
- Overrides:
setHeight
in class Location
setDestinationHeight
protected final void setDestinationHeight(float h)
arrive
protected abstract void arrive()
getRatePerSecond
protected abstract float getRatePerSecond()
checkDirectionChange
private void checkDirectionChange(float h)
travel
private void travel()