Search in sources :

Example 6 with PhreakPropagationContext

use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.

the class RightMemory method getRightTuples.

public List<RightTuple> getRightTuples(Object... objects) {
    BetaNode node = scenario.getBetaNode();
    BetaMemory bm = scenario.getBm();
    TupleMemory rtm = bm.getRightTupleMemory();
    InternalWorkingMemory wm = scenario.getWorkingMemory();
    if (objects == null) {
        objects = new Object[0];
    }
    List<RightTuple> rightTuples = new ArrayList<RightTuple>();
    for (Object object : objects) {
        InternalFactHandle fh = (InternalFactHandle) wm.insert(object);
        // node.createLeftTuple( fh, node, true );
        RightTuple expectedRightTuple = new RightTupleImpl(fh, node);
        expectedRightTuple.setPropagationContext(new PhreakPropagationContext());
        rightTuples.add(expectedRightTuple);
    }
    scenario.setTestRightMemory(true);
    return rightTuples;
}
Also used : InternalWorkingMemory(org.drools.core.common.InternalWorkingMemory) PhreakPropagationContext(org.drools.core.common.PhreakPropagationContext) BetaNode(org.drools.core.reteoo.BetaNode) ArrayList(java.util.ArrayList) BetaMemory(org.drools.core.reteoo.BetaMemory) RightTupleImpl(org.drools.core.reteoo.RightTupleImpl) InternalFactHandle(org.drools.core.common.InternalFactHandle) RightTuple(org.drools.core.reteoo.RightTuple) TupleMemory(org.drools.core.reteoo.TupleMemory)

Example 7 with PhreakPropagationContext

use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.

the class RightBuilder method delete.

public RightBuilder delete(Object... objects) {
    for (Object object : objects) {
        InternalFactHandle fh = (InternalFactHandle) wm.insert(object);
        RightTuple rightTuple = fh.getFirstRightTuple();
        rightTuple.setPropagationContext(new PhreakPropagationContext());
        rightTuples.addDelete(rightTuple);
    }
    return this;
}
Also used : PhreakPropagationContext(org.drools.core.common.PhreakPropagationContext) InternalFactHandle(org.drools.core.common.InternalFactHandle) RightTuple(org.drools.core.reteoo.RightTuple)

Example 8 with PhreakPropagationContext

use of org.drools.core.common.PhreakPropagationContext in project drools by kiegroup.

the class RightBuilder method insert.

public RightBuilder insert(Object... objects) {
    for (Object object : objects) {
        InternalFactHandle fh = (InternalFactHandle) wm.insert(object);
        RightTuple rightTuple = new RightTupleImpl(fh, sink);
        rightTuple.setPropagationContext(new PhreakPropagationContext());
        rightTuples.addInsert(rightTuple);
    }
    return this;
}
Also used : PhreakPropagationContext(org.drools.core.common.PhreakPropagationContext) RightTupleImpl(org.drools.core.reteoo.RightTupleImpl) InternalFactHandle(org.drools.core.common.InternalFactHandle) RightTuple(org.drools.core.reteoo.RightTuple)

Aggregations

InternalFactHandle (org.drools.core.common.InternalFactHandle)8 PhreakPropagationContext (org.drools.core.common.PhreakPropagationContext)8 LeftTuple (org.drools.core.reteoo.LeftTuple)4 RightTuple (org.drools.core.reteoo.RightTuple)4 ArrayList (java.util.ArrayList)2 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)2 BetaMemory (org.drools.core.reteoo.BetaMemory)2 BetaNode (org.drools.core.reteoo.BetaNode)2 RightTupleImpl (org.drools.core.reteoo.RightTupleImpl)2 TupleMemory (org.drools.core.reteoo.TupleMemory)2