Search in sources :

Example 1 with FieldIndex

use of org.drools.core.reteoo.CompositeObjectSinkAdapter.FieldIndex in project drools by kiegroup.

the class CompositePartitionAwareObjectSinkAdapter method hashSink.

private boolean hashSink(ObjectSink sink) {
    InternalReadAccessor readAccessor = getHashableAccessor(sink);
    if (readAccessor != null) {
        int index = readAccessor.getIndex();
        if (fieldIndex == null) {
            this.fieldIndex = new CompositeObjectSinkAdapter.FieldIndex(index, readAccessor);
            this.hashedSinkMap = new ObjectHashMap();
        }
        if (fieldIndex.getIndex() == index) {
            AlphaNode alpha = (AlphaNode) sink;
            this.hashedSinkMap.put(new CompositeObjectSinkAdapter.HashKey(index, ((IndexableConstraint) alpha.getConstraint()).getField(), fieldIndex.getFieldExtractor()), alpha, false);
            return true;
        }
    }
    this.fieldIndex = null;
    this.hashedSinkMap = null;
    return false;
}
Also used : FieldIndex(org.drools.core.reteoo.CompositeObjectSinkAdapter.FieldIndex) IndexableConstraint(org.drools.core.rule.IndexableConstraint) InternalReadAccessor(org.drools.core.spi.InternalReadAccessor) ObjectHashMap(org.drools.core.util.ObjectHashMap) IndexableConstraint(org.drools.core.rule.IndexableConstraint)

Aggregations

FieldIndex (org.drools.core.reteoo.CompositeObjectSinkAdapter.FieldIndex)1 IndexableConstraint (org.drools.core.rule.IndexableConstraint)1 InternalReadAccessor (org.drools.core.spi.InternalReadAccessor)1 ObjectHashMap (org.drools.core.util.ObjectHashMap)1