nl.tudelft.simulation.traffic.track
Class Track

java.lang.Object
  extended bynl.tudelft.simulation.traffic.track.Track
All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.LocatableInterface, TrackInterface
Direct Known Subclasses:
ArcTrack, StraightTrack, VirtualTrack

public abstract class Track
extends java.lang.Object
implements TrackInterface, nl.tudelft.simulation.dsol.animation.LocatableInterface

This class implements the TrackInterface.

Author:
Alexander Verbraeck
Original authors: J.H. Kwakkel and H.W.G. Phaff

Field Summary
protected  TrackLinkInterface endLink
          the end link
protected  java.lang.String name
          the name (id) of the track
protected  TrackLinkInterface startLink
          the start link
protected static int TRACK_ROUTE_ACTIVE
          active route from a certain point
protected static int TRACK_ROUTE_ALL
          all routes from a certain point
protected static int TRACK_ROUTE_LINE
          line route from a certain point
protected  java.util.List vehicles
          the vehicles on the track
 
Constructor Summary
Track(java.lang.String name, TrackLinkInterface startLink, TrackLinkInterface endLink)
           
 
Method Summary
 void addControlPoint(ControlPointInterface cp)
          This method adds a controlPoint to this track.
 void addVehicle(VehiclePhysicalInterface vehicle)
          indicate that a vehicle is driving on the track (with front)
static double calculateDistanceFrontBack(TrackProgression tp0, TrackProgression tp1, double maxDistance)
           
static double calculateDistanceFrontBack(VehiclePhysicalInterface vehicle0, VehiclePhysicalInterface vehicle1)
           
 TrackProgression calculateTrackProgressionListActive(double delta)
          Calculate a position on the 'active' track located 'delta' meters from the start of the current track.
 java.util.List calculateTrackProgressionListAll(double delta)
          Calculate all positions on tracks located 'delta' meters from the start of the current track.
 java.util.List calculateTrackProgressionListLine(double delta, java.lang.String line)
          Calculate a position on a track located 'delta' meters from the start of the current track.
 ControlPointsList getControlPoints()
          Returns controlpoints for the track, as a sorted list.
 ControlPointsList getCpsOnInterval(double progression, double lengthOfInterval)
          This method checks for controlPoints in an interval, inclusive, so returns cps that are on the edges of the interval
 double getdx()
           
 double getdy()
           
 TrackLinkInterface getEndLink()
          This method returns the link seen as the link at which the track ends.
 nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
           
 TrackLinkInterface getStartLink()
          This method returns the link seen as the link from which the track starts.
 java.util.List getVehiclesOnTrack()
          get the vehicles on the track
 void removeControlPoint(ControlPointInterface cp)
          This method removes a given cp from the ControlPointsLists of the track.
 void removeVehicle(VehiclePhysicalInterface vehicle)
          indicate that a vehicle is no longer driving on the track (with front)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.traffic.track.TrackInterface
getLength, getLocationOfProgression
 
Methods inherited from interface nl.tudelft.simulation.dsol.animation.LocatableInterface
getBounds
 

Field Detail

name

protected java.lang.String name
the name (id) of the track


startLink

protected TrackLinkInterface startLink
the start link


endLink

protected TrackLinkInterface endLink
the end link


vehicles

protected java.util.List vehicles
the vehicles on the track


TRACK_ROUTE_ALL

protected static final int TRACK_ROUTE_ALL
all routes from a certain point

See Also:
Constant Field Values

TRACK_ROUTE_ACTIVE

protected static final int TRACK_ROUTE_ACTIVE
active route from a certain point

See Also:
Constant Field Values

TRACK_ROUTE_LINE

protected static final int TRACK_ROUTE_LINE
line route from a certain point

See Also:
Constant Field Values
Constructor Detail

Track

public Track(java.lang.String name,
             TrackLinkInterface startLink,
             TrackLinkInterface endLink)
Parameters:
name -
startLink -
endLink -
Method Detail

getStartLink

public TrackLinkInterface getStartLink()
Description copied from interface: TrackInterface
This method returns the link seen as the link from which the track starts.

Specified by:
getStartLink in interface TrackInterface
Returns:
startLink
See Also:
TrackInterface.getStartLink()

getEndLink

public TrackLinkInterface getEndLink()
Description copied from interface: TrackInterface
This method returns the link seen as the link at which the track ends.

Specified by:
getEndLink in interface TrackInterface
Returns:
endLink
See Also:
TrackInterface.getEndLink()

