org.jscience.architecture.traffic.algorithms.dp
Class AggressiveDP

java.lang.Object
  extended by org.jscience.architecture.traffic.algorithms.dp.DrivingPolicy
      extended by org.jscience.architecture.traffic.algorithms.dp.AggressiveDP
All Implemented Interfaces:
TwoStageLoader, XMLSerializable

public class AggressiveDP
extends DrivingPolicy

This extension of gld.DrivingPolicy selects the next lane by finding one which is on the shortest path to road user's destination.


Field Summary
static java.lang.String shortXMLName
           
 
Fields inherited from class org.jscience.architecture.traffic.algorithms.dp.DrivingPolicy
model, tlc
 
Constructor Summary
AggressiveDP(SimModel sim, TLController _tlc)
          The constructor for a shortest driving policy.
 
Method Summary
 boolean checkNeighbourLanes(Drivelane lane, Roaduser ru, int speed_left, Drivelane[] shortest)
          Checks the drivelanes left and right of this lane, to see if an aggressive roaduser can switch drivelane.
 Drivelane getDirectionLane(Roaduser r, Drivelane lane_now, Drivelane[] allOutgoing, Drivelane[] shortest)
          The lane to which a car continues his trip.
 java.lang.String getXMLName()
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          Empty for Drivingpolicy
 XMLElement saveSelf()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.architecture.traffic.algorithms.dp.DrivingPolicy
getDirection, loadSecondStage, saveChilds, setParentName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shortXMLName

public static final java.lang.String shortXMLName
See Also:
Constant Field Values
Constructor Detail

AggressiveDP

public AggressiveDP(SimModel sim,
                    TLController _tlc)
The constructor for a shortest driving policy.

Parameters:
m - The model which is used
Method Detail

getDirectionLane

public Drivelane getDirectionLane(Roaduser r,
                                  Drivelane lane_now,
                                  Drivelane[] allOutgoing,
                                  Drivelane[] shortest)
The lane to which a car continues his trip.

Specified by:
getDirectionLane in class DrivingPolicy
Parameters:
r - The road user being asked.
allOutgoing - All the possible outgoing lanes
shortest - All the lanes which are in a shortest path to the car's destination
lane_now - DOCUMENT ME!
Returns:
The chosen lane.

checkNeighbourLanes

public boolean checkNeighbourLanes(Drivelane lane,
                                   Roaduser ru,
                                   int speed_left,
                                   Drivelane[] shortest)
                            throws InfraException
Checks the drivelanes left and right of this lane, to see if an aggressive roaduser can switch drivelane.

Parameters:
lane - The lane, the roaduser is now on.
ru - The roaduser
speed_left - The left speed of this roaduser
shortest - All the lanes which are in a shortest path to the car's destination
Returns:
True when the roaduser has switched, false otherwise.
Throws:
InfraException

load

public void load(XMLElement myElement,
                 XMLLoader loader)
          throws XMLTreeException,
                 java.io.IOException,
                 XMLInvalidInputException
Description copied from class: DrivingPolicy
Empty for Drivingpolicy

Specified by:
load in interface XMLSerializable
Overrides:
load in class DrivingPolicy
Parameters:
myElement - DOCUMENT ME!
loader - DOCUMENT ME!
Throws:
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!

saveSelf

public XMLElement saveSelf()
                    throws XMLCannotSaveException
Description copied from interface: XMLSerializable
DOCUMENT ME!

Returns:
The XMLElement which represents the internal datastate. This function is not meant to save child objects. That is done in void saveChilds()
Throws:
XMLCannotSaveException - The XMLSerializable can throw this exception if it cannot save itself or one of its child objects for whatever reason.

getXMLName

public java.lang.String getXMLName()
Description copied from interface: XMLSerializable
DOCUMENT ME!

Returns:
The tagname of the XML element in which information about this object is stored prepended by a dot separated list of the tagnames of the parents of this object. (e.g. "model.infrastructure.node")