public class Station
extends java.lang.Object
Station
represents the stations connected to Slot
s.
A Station
has a Color
and it can also have passengers waiting at it.Constructor and Description |
---|
Station(Color color,
boolean hasPassengers)
Creates a
Station with a Color given by the parameter color
and with waiting passengers determined by the parameter hasPassengers . |
Modifier and Type | Method and Description |
---|---|
Color |
getColor()
Returns the
Color of this Station . |
boolean |
hasPassengers() |
boolean |
releasePassengers()
Releases the passengers waiting at this
Station and returns if there were
any to release. |
public Station(Color color, boolean hasPassengers)
Station
with a Color
given by the parameter color
and with waiting passengers determined by the parameter hasPassengers
.color
- the Color
of the Station
to be createdhasPassengers
- there should be passengers waiting at this Station
public Color getColor()
Color
of this Station
.Color
of this Station
public boolean releasePassengers()
Station
and returns if there were
any to release.true
if there were passengers waiting at this Station
,
false
if there weren'tpublic boolean hasPassengers()