Class Airway

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

public class Airway extends Object implements Comparable<Airway>, 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:
11.0
Author:
Luke
See Also:
  • Field Details

  • Constructor Details

    • 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 Details

    • 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:
    • 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
    • find

      protected int find(String code)
      Finds a waypoint in this Airway.
      Parameters:
      code - the waypoint code
      Returns:
      the offset within the waypoints, or -1 if not found
    • contains

      public boolean contains(String code)
      Returns whether this Airway contains a particular waypoint.
      Parameters:
      code - the waypoint code
      Returns:
      TRUE if found, otherwise FALSE
    • 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:
    • 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)
      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()
      Overrides:
      toString in class Object
    • cacheKey

      public Object cacheKey()
      Description copied from interface: Cacheable
      Returns the cache key for this object. Caches call this method when adding the object.
      Specified by:
      cacheKey in interface Cacheable
      Returns:
      the cache key for the object