mro.util
Class DoubleHashMap

java.lang.Object
  extended by mro.util.DoubleHashMap

public class DoubleHashMap
extends java.lang.Object

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

Version:
061219
Author:
Magnus Rosell

Constructor Summary
DoubleHashMap()
           
 
Method Summary
 java.lang.Object get(java.lang.Object first, java.lang.Object second)
          Returns the Object that was indexed with "first" and "second".
 java.util.Set keySetOfSecondIndexForElementInFirst(java.lang.Object first)
           
 void put(java.lang.Object first, java.lang.Object second, java.lang.Object value)
          Adds a Object "value" indexed with the Object:s "first" and "second"
 java.lang.Object remove(java.lang.Object first, java.lang.Object second)
          Removes the Object with the indexes.
 void removeAllFirst(java.lang.Object first)
          Removes all Objects with the specified "first" index.
 void removeAllSecond(java.lang.Object second)
          Removes all Objects with the specified "second" index.
 int size()
           
 int sizeOfFirstIndex()
           
 int sizeOfSecondIndex()
           
 int sizeOfSecondIndexForElementInFirst(java.lang.Object first)
           
 java.util.Vector values()
          Returns all Objects in the DoubleHashMap as a Vector.
 java.util.Vector valuesForFirstIndex(java.lang.Object first)
          Returns a HashSet of those value Objects that are stored with the specified "first" index.
 java.util.Vector valuesForSecondIndex(java.lang.Object second)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleHashMap

public DoubleHashMap()
Method Detail

put

public void put(java.lang.Object first,
                java.lang.Object second,
                java.lang.Object value)
Adds a Object "value" indexed with the Object:s "first" and "second"

Parameters:
first -
second -
value -

get

public java.lang.Object get(java.lang.Object first,
                            java.lang.Object second)
Returns the Object that was indexed with "first" and "second".

Parameters:
first -
second -
Returns:
an Object

remove

public java.lang.Object remove(java.lang.Object first,
                               java.lang.Object second)
Removes the Object with the indexes.

Parameters:
first -
second -
Returns:
an Object

removeAllFirst

public void removeAllFirst(java.lang.Object first)
Removes all Objects with the specified "first" index.

Parameters:
first -

removeAllSecond

public void removeAllSecond(java.lang.Object second)
Removes all Objects with the specified "second" index.

Parameters:
second -

values

public java.util.Vector values()
Returns all Objects in the DoubleHashMap as a Vector.

Returns:
a Vector

valuesForFirstIndex

public java.util.Vector valuesForFirstIndex(java.lang.Object first)
Returns a HashSet of those value Objects that are stored with the specified "first" index.
This is the optimal method. Much faster than #valuesForSecondIndex().

Parameters:
first -
Returns:
a Vector

valuesForSecondIndex

public java.util.Vector valuesForSecondIndex(java.lang.Object second)

size

public int size()

sizeOfFirstIndex

public int sizeOfFirstIndex()

sizeOfSecondIndex

public int sizeOfSecondIndex()

sizeOfSecondIndexForElementInFirst

public int sizeOfSecondIndexForElementInFirst(java.lang.Object first)

keySetOfSecondIndexForElementInFirst

public java.util.Set keySetOfSecondIndexForElementInFirst(java.lang.Object first)