getControlPoints

public ControlPointsList getControlPoints()
Description copied from interface: TrackInterface
Returns controlpoints for the track, as a sorted list.

Specified by:
getControlPoints in interface TrackInterface
Returns:
controlPoints
See Also:
TrackInterface.getControlPoints()

addControlPoint

public void addControlPoint(ControlPointInterface cp)
Description copied from interface: TrackInterface
This method adds a controlPoint to this track.

Specified by:
addControlPoint in interface TrackInterface
Parameters:
cp -
See Also:
TrackInterface.addControlPoint(nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface)

getCpsOnInterval

public ControlPointsList getCpsOnInterval(double progression,
                                          double lengthOfInterval)
Description copied from interface: TrackInterface
This method checks for controlPoints in an interval, inclusive, so returns cps that are on the edges of the interval

Specified by:
getCpsOnInterval in interface TrackInterface
Parameters:
progression -
lengthOfInterval -
Returns:
controlPoints
See Also:
TrackInterface.getCpsOnInterval( double, double)

getdx

public double getdx()
Returns:
dx

getdy

public double getdy()
Returns:
dy

getLocation

public nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
                                                            throws java.rmi.RemoteException
Specified by:
getLocation in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
Throws:
java.rmi.RemoteException
See Also:
LocatableInterface.getLocation()

removeControlPoint

public void removeControlPoint(ControlPointInterface cp)
Description copied from interface: TrackInterface
This method removes a given cp from the ControlPointsLists of the track.

Specified by:
removeControlPoint in interface TrackInterface
Parameters:
cp -
See Also:
TrackInterface.removeControlPoint(nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface)

toString

public java.lang.String toString()
Returns:
Returns the name.

addVehicle

public void addVehicle(VehiclePhysicalInterface vehicle)
Description copied from interface: TrackInterface
indicate that a vehicle is driving on the track (with front)

Specified by:
addVehicle in interface TrackInterface
Parameters:
vehicle -
See Also:
TrackInterface.addVehicle(nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface)

removeVehicle

public void removeVehicle(VehiclePhysicalInterface vehicle)
Description copied from interface: TrackInterface
indicate that a vehicle is no longer driving on the track (with front)

Specified by:
removeVehicle in interface TrackInterface
Parameters:
vehicle -
See Also:
TrackInterface.removeVehicle(nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface)

getVehiclesOnTrack

public java.util.List getVehiclesOnTrack()
Description copied from interface: TrackInterface
get the vehicles on the track

Specified by:
getVehiclesOnTrack in interface TrackInterface
Returns:
the list of vehicles
See Also:
TrackInterface.getVehiclesOnTrack()

calculateTrackProgressionListAll

public java.util.List calculateTrackProgressionListAll(double delta)
Calculate all positions on tracks located 'delta' meters from the start of the current track. Delta can be positive or negative. When the track splits, all paths are followed, and points on all the paths are returned.

Specified by:
calculateTrackProgressionListAll in interface TrackInterface
Parameters:
delta -
Returns:

calculateTrackProgressionListActive

public TrackProgression calculateTrackProgressionListActive(double delta)
Calculate a position on the 'active' track located 'delta' meters from the start of the current track. When the track splits, only the active path is followed, and a point on that path is returned. The active path is determined by the current setting of the switches in the links that connect the tracks.

Specified by:
calculateTrackProgressionListActive in interface TrackInterface
Parameters:
delta -
Returns:

calculateTrackProgressionListLine

public java.util.List calculateTrackProgressionListLine(double delta,
                                                        java.lang.String line)
Calculate a position on a track located 'delta' meters from the start of the current track. Delta can (for now) only be positive. When the track splits, the path that is linked to the given line number is followed, and a point on that path is returned. This path is determined by the way the switches will be set when a vehicle of the given line number passes.

Specified by:
calculateTrackProgressionListLine in interface TrackInterface
Parameters:
delta -
line -
Returns:

calculateDistanceFrontBack

public static double calculateDistanceFrontBack(VehiclePhysicalInterface vehicle0,
                                                VehiclePhysicalInterface vehicle1)
Parameters:
vehicle0 -
vehicle1 -
Returns:

calculateDistanceFrontBack

public static double calculateDistanceFrontBack(TrackProgression tp0,
                                                TrackProgression tp1,
                                                double maxDistance)
Parameters:
tp0 -
tp1 -
maxDistance -
Returns:


Copyright © 2003-2004 Delft University of Technology, the Netherlands. All Rights Reserved.