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

## mro.util.doublehashmap
Class GenericDoubleHashMap<F,S,V>

    java.lang.Object
      mro.util.doublehashmap.GenericDoubleHashMap<F,S,V>

Direct Known Subclasses:
  GenericOrderedDoubleHashMap

    public class GenericDoubleHashMap<F,S,V>

extends java.lang.Object

A DoubleHashMap has two indexes. There is only one copy of each index value.

Field Summary
`private java.lang.Class<F>` | `fClass`
`protected java.util.HashSet<F>` | `firstIndexSet`
`protected java.util.HashMap<F,java.util.HashMap<S,V>>` | `firstMap`
`private java.lang.Class<S>` | `sClass`
`protected java.util.HashSet<S>` | `secondIndexSet`
`protected java.util.HashMap<S,java.util.HashMap<F,V>>` | `secondMap`
`protected int` | `size`
`private java.lang.Class<V>` | `vClass`

Constructor Summary
`GenericDoubleHashMap()` Constructor.
`GenericDoubleHashMap(java.lang.Class<F> fClass, java.lang.Class<S> sClass, java.lang.Class<V> vClass)` Constructor.
`GenericDoubleHashMap(GenericDoubleHashMap<F,S,V> map)`

Method Summary
`V` | `get(F first, S second)` Returns the Object that was indexed with "first" and "second".
`GenericDoubleHashMap<S,F,V>` | `invert()` Inverts the mapping, so the fist index becomes the second.
`java.util.Set<S>` | `keySetOfSecondIndexForElementInFirst(F first)`
`void` | `put(F first, S second, V value)` Adds a Object "value" indexed with the Object:s "first" and "second"
`protected void` | `putIntoFirstMap(F o1, S o2, V value, java.util.HashMap<F,java.util.HashMap<S,V>> map)` Convenience method, for putting objects into a HashMap of HashMap:s.
`protected void` | `putIntoSecondMap(S o1, F o2, V value, java.util.HashMap<S,java.util.HashMap<F,V>> map)` Convenience method, for putting objects into a HashMap of HashMap:s.
`V` | `remove(F first, S second)` Removes the Object with the indexes.
`void` | `removeAllFirst(F first)` Removes all Objects with the specified "first" index.
`void` | `removeAllSecond(S second)` Removes all Objects with the specified "second" index.
`private V` | `removeFromFirstMap(F o1, S o2, java.util.HashMap<F,java.util.HashMap<S,V>> map)` Convenience method, for removing objects in a HashMap of HashMap:s.
`private V` | `removeFromSecondMap(S o1, F o2, java.util.HashMap<S,java.util.HashMap<F,V>> map)` Convenience method, for removing objects in a HashMap of HashMap:s.
`int` | `size()`
`int` | `sizeOfFirstIndex()`
`int` | `sizeOfSecondIndex()`
`int` | `sizeOfSecondIndexForElementInFirst(F first)`
`java.util.Vector<V>` | `values()` Returns all Objects in the DoubleHashMap as a Vector.
`java.util.Vector<V>` | `valuesForFirstIndex(F first)` Returns a Vector of those value Objects that are stored with the specified "first" index.
`java.util.Vector<V>` | `valuesForSecondIndex(S second)` Returns a Vector of those value Objects that are stored with the specified "second" index.

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

Field Detail

### firstIndexSet

    protected java.util.HashSet<F> firstIndexSet

### secondIndexSet

    protected java.util.HashSet<S> secondIndexSet

### firstMap

    protected java.util.HashMap<F,java.util.HashMap<S,V>> firstMap

### secondMap

    protected java.util.HashMap<S,java.util.HashMap<F,V>> secondMap

### size

    protected int size

### fClass

    private java.lang.Class<F> fClass

### sClass

    private java.lang.Class<S> sClass

### vClass

    private java.lang.Class<V> vClass

Constructor Detail

### GenericDoubleHashMap

    public GenericDoubleHashMap()

  Constructor.

### GenericDoubleHashMap

    public GenericDoubleHashMap(java.lang.Class<F> fClass,
                                java.lang.Class<S> sClass,
                                java.lang.Class<V> vClass)

  Constructor. Use this when the first and second index has the same class as in these cases the invert()-method becomes faster.

### GenericDoubleHashMap

    public GenericDoubleHashMap(GenericDoubleHashMap<F,S,V> map)

Method Detail

### put

    public void put(F first,
                    S second,
                    V value)

  Adds a Object "value" indexed with the Object:s "first" and "second"

  Parameters:
    `first` -
    `second` -
    `value` -

### putIntoFirstMap

    protected void putIntoFirstMap(F o1,
                                   S o2,
                                   V value,
                                   java.util.HashMap<F,java.util.HashMap<S,V>> map)

  Convenience method, for putting objects into a HashMap of HashMap:s.

### putIntoSecondMap

    protected void putIntoSecondMap(S o1,
                                    F o2,
                                    V value,
                                    java.util.HashMap<S,java.util.HashMap<F,V>> map)

  Convenience method, for putting objects into a HashMap of HashMap:s.

### get

    public V get(F first,
                 S second)

  Returns the Object that was indexed with "first" and "second".

  Parameters:
    `first` -
    `second` -
  Returns:
    an Object

### remove

    public V remove(F first,
                    S second)

  Removes the Object with the indexes.

  Parameters:
    `first` -
    `second` -
  Returns:
    an Object

### removeFromFirstMap

    private V removeFromFirstMap(F o1,
                                 S o2,
                                 java.util.HashMap<F,java.util.HashMap<S,V>> map)

  Convenience method, for removing objects in a HashMap of HashMap:s.

### removeFromSecondMap

    private V removeFromSecondMap(S o1,
                                  F o2,
                                  java.util.HashMap<S,java.util.HashMap<F,V>> map)

  Convenience method, for removing objects in a HashMap of HashMap:s.

### removeAllFirst

    public void removeAllFirst(F first)

  Removes all Objects with the specified "first" index.

  Parameters:
    `first` -

### removeAllSecond

    public void removeAllSecond(S second)

  Removes all Objects with the specified "second" index.

  Parameters:
    `second` -

### values

    public java.util.Vector<V> values()

  Returns all Objects in the DoubleHashMap as a Vector.

  Returns:
    a Vector

### valuesForFirstIndex

    public java.util.Vector<V> valuesForFirstIndex(F first)

  Returns a Vector of those value Objects that are stored with the specified "first" index.

  Parameters:
    `first` -
  Returns:
    a Vector

### valuesForSecondIndex

    public java.util.Vector<V> valuesForSecondIndex(S second)

  Returns a Vector of those value Objects that are stored with the specified "second" index.

  Parameters:
    `second` -
  Returns:
    a Vector

### invert

    public GenericDoubleHashMap<S,F,V> invert()

  Inverts the mapping, so the fist index becomes the second. Makes a copy!

### size

    public int size()

### sizeOfFirstIndex

    public int sizeOfFirstIndex()

### sizeOfSecondIndex

    public int sizeOfSecondIndex()

### sizeOfSecondIndexForElementInFirst

    public int sizeOfSecondIndexForElementInFirst(F first)

### keySetOfSecondIndexForElementInFirst

    public java.util.Set<S> keySetOfSecondIndexForElementInFirst(F first)

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