grinda.common
Class AssociativeMap

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

public class AssociativeMap
extends java.lang.Object

Map that uses the standard associative matching semantic to store objects. Keys of this map are template that are used to look up the associated object. 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
AssociativeMap()
           
 
Method Summary
 java.util.Set get(InternalTuple templ)
          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
 java.lang.Object remove(InternalTuple templ)
          Removes the oldest (first inserted) object associated with the given template
 boolean remove(InternalTuple templ, java.lang.Object value)
          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

AssociativeMap

public AssociativeMap()
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 templ)
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:
templ - a tuple used to the look up
Returns:
a Set containing the values found or null

remove

public java.lang.Object remove(InternalTuple templ)
Removes the oldest (first inserted) object associated with the given template

Parameters:
templ - the template to match
Returns:
the object removed

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

size

public int size()

isEmpty

public boolean isEmpty()


Copyright © 2006 Sirio Capizzi. All Rights Reserved.