public static class Roads.Cross extends Roads
AbstractTile
class, represents a
tile in the cross.Roads.Bow, Roads.Cross, Roads.Priority, Roads.Road, Roads.Stop, Roads.TrafficLight, Roads.Zebra
Constructor and Description |
---|
Roads.Cross(java.awt.Image sprite,
Coordinates position,
Direction[] way)
Constructor of
Roads.Cross class, calls the constructor af the
super-class Roads and assigns the type of the tile to
CROSS of the TileType enum. |
Modifier and Type | Method and Description |
---|---|
boolean |
isOccupied()
Check if the tile is occupied or not.
|
void |
setFree(java.lang.String vehicleName)
Set the tile as free (not occupied).
|
void |
setOccupied(java.lang.String vehicleName)
Set the tile as occupied.
|
getPosition, getPossibleWays, getSprite, getType, setPosition, setPosition, setSprite, toString
public Roads.Cross(java.awt.Image sprite, Coordinates position, Direction[] way)
Roads.Cross
class, calls the constructor af the
super-class Roads
and assigns the type of the tile to
CROSS
of the TileType
enum.sprite
- the image used to portray the tileposition
- position expressed in Coordinates
way
- array of the possible ways expressed in Boolean[]public boolean isOccupied()
public void setOccupied(java.lang.String vehicleName) throws java.lang.IllegalStateException
vehicleName
- name of the vehicle that will occupy that tilejava.lang.IllegalStateException
- if the tile is already occupied.public void setFree(java.lang.String vehicleName)
vehicleName
- name of the vehicle that will occupy that tile