org.drools.reteoo
Class TupleSet

java.lang.Object
  extended byorg.drools.reteoo.TupleSet
All Implemented Interfaces:
Serializable

class TupleSet
extends Object
implements Serializable

A set of Tuples indexed by TupleKeys.

Author:
bob mcwhirter

Constructor Summary
(package private) TupleSet()
          Construct.
(package private) TupleSet(int initialCapacity, float loadFactor)
          Construct.
(package private) TupleSet(ReteTuple tuple)
          Construct with a single tuple.
 
Method Summary
 void addTuple(ReteTuple tuple)
          Add a single Tuple to this set.
 ReteTuple getTuple(TupleKey key)
          Retrieve a Tuple by TupleKey.
 Collection getTuples()
          Retrieve all Tuples.
 boolean isEmpty()
          Return empty status
 Iterator iterator()
          Retrieve an iterator over the tuples.
 boolean removeAllTuples(TupleKey key)
          Retract tuples from this memory.
 void removeTuple(TupleKey key)
          Remove a tuple from this set.
 int size()
          Retrieve the size (number of tuples) in this set.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TupleSet

TupleSet()
Construct.


TupleSet

TupleSet(int initialCapacity,
         float loadFactor)
Construct.

Parameters:
initialCapacity - The initial capacity of the set.
loadFactor - The load factor of the set.

TupleSet

TupleSet(ReteTuple tuple)
Construct with a single tuple.

Parameters:
tuple - The tuple.
Method Detail

size

public int size()
Retrieve the size (number of tuples) in this set.

Returns:
The size of this set.

isEmpty

public boolean isEmpty()
Return empty status

Returns:
The size of this set.

addTuple

public void addTuple(ReteTuple tuple)
Add a single Tuple to this set.

Parameters:
tuple - The tuple.

removeAllTuples

public boolean removeAllTuples(TupleKey key)
Retract tuples from this memory.

Parameters:
key - The key for the tuples to be removed.
Returns:
true if at least one tuple was removed; false otherwise.

getTuples

public Collection getTuples()
Retrieve all Tuples.

Returns:
The set of tuples.
See Also:
Tuple

getTuple

public ReteTuple getTuple(TupleKey key)
Retrieve a Tuple by TupleKey.

Parameters:
key - The tuple key.
Returns:
The matching tuple or null if this set contains no matching tuple.
See Also:
Tuple

removeTuple

public void removeTuple(TupleKey key)
Remove a tuple from this set.

Parameters:
key - Key matching the tuple.

iterator

public Iterator iterator()
Retrieve an iterator over the tuples.

Returns:
The iterator.

toString

public String toString()


Copyright © 2001-2004 The Codehaus. All Rights Reserved.