faa.tg.ground
Class AbstractStateRoute

java.lang.Object
  extended by faa.tg.ground.AbstractStateRoute
All Implemented Interfaces:
ParameterizedCurve, Pathable, Targetable, ManagedObject, java.lang.Iterable<GroundFixState>
Direct Known Subclasses:
GroundPath, StateRoute

public abstract class AbstractStateRoute
extends java.lang.Object
implements Pathable, java.lang.Iterable<GroundFixState>, ParameterizedCurve

 
See the source: AbstractStateRoute.java

Version:
$Id: AbstractStateRoute.java,v 3.8 2009/01/27 20:20:42 lykensj Exp $
Author:
lykensj, Engility Sep 3, 2008 1:59:52 PM

Field Summary
private  java.lang.String name
          The name of the route.
private  java.util.ArrayDeque<GroundFixState> route
           
 
Fields inherited from interface faa.tg.ground.Pathable
CVS_VERSION_ID
 
Constructor Summary
AbstractStateRoute(java.lang.String name, java.util.ArrayDeque<GroundFixState> route)
           
 
Method Summary
protected  void addAllTo(GroundPath groute)
           
 double binarySearch(Point p)
           
 Distance calculateArcLength(double start, double end)
           
 Point calculatePullPoint(Point p)
          Approximates the closest point in a Targetable to the point given as a parameter.
 Distance calculateRemainingArcLength(double start)
           
 boolean contains(GroundFixState state)
           
protected  boolean endsWith(TurnDirection dir)
           
 Point findClosestPoint(Point p)
           
 double findClosestValue(Point p)
           
 java.util.Set<java.lang.Double> findIntersections(LineSegment seg, double start)
           
 Pathable findRestriction(GroundFixState state)
          Given the last fix on a partially compiled route with this as the next way point, finds the (potentially) truncated Pathable that can be smoothly added to the route.
protected abstract  java.util.List<GroundFixConnection> getConnections()
           
 Point getEndingPoint()
           
 GroundFixState getLast()
           
abstract  Distance getLength()
           
protected  Distance getModifiedLength()
          NOT THREAD SAFE!
 java.lang.String getName()
          Represents a unique instance of a class: objects should either be the only object of a class with that name, or should replace obsolete objects of that name.
 Point getPoint(double t)
           
 PolygonalPath getPolygonalPath()
           
 ConnectionFilter getStartingFilter(TurnDirection dir)
          Returns appropriate ConnectionFilter to use when this Pathable is used as the start point in path finding.
 Point getStartingPoint()
           
 java.util.ArrayDeque<GroundFixState> getStartStates()
          Returns all valid GroundFixStates a object could have and be considered "on" this Pathable.
 java.util.Iterator<GroundFixState> iterator()
           
 java.util.Collection<Node> makeRootNodes(Pathable goal, Targetable next)
          Creates all possible starting Nodes necessary to use this Pathable as a starting point for path finding.
 double maximum()
           
 double minimum()
           
 void prependTo(java.util.ArrayDeque<GroundFixState> deque)
          Prepends (some of) this Pathable's GroundFixStates to a deque.
 double projectAhead(Distance distance, double start)
           
 Pathable relocate(Point p)
           
protected  void severConnections()
           
protected  StateRoute shortenBy(int i)
           
 int size()
          Finds the number of GroundFixStates this Pathable has sequentially.
