org.drools.reteoo
Class FactHandleList

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

final class FactHandleList
extends Object
implements Serializable

Specialised array of FactHandles intended to be keyed by a Declarations index. The list only ever contains as many elements as necessary to hold a handle at the position specified by the largest Declaration index. As a result, the list will neccessarily contain NULL values. This class exists purely for performance reasons and as such, many assumptions have been made regarding behaviour based on know usage. Therefore, this class should in no way be considerd a general purpose data structure. Hence it resides in this package and not a more generic "util" package.

Author:
Simon Harris

Field Summary
(package private) static FactHandleList EMPTY_LIST
          Empty list for testing purposes only.
 
Constructor Summary
FactHandleList(FactHandleList left, FactHandleList right)
          Join two lists.
FactHandleList(int index, FactHandle handle)
          Single value constructor.
 
Method Summary
 boolean contains(FactHandle handle)
          Determines if the list contains a specified handle.
 boolean containsAll(FactHandleList other)
          Determines if the list is a super-set of another list.
 boolean equals(Object object)
           
 FactHandle get(int index)
          Obtains the handle at a specified index.
 int hashCode()
           
 int length()
          Obtains the length of the list.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_LIST

static final FactHandleList EMPTY_LIST
Empty list for testing purposes only.

Constructor Detail

FactHandleList

public FactHandleList(FactHandleList left,
                      FactHandleList right)
Join two lists.

Parameters:
left - The left list.
right - The right list.

FactHandleList

public FactHandleList(int index,
                      FactHandle handle)
Single value constructor.

Parameters:
index - The index at which the handle will be placed.
handle - The handle to use.
Method Detail

get

public FactHandle get(int index)
Obtains the handle at a specified index.

Parameters:
index - The position from which the handle should be obtained.
Returns:
The handle; or null if no handle exists.
Throws:
ArrayIndexOutOfBoundsException - if index > length().

contains

public boolean contains(FactHandle handle)
Determines if the list contains a specified handle.

Parameters:
handle - The handle to search for.
Returns:
true if the handle is found; otherwise false

containsAll

public boolean containsAll(FactHandleList other)
Determines if the list is a super-set of another list.

Parameters:
other - The list to be checked.
Returns:
true if this list contains all values from the other list; false otherwise.

length

public int length()
Obtains the length of the list.

Returns:
The length of the list, including all null values.

hashCode

public int hashCode()

equals

public boolean equals(Object object)


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