grinda.common
Class ReverseAssociativeMap

java.lang.Object
  extended by grinda.common.ReverseAssociativeMap

public class ReverseAssociativeMap
extends java.lang.Object

This class allows to retrive objects whose keys are templates. The look up is done with an actual tuple and all templates (with associated objects) that match the tuples are retrieved.

Author:
Sirio Capizzi

Constructor Summary
ReverseAssociativeMap()
           
 
Method Summary
 java.util.Set get(InternalTuple t)
          Retrives all the key templates (with their bounded objects) matching with the given tuple.
 boolean isEmpty()
           
 void put(InternalTuple templ, java.lang.Object value)
          Puts a new key in the map with an associated value
 boolean remove(InternalTuple templ, java.lang.Object value)
          Removes the passed key-value pair
 boolean remove(java.util.Map.Entry v)
          Removes the passed key-value pair
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReverseAssociativeMap

public ReverseAssociativeMap()
Method Detail

put

public void put(InternalTuple templ,
                java.lang.Object value)
Puts a new key in the map with an associated value

Parameters:
templ - the template key
value - the value associated

get

public java.util.Set get(InternalTuple t)
Retrives all the key templates (with their bounded objects) matching with the given tuple. The HashSet returned contains Map.Entry instances with the template and its value

Parameters:
t - a tuple used to the look up
Returns:
a Set containing the values found or null

remove

public boolean remove(InternalTuple templ,
                      java.lang.Object value)
Removes the passed key-value pair

Parameters:
templ - the template to match
value - the associated value
Returns:
true if the pair was removed

remove

public boolean remove(java.util.Map.Entry v)
Removes the passed key-value pair

Parameters:
v - the value to remove
Returns:
true if the pair was removed

size

public int size()

isEmpty

public boolean isEmpty()


Copyright © 2006 Sirio Capizzi. All Rights Reserved.