Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.osm
Class YAACEnumMap

    java.lang.Object
      org.ka2ddo.yaac.osm.YAACEnumMap

All Implemented Interfaces:
  java.lang.Iterable<OSMLayerEnum>, java.util.Iterator<OSMLayerEnum>, java.util.Map<OSMLayerEnum,java.lang.Object>

    public final class YAACEnumMap

extends java.lang.Object
implements java.util.Map<OSMLayerEnum,java.lang.Object>, java.lang.Iterable<OSMLayerEnum>, java.util.Iterator<OSMLayerEnum>

This class implements a fast access map keyed by the values of a particular enumeration.

Constructor Summary
`YAACEnumMap()` Create an empty YAACEnumMap for the specified key enumeration.
`YAACEnumMap(YAACEnumMap m)` Create a YAACEnumMap that is a deep copy of another YAACEnumMap.

Method Summary
`void` | `clear()` Removes all of the mappings from this map.
`boolean` | `containsKey(java.lang.Object key)` Returns `true` if this map contains a mapping for the specified key.
`boolean` | `containsKey(OSMLayerEnum key)` Returns `true` if this map contains a mapping for the specified key.
`boolean` | `containsValue(java.lang.Object value)` Returns `true` if this map maps one or more keys to the specified value.
`java.util.Set<java.util.Map.Entry<OSMLayerEnum,java.lang.Object>>` | `entrySet()` Returns a `Set` view of the mappings contained in this map.
`java.lang.Object` | `get(java.lang.Object key)` Returns the value to which the specified key is mapped, or `null` if this map contains no mapping for the key.
`java.lang.Object` | `get(OSMLayerEnum key)` Returns the value to which the specified key is mapped, or `null` if this map contains no mapping for the key.
`boolean` | `hasNext()` Returns `true` if the YAACEnumMap has more elements.
`boolean` | `isEmpty()` Returns `true` if this map contains no key-value mappings.
`java.util.Iterator<OSMLayerEnum>` | `iterator()` Returns an iterator over a set of elements of type K.
`void` | `justPut(OSMLayerEnum key, java.lang.Object value)` Associates the specified value with the specified key in this map (optional operation).
`void` | `justRemove(OSMLayerEnum key)` Removes the mapping for a key from this map if it is present (optional operation).
`java.util.Set<OSMLayerEnum>` | `keySet()` Returns a `Set` view of the keys contained in this map.
`OSMLayerEnum` | `next()` Returns the next element in the iteration.
`java.lang.Object` | `put(OSMLayerEnum key, java.lang.Object value)` Associates the specified value with the specified key in this map (optional operation).
`void` | `putAll(java.util.Map<? extends OSMLayerEnum,?> m)` Copies all of the mappings from the specified map to this map (optional operation).
`void` | `remove()` Removes from the underlying collection the last element returned by the iterator (optional operation).
`java.lang.Object` | `remove(java.lang.Object key)` Removes the mapping for a key from this map if it is present (optional operation).
`int` | `size()` Returns the number of key-value mappings in this map.
`java.lang.String` | `toString()` Returns a string representation of this map.
`java.util.Collection` | `values()` Returns a `Collection` view of the values contained in this map.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Constructor Detail

### YAACEnumMap

    public YAACEnumMap()

  Create an empty YAACEnumMap for the specified key enumeration.

### YAACEnumMap

    public YAACEnumMap(YAACEnumMap m)

  Create a YAACEnumMap that is a deep copy of another YAACEnumMap.

  Parameters:
    `m` - YAACEnumMap to clone

Method Detail

### size

    public int size()

  Returns the number of key-value mappings in this map.

  Specified by:
    `size` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Returns:
    the number of key-value mappings in this map

### isEmpty

    public boolean isEmpty()

  Returns `true` if this map contains no key-value mappings.

  Specified by:
    `isEmpty` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Returns:
    `true` if this map contains no key-value mappings

### containsKey

    public boolean containsKey(java.lang.Object key)

  Returns `true` if this map contains a mapping for the specified key. More formally, returns `true` if and only if this map contains a mapping for a key `k` such that `(key==null ? k==null : key.equals(k))`. (There can be at most one such mapping.)

  Specified by:
    `containsKey` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Parameters:
    `key` - key whose presence in this map is to be tested
  Returns:
    `true` if this map contains a mapping for the specified key
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map (optional)
    `java.lang.NullPointerException` - if the specified key is null and this map does not permit null keys (optional)

