grinda.impl.tuplespace
Class DynamicContainer

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

public class DynamicContainer
extends java.lang.Object
implements TupleContainer

A tuple container that dynamically choose the bset container to use


Constructor Summary
DynamicContainer(InternalTuple absoluteTemplate)
           
 
Method Summary
 void add(InternalTuple t)
          Adds an InternalTuple to the container
 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
protected  void readLock()
          Blocks reader if there are other writer active
protected  void readUnlock()
          removes the read lock
 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
 void writeLock()
          Blocks writer if there are readers or another writer active
 void writeUnlock()
          Removes the write lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicContainer

public DynamicContainer(InternalTuple absoluteTemplate)
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

writeLock

public void writeLock()
Blocks writer if there are readers or another writer active


writeUnlock

public void writeUnlock()
Removes the write lock


readLock

protected void readLock()
Blocks reader if there are other writer active


readUnlock

protected void readUnlock()
removes the read lock



Copyright © 2006 Sirio Capizzi. All Rights Reserved.