org.deltava.beans.navdata
Class NavigationDataMap

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

public class NavigationDataMap
extends Object
implements Serializable, 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:
2.1
Author:
Luke
See Also:
Serialized Form

Constructor Summary
NavigationDataMap()
          Creates an empty NavigationDataMap bean.
NavigationDataMap(Collection<NavigationDataBean> entries)
          Creates a pre-populaed NavigationDataMap bean.
 
Method Summary
 void add(NavigationDataBean nd)
          Adds a navigation aid to the map.
 void addAll(Collection<NavigationDataBean> beans)
          Adds a number of navigation aids to the map.
 Object cacheKey()
          Returns this bean's cache key.
 boolean contains(String code)
          Returns if the Map contains at least one Navigation Data bean with a particular code.
 void filter(Collection<Integer> types)
          Filters out navigation aids based on their type.
 void filter(int navaidType)
          Filters out all navigation aids not of a particular type.
 NavigationDataBean get(String code)
          Returns a Navigation Aid with a given code.
 NavigationDataBean get(String code, GeoLocation loc)
          Returns a Navigation Aid with a given code.
 Collection<NavigationDataBean> getAll()
          Returns all navigation aid beans contained within this object.
 Set<NavigationDataBean> getEntries(String code)
          Returns all entries with a given code.
 boolean isEmpty()
          Returns whether the map is empty.
 void setCacheKey(Object key)
          Sets this bean's cache key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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

addAll

public void addAll(Collection<NavigationDataBean> beans)
Adds a number of navigation aids to the map.

Parameters:
beans - a Collection of NavigationDataBeans

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 Set<NavigationDataBean> getEntries(String code)
Returns all entries with a given code.

Parameters:
code - the navigation aid code
Returns:
a Set 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(String, GeoLocation)

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:
get(String)

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<Integer> types)
Filters out navigation aids based on their type.

Parameters:
types - a Collection of Integers with navigation aid type codes
See Also:
NavigationDataBean.getType(), filter(int)

filter

public void filter(int navaidType)
Filters out all navigation aids not of a particular type.

Parameters:
navaidType - the navigation aid type code to retain
See Also:
filter(Collection), NavigationDataBean.getType()

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()
Returns this bean's cache key.

Specified by:
cacheKey in interface Cacheable
Returns:
the cache key for the object


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