Package org.drools.core.util.index
Class TupleIndexHashTable
- java.lang.Object
-
- org.drools.core.util.AbstractHashTable
-
- org.drools.core.util.index.TupleIndexHashTable
-
- All Implemented Interfaces:
Externalizable
,Serializable
,TupleMemory
public class TupleIndexHashTable extends AbstractHashTable implements TupleMemory
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TupleIndexHashTable.FieldIndexHashTableFullIterator
static class
TupleIndexHashTable.FullFastIterator
-
Nested classes/interfaces inherited from class org.drools.core.util.AbstractHashTable
AbstractHashTable.AbstractObjectComparator, AbstractHashTable.DoubleCompositeIndex, AbstractHashTable.DoubleHashEntry, AbstractHashTable.EqualityEquals, AbstractHashTable.FieldIndex, AbstractHashTable.HashEntry, AbstractHashTable.Index, AbstractHashTable.IndexTupleList, AbstractHashTable.InstanceEquals, AbstractHashTable.ObjectComparator, AbstractHashTable.SingleHashEntry, AbstractHashTable.SingleIndex, AbstractHashTable.TripleCompositeIndex, AbstractHashTable.TripleHashEntry
-
Nested classes/interfaces inherited from interface org.drools.core.reteoo.TupleMemory
TupleMemory.IndexType
-
-
Field Summary
Fields Modifier and Type Field Description static int
PRIME
-
Fields inherited from class org.drools.core.util.AbstractHashTable
comparator, loadFactor, size, table, threshold
-
-
Constructor Summary
Constructors Constructor Description TupleIndexHashTable()
TupleIndexHashTable(int capacity, float loadFactor, AbstractHashTable.FieldIndex[] index, boolean left)
TupleIndexHashTable(AbstractHashTable.FieldIndex[] index, boolean left)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Tuple tuple)
void
clear()
boolean
contains(Tuple tuple)
FastIterator
fastIterator()
FastIterator
fullFastIterator()
Iterates the entire data structure, regardless of whether TupleMemory is hashed or not.FastIterator
fullFastIterator(Tuple leftTuple)
Iterator that resumes from the current RightTuple, regardless of whether the TupleMemory is hashed or notTuple
getFirst(Tuple rightTuple)
The FactHandle is always the context fact and is necessary when the object being modified is in the both left and right node memories.AbstractHashTable.Index
getIndex()
TupleMemory.IndexType
getIndexType()
int
getResizeHashcode(Entry entry)
void
init(Entry[] table, int size, int factSize)
boolean
isIndexed()
Iterator<Tuple>
iterator()
void
readExternal(ObjectInput in)
void
remove(Tuple tuple)
void
removeAdd(Tuple tuple)
int
size()
Tuple[]
toArray()
String
toString()
void
writeExternal(ObjectOutput out)
-
Methods inherited from class org.drools.core.util.AbstractHashTable
ensureCapacity, getTable, indexOf, isEmpty, newIterator, rehash, resize, setComparator
-
-
-
-
Field Detail
-
PRIME
public static final int PRIME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TupleIndexHashTable
public TupleIndexHashTable()
-
TupleIndexHashTable
public TupleIndexHashTable(AbstractHashTable.FieldIndex[] index, boolean left)
-
TupleIndexHashTable
public TupleIndexHashTable(int capacity, float loadFactor, AbstractHashTable.FieldIndex[] index, boolean left)
-
-
Method Detail
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classAbstractHashTable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classAbstractHashTable
- Throws:
IOException
-
init
public void init(Entry[] table, int size, int factSize)
-
iterator
public Iterator<Tuple> iterator()
- Specified by:
iterator
in interfaceTupleMemory
- Overrides:
iterator
in classAbstractHashTable
-
fastIterator
public FastIterator fastIterator()
- Specified by:
fastIterator
in interfaceTupleMemory
-
fullFastIterator
public FastIterator fullFastIterator()
Description copied from interface:TupleMemory
Iterates the entire data structure, regardless of whether TupleMemory is hashed or not.- Specified by:
fullFastIterator
in interfaceTupleMemory
- Returns:
-
fullFastIterator
public FastIterator fullFastIterator(Tuple leftTuple)
Description copied from interface:TupleMemory
Iterator that resumes from the current RightTuple, regardless of whether the TupleMemory is hashed or not- Specified by:
fullFastIterator
in interfaceTupleMemory
- Returns:
-
getFirst
public Tuple getFirst(Tuple rightTuple)
Description copied from interface:TupleMemory
The FactHandle is always the context fact and is necessary when the object being modified is in the both left and right node memories. This is because the memory on the opposite side would not have yet memory.removeAdd the fact, so it could potentially be in the wrong bucket. So the bucket matches check always checks to ignore the first facthandle if it's the same as the context fact.- Specified by:
getFirst
in interfaceTupleMemory
-
isIndexed
public boolean isIndexed()
- Specified by:
isIndexed
in interfaceTupleMemory
-
getIndex
public AbstractHashTable.Index getIndex()
-
getResizeHashcode
public int getResizeHashcode(Entry entry)
- Specified by:
getResizeHashcode
in classAbstractHashTable
-
toArray
public Tuple[] toArray()
- Specified by:
toArray
in interfaceTupleMemory
- Overrides:
toArray
in classAbstractHashTable
-
removeAdd
public void removeAdd(Tuple tuple)
- Specified by:
removeAdd
in interfaceTupleMemory
-
add
public void add(Tuple tuple)
- Specified by:
add
in interfaceTupleMemory
-
remove
public void remove(Tuple tuple)
- Specified by:
remove
in interfaceTupleMemory
-
contains
public boolean contains(Tuple tuple)
- Specified by:
contains
in interfaceTupleMemory
-
size
public int size()
- Specified by:
size
in interfaceTupleMemory
- Overrides:
size
in classAbstractHashTable
-
toString
public String toString()
- Overrides:
toString
in classAbstractHashTable
-
clear
public void clear()
- Specified by:
clear
in interfaceTupleMemory
- Overrides:
clear
in classAbstractHashTable
-
getIndexType
public TupleMemory.IndexType getIndexType()
- Specified by:
getIndexType
in interfaceTupleMemory
-
-