protected  boolean startsWith(TurnDirection dir)
           
 java.lang.String toString()
           
 boolean validateParameter(double t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

route

private final java.util.ArrayDeque<GroundFixState> route

name

private final java.lang.String name
The name of the route.

Constructor Detail

AbstractStateRoute

AbstractStateRoute(java.lang.String name,
                   java.util.ArrayDeque<GroundFixState> route)
Method Detail

findRestriction

public Pathable findRestriction(GroundFixState state)
Description copied from interface: Pathable
Given the last fix on a partially compiled route with this as the next way point, finds the (potentially) truncated Pathable that can be smoothly added to the route.

Specified by:
findRestriction in interface Pathable
Returns:
the truncated Pathable or this if no truncation if necessary.

prependTo

public void prependTo(java.util.ArrayDeque<GroundFixState> deque)
Description copied from interface: Pathable
Prepends (some of) this Pathable's GroundFixStates to a deque. Checks for appropriate stopping point. May change nothing if class dependent conditions are not met.

Specified by:
prependTo in interface Pathable
Parameters:
deque - the deque to append to.

shortenBy

protected StateRoute shortenBy(int i)

addAllTo

protected void addAllTo(GroundPath groute)
                 throws PathNotFoundException
Throws:
PathNotFoundException

getStartStates

public java.util.ArrayDeque<GroundFixState> getStartStates()
Description copied from interface: Pathable
Returns all valid GroundFixStates a object could have and be considered "on" this Pathable.

Specified by:
getStartStates in interface Pathable
Returns:
the Collection of GroundFixStates

size

public int size()
Description copied from interface: Pathable
Finds the number of GroundFixStates this Pathable has sequentially. For example, if the Pathable consists of four mutually exclusive starting GroundFixStates, {A,B,C,D}, size will return 1. If it consists of four chained states , A->B->C->D , it will return 4.

Specified by:
size in interface Pathable
Returns:
the sequential size.

getName

public java.lang.String getName()
Description copied from interface: ManagedObject
Represents a unique instance of a class: objects should either be the only object of a class with that name, or should replace obsolete objects of that name.

Specified by:
getName in interface ManagedObject
Returns:
Returns the name of the object.

contains

public final boolean contains(GroundFixState state)

getLast

public GroundFixState getLast()

severConnections

protected void severConnections()

endsWith

protected boolean endsWith(TurnDirection dir)

startsWith

protected boolean startsWith(TurnDirection dir)

binarySearch

public double binarySearch(Point p)

calculatePullPoint

public Point calculatePullPoint(Point p)
Description copied from interface: Targetable
Approximates the closest point in a Targetable to the point given as a parameter.

Specified by:
calculatePullPoint in interface Targetable
Parameters:
p - the point to check against.
Returns:
the estimated closest Point.

maximum

public double maximum()
Specified by:
maximum in interface ParameterizedCurve

minimum

public double minimum()
Specified by:
minimum in interface ParameterizedCurve

iterator

public java.util.Iterator<GroundFixState> iterator()
Specified by:
iterator in interface java.lang.Iterable<GroundFixState>

getStartingFilter

public ConnectionFilter getStartingFilter(TurnDirection dir)
Description copied from interface: Pathable
Returns appropriate ConnectionFilter to use when this Pathable is used as the start point in path finding.

Specified by:
getStartingFilter in interface Pathable
Parameters:
dir - TurnDirection that the filter restricts exits to. Use UNKNOWN for no restriction.
Returns:
the filter.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

makeRootNodes

public java.util.Collection<Node> makeRootNodes(Pathable goal,
                                                Targetable next)
                                         throws PathNotFoundException
Description copied from interface: Pathable
Creates all possible starting Nodes necessary to use this Pathable as a starting point for path finding.

Specified by:
makeRootNodes in interface Pathable
Parameters:
goal - The ultimate goal of the path finding.
next - the next Targetable traveled to.
Returns:
a Collection of the appropriate Nodes.
Throws:
PathNotFoundException - if this has no exit states.

relocate

public Pathable relocate(Point p)

getModifiedLength

protected Distance getModifiedLength()
NOT THREAD SAFE!

Returns:

getConnections

protected abstract java.util.List<GroundFixConnection> getConnections()

getLength

public abstract Distance getLength()
Specified by:
getLength in interface ParameterizedCurve

calculateArcLength

public Distance calculateArcLength(double start,
                                   double end)
Specified by:
calculateArcLength in interface ParameterizedCurve

projectAhead

public double projectAhead(Distance distance,
                           double start)
Specified by:
projectAhead in interface ParameterizedCurve

calculateRemainingArcLength

public Distance calculateRemainingArcLength(double start)
Specified by:
calculateRemainingArcLength in interface ParameterizedCurve

getStartingPoint

public Point getStartingPoint()
Specified by:
getStartingPoint in interface ParameterizedCurve

getEndingPoint

public Point getEndingPoint()
Specified by:
getEndingPoint in interface ParameterizedCurve

getPolygonalPath

public PolygonalPath getPolygonalPath()
Specified by:
getPolygonalPath in interface ParameterizedCurve

findClosestValue

public double findClosestValue(Point p)
Specified by:
findClosestValue in interface ParameterizedCurve

findClosestPoint

public Point findClosestPoint(Point p)
Specified by:
findClosestPoint in interface ParameterizedCurve

findIntersections

public java.util.Set<java.lang.Double> findIntersections(LineSegment seg,
                                                         double start)
Specified by:
findIntersections in interface ParameterizedCurve

getPoint

public Point getPoint(double t)
Specified by:
getPoint in interface ParameterizedCurve

validateParameter

public boolean validateParameter(double t)
Specified by:
validateParameter in interface ParameterizedCurve