org.isam.exehda.services.cc
Class HashTreeSpace

java.lang.Object
  |
  +--org.isam.exehda.services.cc.HashTreeSpace

public class HashTreeSpace
extends java.lang.Object

This class implements a tuple space using a hash tree for the first hashlevel levels and then linked lists to store the tuples.

Version:
$Date: 2004/06/16 15:16:23 $ $Revision: 1.2 $
Author:
last modified by $Author: lucc $

Field Summary
(package private)  int hashlevel
          number of hashtree levels to be used
 
Constructor Summary
HashTreeSpace(int hashlevel, java.lang.String name)
          Builds a hash tree space that will be at most hashlevel height, above which linked lists will be used for leaf nodes;
 
Method Summary
 void put(CCManager.Tuple t)
          Inserts the given tuple into the space.
 CCManager.Tuple read(CCManager.Tuple pattern, long timeout)
          Gets a tuple that matches the given pattern from the tuple space.
 CCManager.Tuple take(CCManager.Tuple pattern, long timeout)
          Gets a tuple that matches the given pattern from the TupleSpace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashlevel

int hashlevel
number of hashtree levels to be used

Constructor Detail

HashTreeSpace

public HashTreeSpace(int hashlevel,
                     java.lang.String name)
Builds a hash tree space that will be at most hashlevel height, above which linked lists will be used for leaf nodes;

Parameters:
hashlevel - an int value
name - a String value
Method Detail

take

public CCManager.Tuple take(CCManager.Tuple pattern,
                            long timeout)
Gets a tuple that matches the given pattern from the TupleSpace. The returned tuple is removed from the object space. This call would block until a tuple that matches the given pattern becames available.

Parameters:
pattern - the pattern to which the returned tuple must adhere.
Returns:
a tuple that matches the given pattern.

read

public CCManager.Tuple read(CCManager.Tuple pattern,
                            long timeout)
Gets a tuple that matches the given pattern from the tuple space. A copy of the tuple is returned instead of removing the original tuple. If block is set to false and no such tuple is found, null is returned instead.

Parameters:
pattern - the pattern to which the returned tuple must adhere.
Returns:
a tuple that matches the given pattern or null if none is available and non-blocking operation mode was selected.

put

public void put(CCManager.Tuple t)
Inserts the given tuple into the space.

Parameters:
t - a Tuple value