org.gcube.vremanagement.resourcemanager.impl.resources.types
Class MultiKeysMap<K1,K2,V>

java.lang.Object
  extended by org.gcube.vremanagement.resourcemanager.impl.resources.types.MultiKeysMap<K1,K2,V>
All Implemented Interfaces:
Iterable<V>

public class MultiKeysMap<K1,K2,V>
extends Object
implements Iterable<V>

A thread-safe Map with multiple keys allowing multiple values per key

Author:
Manuele Simi (ISTI-CNR)

Constructor Summary
MultiKeysMap()
           
 
Method Summary
 void clean()
          Removes all mapping from this maps
 Set<V> getValuesByPrimaryKey(K1 key)
          Returns the values to which this map maps the specified primary key
 Set<V> getValuesBySecondaryKey(K2 key)
          Returns the values to which this map maps the specified primary key
 Iterator<V> iterator()
          
 Set<K1> primaryKeySet()
          Returns a set view of the primary keys contained in this map
 void put(K1 key1, K2 key2, V value)
          Associates the specified value with the two keys
 void removeValue(V value)
          removes the given values and its keys from the map
 void removeValuesByPrimaryKey(K1 key)
          Removes all the values associated to the primary key
 void removeValuesBySecondaryKey(K2 key)
          Removes all the values associated to the secondary key
 Set<K2> secondaryKeySet()
          Returns a set view of the secondary keys contained in this map
 Collection<V> 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, toString, wait, wait, wait
 

Constructor Detail

MultiKeysMap

public MultiKeysMap()
Method Detail

iterator

public Iterator<V> iterator()

Specified by:
iterator in interface Iterable<V>

put

public void put(K1 key1,
                K2 key2,
                V value)
Associates the specified value with the two keys

Parameters:
key1 - the value's primary key
key2 - the value's secondary key
value - the value

removeValue

public void removeValue(V value)
removes the given values and its keys from the map

Parameters:
value -

removeValuesByPrimaryKey

public void removeValuesByPrimaryKey(K1 key)
Removes all the values associated to the primary key

Parameters:
key - the key of type K1

removeValuesBySecondaryKey

public void removeValuesBySecondaryKey(K2 key)
Removes all the values associated to the secondary key

Parameters:
key - the key of type K2

getValuesByPrimaryKey

public Set<V> getValuesByPrimaryKey(K1 key)
Returns the values to which this map maps the specified primary key

Parameters:
key - key whose associated values are to be returned
Returns:
the values to which this map maps the specified primary key

getValuesBySecondaryKey

public Set<V> getValuesBySecondaryKey(K2 key)
Returns the values to which this map maps the specified primary key

Parameters:
key - key whose associated values are to be returned
Returns:
@return the values to which this map maps the specified secondary key

primaryKeySet

public Set<K1> primaryKeySet()
Returns a set view of the primary keys contained in this map

Returns:
a set view of the primary keys contained in this map

secondaryKeySet

public Set<K2> secondaryKeySet()
Returns a set view of the secondary keys contained in this map

Returns:
a set view of the secondary keys contained in this map

values

public Collection<V> values()
Returns a collection view of the values contained in this map

Returns:
a collection view of the values contained in this map

clean

public void clean()
Removes all mapping from this maps



Copyright © 2013. All Rights Reserved.