public interface Trailable
Trailable
is an interface that specifies the behavior of classes
Coach
and NotifierCoach
, the instances of which both can be pulled or
emptied in the game, that is, they can be forced to move by other Vehicle
objects.Modifier and Type | Method and Description |
---|---|
void |
step(Slot nextSlot,
boolean hasPassengersAhead)
Moves this to the position given by
nextSlot . |
void step(Slot nextSlot, boolean hasPassengersAhead)
nextSlot
. It lets go of its
current position and occupies the newly given position and pulls
the object connected to it. The caller also passes information about the presence of
passengers in any Vehicle
s ahead.nextSlot
- the Slot
to be occupiedhasPassengersAhead
- there are passengers in the Trailable
s ahead of this