### containsKey

    public boolean containsKey(OSMLayerEnum key)

  Returns `true` if this map contains a mapping for the specified key. More formally, returns `true` if and only if this map contains a mapping for a key `k` such that `(key==null ? k==null : key.equals(k))`. (There can be at most one such mapping.)

  Parameters:
    `key` - key whose presence in this map is to be tested
  Returns:
    `true` if this map contains a mapping for the specified key
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map (optional)
    `java.lang.NullPointerException` - if the specified key is null and this map does not permit null keys (optional)

### containsValue

    public boolean containsValue(java.lang.Object value)

  Returns `true` if this map maps one or more keys to the specified value. More formally, returns `true` if and only if this map contains at least one mapping to a value `v` such that `(value==null ? v==null : value.equals(v))`. This operation will probably require time linear in the map size for most implementations of the `Map` interface.

  Specified by:
    `containsValue` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Parameters:
    `value` - value whose presence in this map is to be tested
  Returns:
    `true` if this map maps one or more keys to the specified value
  Throws:
    `java.lang.ClassCastException` - if the value is of an inappropriate type for this map (optional)
    `java.lang.NullPointerException` - if the specified value is null and this map does not permit null values (optional)

### get

    public java.lang.Object get(java.lang.Object key)

  Returns the value to which the specified key is mapped, or `null` if this map contains no mapping for the key.

  More formally, if this map contains a mapping from a key `k` to a value `v` such that `(key==null ? k==null : key.equals(k))`, then this method returns `v`; otherwise it returns `null`. (There can be at most one such mapping.)

  If this map permits null values, then a return value of `null` does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to `null`. The `containsKey` operation may be used to distinguish these two cases.

  Specified by:
    `get` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Parameters:
    `key` - the key whose associated value is to be returned
  Returns:
    the value to which the specified key is mapped, or `null` if this map contains no mapping for the key
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map (optional)
    `java.lang.NullPointerException` - if the specified key is null and this map does not permit null keys

### get

    public java.lang.Object get(OSMLayerEnum key)

  Returns the value to which the specified key is mapped, or `null` if this map contains no mapping for the key.

  More formally, if this map contains a mapping from a key `k` to a value `v` such that `(key==null ? k==null : key.equals(k))`, then this method returns `v`; otherwise it returns `null`. (There can be at most one such mapping.)

  If this map permits null values, then a return value of `null` does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to `null`. The `containsKey` operation may be used to distinguish these two cases.

  Parameters:
    `key` - the key whose associated value is to be returned
  Returns:
    the value to which the specified key is mapped, or `null` if this map contains no mapping for the key
  Throws:
    `java.lang.NullPointerException` - if the specified key is null and this map does not permit null keys

### put

    public java.lang.Object put(OSMLayerEnum key,
                                java.lang.Object value)

  Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map `m` is said to contain a mapping for a key `k` if and only if `m.containsKey(k)` would return `true`.)

  Specified by:
    `put` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Parameters:
    `key` - key with which the specified value is to be associated
    `value` - value to be associated with the specified key
  Returns:
    the previous value associated with `key`, or `null` if there was no mapping for `key`.
  Throws:
    `java.lang.NullPointerException` - if the specified key or value is null and this map does not permit null keys or values

### justPut

    public final void justPut(OSMLayerEnum key,
                              java.lang.Object value)

  Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map `m` is said to contain a mapping for a key `k` if and only if `m.containsKey(k)` would return `true`.)

  Parameters:
    `key` - key with which the specified value is to be associated
    `value` - value to be associated with the specified key
  Throws:
    `java.lang.NullPointerException` - if the specified key is null (this map does not permit null keys or values)

