faa.tg.ground
Class GroundFix

java.lang.Object
  extended by faa.tg.nas.fix.Fix
      extended by faa.tg.ground.GroundFix
All Implemented Interfaces:
DraStorable, HasTextXY, TextWritable, HasName, HasPosition, Filterable, Closeable, Pathable, Targetable, Recordable, ManagedObject, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<GroundFixState>

public class GroundFix
extends Fix
implements java.lang.Iterable<GroundFixState>, Pathable, Closeable

GroundFix represents a point on the ground and is used for navigation in the ground-based portion of the simulator. It extends faa.tg.nas.fix.Fix and can be used anywhere a normal Fix can be used. What separates GroundFix from Fix is the knowledge of what other GroundFixes it is connected to. GroundFix keeps track of all other GroundFixes it connects to--these connections are one-way however and it is possible for a GroundFix to have an outgoing connection but for the other GroundFix to not be connected back to the originator.

Version:
$Id: GroundFix.java,v 3.37 2009/01/27 20:20:43 lykensj Exp $
Author:
jimh
See Also:
Serialized Form

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID.
private  GroundFixType fixType
           
private  java.util.Map<java.lang.String,GroundFixConnection> mConnections
           
private  java.util.List<GroundFixState> mStates
           
private  java.lang.String mType
           
(package private) static long serialVersionUID
           
 
Fields inherited from class faa.tg.nas.fix.Fix
magDec
 
Constructor Summary
GroundFix(java.lang.String name, Position position)
          Constructs a GroundFix with the specified name and position and a type of "Unknown".
GroundFix(java.lang.String name, Position position, GroundFixType type)
          Constructs a GroundFix with the specified name, position, and type.
GroundFix(java.lang.String name, Position position, java.lang.String type)
          Constructs a GroundFix with the specified name, position, and type.
 
Method Summary
protected  void activate()
           
private  void addConnection(GroundFixConnection connection, GroundFix fix)
          Adds a GroundFixConnection to the GroundFix's list of connections.
 Point calculatePullPoint(Point p)
          Approximates the closest point in a Targetable to the point given as a parameter.
 void close()
          Closes the GroundFixStates this contains for pathfinding.
 GroundFixConnection connectToFix(GroundFix aFix, Locale locale)
           
 GroundFixConnection connectToFix(GroundFix aFix, Position aCtlOne, Position aCtlTwo, Locale locale)
           
protected  void deactivate()
           
 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.
 GroundFixConnection getConnection(GroundFix fix)
          Returns the connection this GroundFix has to the specified GroundFix, if a connection exists.
 java.util.Collection<GroundFixConnection> getConnections()
          Gets an collection of the GroundFixConnections to which this GroundNode is connected
protected  Point getLocation()
           
 ConnectionFilter getStartingFilter(TurnDirection dir)
          Returns appropriate ConnectionFilter to use when this Pathable is used as the start point in path finding.
 java.util.Collection<GroundFixState> getStartStates()
          Returns all valid GroundFixStates a object could have and be considered "on" this Pathable.
 GroundFixType getType()
          Returns the type of this GroundFix.
 boolean isConnectedTo(GroundFix aNode)
          Returns whether this GroundFix is connected to the specified GroundFix.
 java.util.Iterator<GroundFixState> iterator()
          For Iterable
 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.
 void open()
          Opens the GroundFixStates this contains for pathfinding.
 void prependTo(java.util.ArrayDeque<GroundFixState> deque)
          Prepends (some of) this Pathable's GroundFixStates to a deque.
private  void registerEntranceConnection(GroundFixConnection gfc)
          Checks if this will create a non-exitable state.
private  void registerExitingConnection(GroundFixConnection gfc)
           
protected  void removeConnection(GroundFix fix)
           
protected  void removeState(GroundFixState gfs)
           
 int size()
          Finds the number of GroundFixStates this Pathable has sequentially.
