grinda.impl.tuplespace
Class HashContainer

java.lang.Object
  extended by grinda.impl.tuplespace.HashContainer
All Implemented Interfaces:
TupleContainer

public class HashContainer
extends java.lang.Object
implements TupleContainer

A tuple container implementd with an Hashtables

Author:
Sirio Capizzi

Constructor Summary
HashContainer(InternalTuple absoluteTemplate)
          Creates a new HashContainer that will store tuples with the given absolute template
 
Method Summary
 void add(InternalTuple t)
          Adds an InternalTuple to the container
 InternalTuple getAbsoluteTemplate()
           
 boolean isEmpty()
          Checks if the container is empty
 InternalTuple lookup(InternalTuple pattern)
          Looks up a tuples that match the given template using the associative matching
 InternalTuple[] lookupAll(InternalTuple pattern)
          Looks up all the tuples that match the given template using the associative matching
 InternalTuple remove(InternalTuple pattern)
          Removes a the tuple that match the given template using the associative matching
 InternalTuple[] removeAll(InternalTuple pattern)
          Removes all the tuples that match the given template using the associative matching
 int size()
          Gets the number of tuple stored
 java.util.Collection tuples()
          Gets a collection of all the tuple stored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashContainer

public HashContainer(InternalTuple absoluteTemplate)
Creates a new HashContainer that will store tuples with the given absolute template

Parameters:
absoluteTemplate - the template
Method Detail

add

public void add(InternalTuple t)
Adds an InternalTuple to the container

Specified by:
add in interface TupleContainer
Parameters:
t - the tuple

lookupAll

public InternalTuple[] lookupAll(InternalTuple pattern)
Looks up all the tuples that match the given template using the associative matching

Specified by:
lookupAll in interface TupleContainer
Parameters:
pattern - the template
Returns:
the matching tuples or null if there are nones

lookup

public InternalTuple lookup(InternalTuple pattern)
Looks up a tuples that match the given template using the associative matching

Specified by:
lookup in interface TupleContainer
Parameters:
pattern - the template
Returns:
a tuples found or null if there is none

remove

public InternalTuple remove(InternalTuple pattern)
Removes a the tuple that match the given template using the associative matching

Specified by:
remove in interface TupleContainer
Parameters:
pattern - the template
Returns:
the tuple removed or null if there are none

removeAll

public InternalTuple[] removeAll(InternalTuple pattern)
Removes all the tuples that match the given template using the associative matching

Specified by:
removeAll in interface TupleContainer
Parameters:
pattern - the template
Returns:
the tuples removed or null if there are nones

size

public int size()
Gets the number of tuple stored

Specified by:
size in interface TupleContainer
Returns:
the size

isEmpty

public boolean isEmpty()
Checks if the container is empty

Specified by:
isEmpty in interface TupleContainer
Returns:
true if it is empty false otherwise

tuples

public java.util.Collection tuples()
Gets a collection of all the tuple stored

Specified by:
tuples in interface TupleContainer
Returns:
tuples

getAbsoluteTemplate

public InternalTuple getAbsoluteTemplate()


Copyright © 2006 Sirio Capizzi. All Rights Reserved.