### remove

    public java.lang.Object remove(java.lang.Object key)

  Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key `k` to value `v` such that `(key==null ? k==null : key.equals(k))`, that mapping is removed. (The map can contain at most one such mapping.)

  Returns the value to which this map previously associated the key, or `null` if the map contained no mapping for the key.

  The map will not contain a mapping for the specified key once the call returns.

  Specified by:
    `remove` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Parameters:
    `key` - key whose mapping is to be removed from the map
  Returns:
    the previous value associated with `key`, or `null` if there was no mapping for `key`.
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map
    `java.lang.NullPointerException` - if the specified key is null and this map does not permit null keys

### justRemove

    public void justRemove(OSMLayerEnum key)

  Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key `k` to value `v` such that `(key==null ? k==null : key.equals(k))`, that mapping is removed. (The map can contain at most one such mapping.)

  The map will not contain a mapping for the specified key once the call returns.

  Parameters:
    `key` - key whose mapping is to be removed from the map
  Throws:
    `java.lang.NullPointerException` - if the specified key is null and this map does not permit null keys (optional)

### putAll

    public void putAll(java.util.Map<? extends OSMLayerEnum,?> m)

  Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling `put(k, v)` on this map once for each mapping from key `k` to value `v` in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

  Specified by:
    `putAll` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Parameters:
    `m` - mappings to be stored in this map
  Throws:
    `java.lang.ClassCastException` - if the class of a key or value in the specified map prevents it from being stored in this map
    `java.lang.NullPointerException` - if the specified map is null, or if this map does not permit null keys or values, and the specified map contains null keys or values
    `java.lang.IllegalArgumentException` - if some property of a key or value in the specified map prevents it from being stored in this map

### clear

    public void clear()

  Removes all of the mappings from this map. The map will be empty after this call returns.

  Specified by:
    `clear` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`

### keySet

    public java.util.Set<OSMLayerEnum> keySet()

  Returns a `Set` view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll`, and `clear` operations. It does not support the `add` or `addAll` operations.

  Specified by:
    `keySet` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Returns:
    a set view of the keys contained in this map

### values

    public java.util.Collection values()

  Returns a `Collection` view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the `Iterator.remove`, `Collection.remove`, `removeAll`, `retainAll` and `clear` operations. It does not support the `add` or `addAll` operations.

  Specified by:
    `values` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Returns:
    a collection view of the values contained in this map

### entrySet

    public java.util.Set<java.util.Map.Entry<OSMLayerEnum,java.lang.Object>> entrySet()

  Returns a `Set` view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation, or through the `setValue` operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll` and `clear` operations. It does not support the `add` or `addAll` operations.

  Specified by:
    `entrySet` in interface `java.util.Map<OSMLayerEnum,java.lang.Object>`
  Returns:
    a set view of the mappings contained in this map

### toString

    public java.lang.String toString()

  Returns a string representation of this map. The string representation consists of a list of key-value mappings in the order returned by the map's `entrySet` view's iterator, enclosed in braces (`"{}"`). Adjacent mappings are separated by the characters `", "` (comma and space). Each key-value mapping is rendered as the key followed by an equals sign (`"="`) followed by the associated value. Keys and values are converted to strings as by `String.valueOf(Object)`.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of this map

### iterator

    public java.util.Iterator<OSMLayerEnum> iterator()

  Returns an iterator over a set of elements of type K. Note this iterator is not thread-safe, as it stores the current position in the tracked object, not in a separate Iterator object.

  Specified by:
    `iterator` in interface `java.lang.Iterable<OSMLayerEnum>`
  Returns:
    an Iterator.

### hasNext

    public boolean hasNext()

  Returns `true` if the YAACEnumMap has more elements. (In other words, returns `true` if `next` would return an element rather than throwing an exception.)

  Specified by:
    `hasNext` in interface `java.util.Iterator<OSMLayerEnum>`
  Returns:
    `true` if the iterator has more elements.

### next

    public OSMLayerEnum next()

  Returns the next element in the iteration.

  Specified by:
    `next` in interface `java.util.Iterator<OSMLayerEnum>`
  Returns:
    the next element in the iteration.
  Throws:
    `java.util.NoSuchElementException` - iteration has no more elements.

### remove

    public void remove()

  Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to `next`. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.

  Specified by:
    `remove` in interface `java.util.Iterator<OSMLayerEnum>`
  Throws:
    `java.lang.IllegalStateException` - if the `next` method has not yet been called, or the `remove` method has already been called after the last call to the `next` method.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD