org.deltava.beans.navdata
Class Airway

java.lang.Object
  extended by org.deltava.beans.navdata.Airway
All Implemented Interfaces:
Comparable<Airway>, GeoLocation, Route, Cacheable
Direct Known Subclasses:
OceanicTrack, TerminalRoute

public class Airway
extends Object
implements Comparable<Airway>, Cacheable, Route, GeoLocation

A bean to store Airway names and waypoint data. Since there can be multiple Airways across the world with the same code, each intersection can be flagged as "end of sequence" deliniating the end of a particular airway sequence.

Since:
1.0
Version:
2.4
Author:
Luke

Field Summary
 
Fields inherited from interface org.deltava.beans.GeoLocation
ALL, DEGREE_MILES, LAT_DIRECTIONS, LATITUDE, LON_DIRECTIONS, LONGITUDE
 
Constructor Summary
Airway(String code, int seq)
          Creates a new Airway bean.
 
Method Summary
 void addWaypoint(NavigationDataBean nd)
          Adds a waypoint to the Airway route.
 Object cacheKey()
          Returns the cache key.
 int compareTo(Airway a2)
          Compares two airways by comparing their names and sequence numbers.
 boolean equals(Object o2)
           
 String getCode()
          Returns the airway code.
 double getLatitude()
          Returns the latitude of the middle of the Airway.
 double getLongitude()
          Returns the longitude of the middle of the Airway.
 String getRoute()
          Returns the Airway route.
 int getSequence()
          Returns the sequence number, used to differentiate airways with different locations but the same code.
 int getSize()
          Returns the number of waypoints in the airway.
 LinkedList<NavigationDataBean> getWaypoints()
          Returns the waypoints for this Airway.
 List<NavigationDataBean> getWaypoints(String start, String end)
          Returns a subset of waypoints for this Airway between two waypoints.
 int hashCode()
           
 boolean isHighLevel()
          Returns if this Airway is a high-level Airway.
 boolean isLowLevel()
          Returns if this Airway is a low-level Airway.
 void setCode(String code)
          Updates the Airway code.
 void setHighLevel(boolean isHigh)
          Marks this Airway as a high-level Airway.
 void setLowLevel(boolean isLow)
          Marks this Airway as a low-level Airway.
 String toString()
          Returns the airway code.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Airway

public Airway(String code,
              int seq)
Creates a new Airway bean.

Parameters:
code - the airway code
seq - the airway sequence code
Throws:
NullPointerException - if code is null
Method Detail

getCode

public String getCode()
Returns the airway code.

Returns:
the code

getSequence

public int getSequence()
Returns the sequence number, used to differentiate airways with different locations but the same code.

Returns:
the squence

getSize

public int getSize()
Returns the number of waypoints in the airway.

Specified by:
getSize in interface Route
Returns:
the number of waypoints

isLowLevel

public boolean isLowLevel()
Returns if this Airway is a low-level Airway.

Returns:
TRUE if a low-level airway, otherwise FALSE

isHighLevel

public boolean isHighLevel()
Returns if this Airway is a high-level Airway.

Returns:
TRUE if a high-level airway, otherwise FALSE

getWaypoints

public LinkedList<NavigationDataBean> getWaypoints()
Returns the waypoints for this Airway. The returned collection is mutable.

Specified by:
getWaypoints in interface Route
Returns:
an ordered Collection of waypoints
See Also:
getRoute(), addWaypoint(NavigationDataBean)

getLatitude

public double getLatitude()
Returns the latitude of the middle of the Airway.

Specified by:
getLatitude in interface GeoLocation
Returns:
the latitude in degrees

getLongitude

public double getLongitude()
Returns the longitude of the middle of the Airway.

Specified by:
getLongitude in interface GeoLocation
Returns:
the longitude in degrees

getWaypoints

public List<NavigationDataBean> getWaypoints(String start,
                                             String end)
Returns a subset of waypoints for this Airway between two waypoints.

Parameters:
start - the starting waypoint code
end - the ending waypoint code
Returns:
a List of waypoint codes
Throws:
NullPointerException - if start or end are null

getRoute

public String getRoute()
Returns the Airway route.

Specified by:
getRoute in interface Route
Returns:
a space-delimited list of waypoint codes

addWaypoint

public void addWaypoint(NavigationDataBean nd)
Adds a waypoint to the Airway route.

Specified by:
addWaypoint in interface Route
Parameters:
nd - the waypoint
See Also:
getWaypoints()

setCode

public void setCode(String code)
Updates the Airway code.

Parameters:
code - the code
Throws:
NullPointerException - if code is null

setLowLevel

public void setLowLevel(boolean isLow)
Marks this Airway as a low-level Airway.

Parameters:
isLow - TRUE if low-level, otherwise FALSE

setHighLevel

public void setHighLevel(boolean isHigh)
Marks this Airway as a high-level Airway.

Parameters:
isHigh - TRUE if high-level, otherwise FALSE

compareTo

public int compareTo(Airway a2)
Compares two airways by comparing their names and sequence numbers.

Specified by:
compareTo in interface Comparable<Airway>

equals

public boolean equals(Object o2)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Returns the airway code.

Overrides:
toString in class Object

cacheKey

public Object cacheKey()
Returns the cache key.

Specified by:
cacheKey in interface Cacheable
Returns:
the airway/route code


Copyright © 2004-2009 Global Virtual Airlines Group. All Rights Reserved.