skrueger.geotools
Class AttributeMetadataMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<Name,AttributeMetadata>
          extended by skrueger.geotools.AttributeMetadataMap
All Implemented Interfaces:
Serializable, Cloneable, Map<Name,AttributeMetadata>, NavigableMap<Name,AttributeMetadata>, SortedMap<Name,AttributeMetadata>, Copyable<AttributeMetadataMap>

public class AttributeMetadataMap
extends TreeMap<Name,AttributeMetadata>
implements Copyable<AttributeMetadataMap>

The AttributeMetadataMap is a Map holding AttributeMetadata object for Name keys. It's an extension of a TreeMap. It's copyable in the sense of the Copyable interface.
The get(Name) and #get(String) methods will never return null, but rather create a default AttributeMetadata on-the-fly.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
AttributeMetadataMap()
           
AttributeMetadataMap(List<String> defLanguages)
          Creates an AttributeMetadataMap and sets the list of default languages.
AttributeMetadataMap(String[] strings)
          Creates an AttributeMetadataMap and sets the list of default languages.
 
Method Summary
 AttributeMetadataMap copy()
          Returns a deep-copy.
 AttributeMetadataMap copyTo(AttributeMetadataMap amdMap)
          Copies all its values to another AttributeMetadataMap.
 AttributeMetadata get(Name name)
          Returns the AttributeMetadata for a given Name.
 List<String> getLanguages()
           
 double getQuality(List<String> languages)
           
 List<AttributeMetadata> sortedValues()
           
 List<AttributeMetadata> sortedValuesVisibleOnly()
           
 
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, size, subMap, subMap, tailMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

AttributeMetadataMap

public AttributeMetadataMap()

AttributeMetadataMap

public AttributeMetadataMap(List<String> defLanguages)
Creates an AttributeMetadataMap and sets the list of default languages.


AttributeMetadataMap

public AttributeMetadataMap(String[] strings)
Creates an AttributeMetadataMap and sets the list of default languages.

Method Detail

copy

public AttributeMetadataMap copy()
Returns a deep-copy. @see Copyable interface

Specified by:
copy in interface Copyable<AttributeMetadataMap>

copyTo

public AttributeMetadataMap copyTo(AttributeMetadataMap amdMap)
Copies all its values to another AttributeMetadataMap. @see Copyable interface.

Specified by:
copyTo in interface Copyable<AttributeMetadataMap>

get

public AttributeMetadata get(Name name)
Returns the AttributeMetadata for a given Name. Never returns null, but rather creates a default AttributeMetadata on the fly.

Specified by:
get in interface Map<Name,AttributeMetadata>
Overrides:
get in class TreeMap<Name,AttributeMetadata>

getLanguages

public List<String> getLanguages()

getQuality

public double getQuality(List<String> languages)
Returns:
a number between 0. (bad) and 1. (good) that is calculated from the amount of translation available in the visible attributes

sortedValues

public List<AttributeMetadata> sortedValues()
Returns:
List of AttributeMetadata objects ordered by their weight. (heavier => further down)

sortedValuesVisibleOnly

public List<AttributeMetadata> sortedValuesVisibleOnly()
Returns:
List of only the visible AttributeMetadata objects ordered by their weight. (heavier => further down)