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 classTupleIndexHashTable.FieldIndexHashTableFullIteratorstatic classTupleIndexHashTable.FullFastIterator-
Nested classes/interfaces inherited from class org.drools.core.util.AbstractHashTable
AbstractHashTable.DoubleCompositeIndex, AbstractHashTable.DoubleHashEntry, AbstractHashTable.FieldIndex, 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 intPRIME-
Fields inherited from class org.drools.core.util.AbstractHashTable
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 voidadd(Tuple tuple)voidclear()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 notTuplegetFirst(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.IndexgetIndex()TupleMemory.IndexTypegetIndexType()intgetResizeHashcode(TupleList entry)voidinit(TupleList[] table, int size, int factSize)booleanisIndexed()Iterator<Tuple>iterator()voidreadExternal(java.io.ObjectInput in)voidremove(Tuple tuple)voidremoveAdd(Tuple tuple)intsize()Tuple[]toArray()java.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class org.drools.core.util.AbstractHashTable
ensureCapacity, getTable, indexOf, isEmpty, newIterator, rehash, resize
-
-
-
-
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(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classAbstractHashTable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classAbstractHashTable- Throws:
java.io.IOException
-
init
public void init(TupleList[] table, int size, int factSize)
-
iterator
public Iterator<Tuple> iterator()
- Specified by:
iteratorin interfaceTupleMemory- Overrides:
iteratorin classAbstractHashTable
-
fastIterator
public FastIterator<Tuple> fastIterator()
- Specified by:
fastIteratorin interfaceTupleMemory
-
fullFastIterator
public FastIterator<Tuple> fullFastIterator()
Description copied from interface:TupleMemoryIterates the entire data structure, regardless of whether TupleMemory is hashed or not.- Specified by:
fullFastIteratorin interfaceTupleMemory- Returns:
-
fullFastIterator
public FastIterator<Tuple> fullFastIterator(Tuple tuple)
Description copied from interface:TupleMemoryIterator that resumes from the current RightTuple, regardless of whether the TupleMemory is hashed or not- Specified by:
fullFastIteratorin interfaceTupleMemory- Returns:
-
getFirst
public Tuple getFirst(Tuple tuple)
Description copied from interface:TupleMemoryThe 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:
getFirstin interfaceTupleMemory
-
isIndexed
public boolean isIndexed()
- Specified by:
isIndexedin interfaceTupleMemory
-
getIndex
public AbstractHashTable.Index getIndex()
- Specified by:
getIndexin interfaceTupleMemory
-
getResizeHashcode
public int getResizeHashcode(TupleList entry)
- Specified by:
getResizeHashcodein classAbstractHashTable
-
toArray
public Tuple[] toArray()
- Specified by:
toArrayin interfaceTupleMemory
-
removeAdd
public void removeAdd(Tuple tuple)
- Specified by:
removeAddin interfaceTupleMemory
-
add
public void add(Tuple tuple)
- Specified by:
addin interfaceTupleMemory
-
remove
public void remove(Tuple tuple)
- Specified by:
removein interfaceTupleMemory
-
size
public int size()
- Specified by:
sizein interfaceTupleMemory- Overrides:
sizein classAbstractHashTable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractHashTable
-
clear
public void clear()
- Specified by:
clearin interfaceTupleMemory- Overrides:
clearin classAbstractHashTable
-
getIndexType
public TupleMemory.IndexType getIndexType()
- Specified by:
getIndexTypein interfaceTupleMemory
-
-