Class NavigationDataMap

java.lang.Object
org.deltava.beans.navdata.NavigationDataMap
All Implemented Interfaces:
Serializable, Cacheable

public class NavigationDataMap extends Object implements Cacheable
A "map-like" class to support multiple navigation data objects with the same code, and return back a single bean based on distance from an arbitrary point.
Since:
1.0
Version:
11.1
Author:
Luke
See Also:
  • Constructor Details

    • NavigationDataMap

      public NavigationDataMap()
      Creates an empty NavigationDataMap bean.
    • NavigationDataMap

      public NavigationDataMap(Collection<NavigationDataBean> entries)
      Creates a pre-populaed NavigationDataMap bean.
      Parameters:
      entries - the navigation aid beans to add
  • Method Details

    • add

      public void add(NavigationDataBean nd)
      Adds a navigation aid to the map.
      Parameters:
      nd - the navigation aid bean
      Throws:
      NullPointerException - if nd is null
    • contains

      public boolean contains(String code)
      Returns if the Map contains at least one Navigation Data bean with a particular code.
      Parameters:
      code - the code
      Returns:
      TRUE if at least one bean with this code is contained within the map, otherwise FALSE
    • getEntries

      public SortedSet<NavigationDataBean> getEntries(String code)
      Returns all entries with a given code.
      Parameters:
      code - the navigation aid code
      Returns:
      a SortedSet of entries, which may be empty
    • get

      public NavigationDataBean get(String code)
      Returns a Navigation Aid with a given code. If more than one navigation aid exists with this code, then the first NavigationDataBean (using the class' native sorting) is returned.
      Parameters:
      code - the navigation aid code
      Returns:
      a NavigationDataBean, or null if not found
      See Also:
    • get

      public NavigationDataBean get(String code, GeoLocation loc)
      Returns a Navigation Aid with a given code. If more than one navigation aid exists with this code, then the closes navigation aid to the specified fixed point is returned.
      Parameters:
      code - the navigation aid code
      loc - the reference location
      Returns:
      a NavigationDataBean, or null if not found
      See Also:
    • getAll

      public Collection<NavigationDataBean> getAll()
      Returns all navigation aid beans contained within this object.
      Returns:
      a Collection of NavigationDataBeans
    • isEmpty

      public boolean isEmpty()
      Returns whether the map is empty.
      Returns:
      TRUE if the object is empty, otherwise FALSE
    • filter

      public void filter(Collection<Navaid> types)
      Filters out navigation aids based on their type.
      Parameters:
      types - a Collection of Integers with navigation aid type codes
      See Also:
    • setCacheKey

      public void setCacheKey(Object key)
      Sets this bean's cache key. This is typically the query object used to generate this map.
      Parameters:
      key - the cache key
    • 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