aim4.map.destination
Class RandomDestinationSelector

java.lang.Object
  extended by aim4.map.destination.RandomDestinationSelector
All Implemented Interfaces:
DestinationSelector

public class RandomDestinationSelector
extends Object
implements DestinationSelector

The RandomDestinationSelector selects Roads uniformly at random, but will not select a Road that is the dual of the starting Road. This is to prevent Vehicles from simply going back from whence they came.


Constructor Summary
RandomDestinationSelector(BasicMap layout)
          Create a new RandomDestinationSelector from the given Layout.
 
Method Summary
 Road selectDestination(Lane currentLane)
          Select the Road which the given Vehicle should use as its destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomDestinationSelector

public RandomDestinationSelector(BasicMap layout)
Create a new RandomDestinationSelector from the given Layout.

Parameters:
layout - the Layout from which to create the RandomDestinationSelector
Method Detail

selectDestination

public Road selectDestination(Lane currentLane)
Select the Road which the given Vehicle should use as its destination.

Specified by:
selectDestination in interface DestinationSelector
Parameters:
currentLane - the lane the Vehicle is currently on, usually also the lane the vehicle spawned on
Returns:
the Road which the Vehicle should use as its destination


Copyright © 2011. All Rights Reserved.