public class Ground extends Slot
Ground
is a Slot
that represents all elements
of the game field the trains can't traverse on.Modifier and Type | Method and Description |
---|---|
boolean |
checkCollision()
Returns true, since a
Vehicle moving onto the Ground is interpreted as a collision
in the game. |
static Ground |
getInstance()
Static method that returns a reference to the attribute
instance ,
which is the single instance of Ground . |
Slot |
getNextSlot(Slot previousSlot)
Returns the
Slot an object must move to after its next step determined by
previousSlot . |
acquire, addStation, arrive, depart, getStation, getVehicle, isAcquired, release
public static Ground getInstance()
instance
,
which is the single instance of Ground
.Ground
public Slot getNextSlot(Slot previousSlot)
Slot
an object must move to after its next step determined by
previousSlot
.
In this case, it is the single instance
of Ground
itself.
getNextSlot
in class Slot
previousSlot
- Slot
that determines the direction of movementSlot
to move to, which is the Ground instance
public boolean checkCollision()
Vehicle
moving onto the Ground
is interpreted as a collision
in the game.checkCollision
in class Slot
true
, since not a single Vehicle
should move onto the Ground