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:
java.io.Externalizable
,java.io.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.DoubleCompositeIndex, AbstractHashTable.DoubleHashEntry, AbstractHashTable.HashEntry, AbstractHashTable.Index, AbstractHashTable.IndexTupleList, 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
loadFactor, size, table, threshold
-
-
Constructor Summary
Constructors Constructor Description TupleIndexHashTable()
TupleIndexHashTable(int capacity, float loadFactor, org.drools.base.util.FieldIndex[] index, boolean left)
TupleIndexHashTable(org.drools.base.util.FieldIndex[] index, boolean left)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Tuple tuple)
void
clear()
FastIterator<Tuple>
fastIterator()
FastIterator<Tuple>
fullFastIterator()
Iterates the entire data structure, regardless of whether TupleMemory is hashed or not.FastIterator<Tuple>
fullFastIterator(Tuple tuple)
Iterator that resumes from the current RightTuple, regardless of whether the TupleMemory is hashed or notTuple
getFirst(Tuple tuple)
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(TupleList entry)
void
init(TupleList[] table, int size, int factSize)
boolean
isIndexed()
Iterator<Tuple>
iterator()
void
readExternal(java.io.ObjectInput in)
void
remove(Tuple tuple)
void
removeAdd(Tuple tuple)
int
size()
Tuple[]
toArray()
java.lang.String
toString()
void
writeExternal(java.io.ObjectOutput out)
-
Methods inherited from class org.drools.core.util.AbstractHashTable
ensureCapacity, getTable, indexOf, isEmpty, newIterator, resize
-
-
-
-
Field Detail
-
PRIME
public static final int PRIME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TupleIndexHashTable
public TupleIndexHashTable()
-
TupleIndexHashTable
public TupleIndexHashTable(org.drools.base.util.FieldIndex[] index, boolean left)
-
TupleIndexHashTable
public TupleIndexHashTable(int capacity, float loadFactor, org.drools.base.util.FieldIndex[] index, boolean left)
-
-
Method Detail
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Overrides:
readExternal
in classAbstractHashTable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Overrides:
writeExternal
in classAbstractHashTable
- Throws:
java.io.IOException
-
init
public void init(TupleList[] table, int size, int factSize)
-
iterator
public Iterator<Tuple> iterator()
- Specified by:
iterator
in interfaceTupleMemory
- Overrides:
iterator
in classAbstractHashTable
-
fastIterator
public FastIterator<Tuple> fastIterator()
- Specified by:
fastIterator
in interfaceTupleMemory
-
fullFastIterator
public FastIterator<Tuple> 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<Tuple> fullFastIterator(Tuple tuple)
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 tuple)
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()
- Specified by:
getIndex
in interfaceTupleMemory
-
getResizeHashcode
public int getResizeHashcode(TupleList entry)
- Specified by:
getResizeHashcode
in classAbstractHashTable
-
toArray
public Tuple[] toArray()
- Specified by:
toArray
in interfaceTupleMemory
-
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
-
size
public int size()
- Specified by:
size
in interfaceTupleMemory
- Overrides:
size
in classAbstractHashTable
-
toString
public java.lang.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
-
-