(package private)  GroundFix split(Manager<GroundFix> manager)
           
 java.lang.String toString()
          Get a String representation of this object
 
Methods inherited from class faa.tg.nas.fix.Fix
clone, equals, getIcaoCode, getMagneticDeclination, getName, getPosition, getPublishedHoldIfApplicable, getVorNavAid, hashCode, setIcaoCode, setPublishedHold, toDraText, toDraText
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface faa.tg.scenario.manager.ManagedObject
getName
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID.

See Also:
Constant Field Values

mConnections

private transient java.util.Map<java.lang.String,GroundFixConnection> mConnections

mStates

private transient java.util.List<GroundFixState> mStates

mType

private java.lang.String mType

fixType

private transient GroundFixType fixType
Constructor Detail

GroundFix

public GroundFix(java.lang.String name,
                 Position position)
Constructs a GroundFix with the specified name and position and a type of "Unknown".

Parameters:
name - the name
position - the position

GroundFix

public GroundFix(java.lang.String name,
                 Position position,
                 java.lang.String type)
Constructs a GroundFix with the specified name, position, and type.

Parameters:
name - the name
position - the position
type - the type

GroundFix

public GroundFix(java.lang.String name,
                 Position position,
                 GroundFixType type)
Constructs a GroundFix with the specified name, position, and type.

Parameters:
name - the name
position - the position
type - the type
Method Detail

getType

public GroundFixType getType()
Returns the type of this GroundFix.

Returns:
the type of the GroundFix

connectToFix

public GroundFixConnection connectToFix(GroundFix aFix,
                                        Locale locale)

connectToFix

public GroundFixConnection connectToFix(GroundFix aFix,
                                        Position aCtlOne,
                                        Position aCtlTwo,
                                        Locale locale)

activate

protected void activate()

deactivate

protected void deactivate()

registerEntranceConnection

private void registerEntranceConnection(GroundFixConnection gfc)
Checks if this will create a non-exitable state.

Parameters:
gfc -

registerExitingConnection

private void registerExitingConnection(GroundFixConnection gfc)

addConnection

private void addConnection(GroundFixConnection connection,
                           GroundFix fix)
Adds a GroundFixConnection to the GroundFix's list of connections. The GroundFix cannot add a connection to itself or to a GroundFix to which it is already connected.

Parameters:
connection - the GroundFixConnection to add to this GroundFix

getConnection

public GroundFixConnection getConnection(GroundFix fix)
Returns the connection this GroundFix has to the specified GroundFix, if a connection exists. This method can return null.

Parameters:
fix - the GroundFix you want the connection to
Returns:
the GroundFixConnection, if it exists

isConnectedTo

public boolean isConnectedTo(GroundFix aNode)
Returns whether this GroundFix is connected to the specified GroundFix.

Parameters:
aNode - the GroundFix you wish to see if there is a connection for
Returns:
whether there is a connection or not

getConnections

public java.util.Collection<GroundFixConnection> getConnections()
Gets an collection of the GroundFixConnections to which this GroundNode is connected

Returns:
Collection of the the GroundFixConnections this is connected to

toString

public java.lang.String toString()
Get a String representation of this object

Overrides:
toString in class Fix
Returns:
String representation of this GroundNode

iterator

public java.util.Iterator<GroundFixState> iterator()
For Iterable

Specified by:
iterator in interface java.lang.Iterable<GroundFixState>

removeState

protected void removeState(GroundFixState gfs)

removeConnection

protected void removeConnection(GroundFix fix)

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.

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.

close

public void close()
Description copied from interface: Closeable
Closes the GroundFixStates this contains for pathfinding.

Specified by:
close in interface Closeable

open

public void open()
Description copied from interface: Closeable
Opens the GroundFixStates this contains for pathfinding.

Specified by:
open in interface Closeable

getStartStates

public java.util.Collection<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

getLocation

protected Point getLocation()

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.

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.

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.

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.

split

GroundFix split(Manager<GroundFix> manager)