aim4.map
Class Road

java.lang.Object
  extended by aim4.map.Road

public class Road
extends Object

A group of lanes with a name.


Constructor Summary
Road(String name, BasicMap map)
          Create a new Road with no Lanes.
Road(String name, List<Lane> lanes, BasicMap map)
          Create a new Road with the given Lanes, ordered from left to right.
 
Method Summary
 void addTheRightMostLane(Lane lane)
          Add a right most lane to this Road.
 Road getDual()
          Get the Road that follows this Road in the opposite direction.
 Lane getIndexLane()
          Get the leftmost Lane in this Road.
 List<Lane> getLanes()
          Get the Lanes that make up this Road, in order from left to right.
 double getMaximumConnectedSpeedLimit()
          Get the maximum speed limit of any connected road.
 String getName()
          Get the name of this Road.
 boolean hasDual()
          Whether or not this Road has a dual.
 void setDual(Road dual)
          Set the Road that follows this Road in the opposite direction.
 String toString()
          Get the name of this Road.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Road

public Road(String name,
            BasicMap map)
Create a new Road with no Lanes. Lanes can then be added.

Parameters:
name - the name of the Road
map - the map of which the Road is a part

Road

public Road(String name,
            List<Lane> lanes,
            BasicMap map)
Create a new Road with the given Lanes, ordered from left to right.

Parameters:
name - the name of the Road
lanes - the Lanes from which to make the Road
map - the Layout of which the Road is a part
Method Detail

getMaximumConnectedSpeedLimit

public double getMaximumConnectedSpeedLimit()
Get the maximum speed limit of any connected road.

Returns:
the maximum speed limit, in meters per second, of any connected road

getLanes

public List<Lane> getLanes()
Get the Lanes that make up this Road, in order from left to right.

Returns:
the Lanes that make up this Road, in order from left to right

getIndexLane

public Lane getIndexLane()
Get the leftmost Lane in this Road.

Returns:
the leftmost Lane in this Road

getDual

public Road getDual()
Get the Road that follows this Road in the opposite direction.

Returns:
the Road that follows this Road in the opposite direction

setDual

public void setDual(Road dual)
Set the Road that follows this Road in the opposite direction.

Parameters:
dual - the Road that follows this Road in the opposite direction

hasDual

public boolean hasDual()
Whether or not this Road has a dual.

Returns:
whether or not this Road has a dual

addTheRightMostLane

public void addTheRightMostLane(Lane lane)
Add a right most lane to this Road.

Parameters:
lane - the Lane to add

toString

public String toString()
Get the name of this Road. An alias for getName().

Overrides:
toString in class Object
Returns:
the name of this Road

getName

public String getName()
Get the name of this Road.

Returns:
the name of this Road


Copyright © 2011. All Rights Reserved.