public LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTuple currentLeftChild, LeftTuple currentRightChild, Sink sink, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(leftTuple, rightTuple, currentLeftChild, currentRightChild, sink, leftTupleMemoryEnabled ); } public Memory createMemory(RuleBaseConfiguration config, InternalWorkingMemory wm) {
table[0] = rtList; for ( int i = 0; i < numEntries; i++ ) { LeftTupleImpl leftTuple = new LeftTupleImpl(); leftTuple.setMemory( rtList ); rtList.add( leftTuple ); table[2] = rtList; for ( int i = 0; i < numEntries; i++ ) { LeftTupleImpl leftTuple = new LeftTupleImpl(); leftTuple.setMemory( rtList ); rtList.add( leftTuple ); table[2].setNext( rtList ); for ( int i = 0; i < numEntries; i++ ) { LeftTupleImpl leftTuple = new LeftTupleImpl(); leftTuple.setMemory( rtList ); rtList.add( leftTuple );
final LeftTupleImpl tuple = new LeftTupleImpl( f0, null, true ); f0.removeLeftTuple(tuple); pctxFactory.createPropagationContext( 1, PropagationContext.Type.DELETION, null, tuple != null ? (TerminalNode)tuple.getTupleSink() : null, null ), new RuleTerminalNode(0, new CompositeObjectSinkAdapterTest.MockBetaNode(), context.getRule(), subrule, 0, new BuildContext( kBase )), null); final DefaultKnowledgeHelper kbHelper = new DefaultKnowledgeHelper( ksession );
tuple.setLeftTupleSink( new RuleTerminalNode(1, new CompositeObjectSinkAdapterTest.MockBetaNode(), rule,rule.getLhs(), 0,new BuildContext(kBase) ) ); final Activation activation = new MockActivation( rule, 0,
tuple.setLeftTupleSink( new RuleTerminalNode(1, new CompositeObjectSinkAdapterTest.MockBetaNode(), newRule,newRule.getLhs(), 0, new BuildContext(kBase) ) ); final Activation activation = new MockActivation( newRule, 0,
public LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTuple currentLeftChild, LeftTuple currentRightChild, Sink sink, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(leftTuple, rightTuple, currentLeftChild, currentRightChild, sink, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(final InternalFactHandle factHandle, final LeftTuple leftTuple, final Sink sink) { return new LeftTupleImpl(factHandle,leftTuple, sink ); }
public LeftTuple createLeftTuple(LeftTuple leftTuple, Sink sink, PropagationContext pctx, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(leftTuple,sink, pctx, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(InternalFactHandle factHandle, Sink sink, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(factHandle, sink, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(LeftTuple leftTuple, Sink sink, PropagationContext pctx, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(leftTuple,sink, pctx, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(InternalFactHandle factHandle, Sink sink, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(factHandle, sink, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(final InternalFactHandle factHandle, final LeftTuple leftTuple, final Sink sink) { return new LeftTupleImpl(factHandle,leftTuple, sink ); }
public LeftTuple createLeftTuple(LeftTuple leftTuple, Sink sink, PropagationContext pctx, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(leftTuple,sink, pctx, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(InternalFactHandle factHandle, Sink sink, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(factHandle, sink, leftTupleMemoryEnabled ); }
public LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTuple currentLeftChild, LeftTuple currentRightChild, Sink sink, boolean leftTupleMemoryEnabled) { return new LeftTupleImpl(leftTuple, rightTuple, currentLeftChild, currentRightChild, sink, leftTupleMemoryEnabled ); }
@Test public void testMidTraversal() { LeftTupleImpl tm2 = new LeftTupleImpl(); LeftTupleImpl tm1 = new LeftTupleImpl(tm2, null, (PropagationContext) null,true); LeftTuple tm1_1 = new LeftTupleImpl(tm1, null, (PropagationContext) null,true); // this leaf will not be included LeftTupleImpl t0 = new LeftTupleImpl(tm1, null, (PropagationContext) null,true); // insert two nodes before our root traversal position LeftTupleImpl t1 = new LeftTupleImpl(t0, null, (PropagationContext) null,true); LeftTupleImpl t2 = new LeftTupleImpl(t0, null, (PropagationContext) null,true); LeftTupleImpl t3 = new LeftTupleImpl(t0, null, (PropagationContext) null,true); LeftTupleImpl t1_1 = new LeftTupleImpl(t1, null, (PropagationContext) null,true); LeftTupleImpl t1_2 = new LeftTupleImpl(t1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1 = new LeftTupleImpl(t1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1_1 = new LeftTupleImpl(t1_1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1_2 = new LeftTupleImpl(t1_1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1_3 = new LeftTupleImpl(t1_1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_2_1 = new LeftTupleImpl(t1_2, null, (PropagationContext) null,true); LeftTupleImpl t1_2_2 = new LeftTupleImpl(t1_2, null, (PropagationContext) null,true); LeftTupleImpl t1_2_2_1 = new LeftTupleImpl(t1_2_2, null, (PropagationContext) null,true); LeftTupleImpl t1_2_3 = new LeftTupleImpl(t1_2, null, (PropagationContext) null,true); LeftTupleImpl t2_1 = new LeftTupleImpl(t2, null, (PropagationContext) null,true); LeftTupleImpl t2_2 = new LeftTupleImpl(t2, null, (PropagationContext) null,true); LeftTupleImpl t2_3 = new LeftTupleImpl(t2, null, (PropagationContext) null,true);
@Test public void testRootTraversal() { LeftTupleImpl t0 = new LeftTupleImpl(); LeftTupleImpl t1 = new LeftTupleImpl(t0, null, (PropagationContext) null, true); LeftTupleImpl t2 = new LeftTupleImpl(t0, null, (PropagationContext) null,true); LeftTupleImpl t3 = new LeftTupleImpl(t0, null, (PropagationContext) null,true); LeftTupleImpl t1_1 = new LeftTupleImpl(t1, null, (PropagationContext) null,true); LeftTupleImpl t1_2 = new LeftTupleImpl(t1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1 = new LeftTupleImpl(t1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1_1 = new LeftTupleImpl(t1_1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1_2 = new LeftTupleImpl(t1_1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_1_1_3 = new LeftTupleImpl(t1_1_1, null, (PropagationContext) null,true); LeftTupleImpl t1_2_1 = new LeftTupleImpl(t1_2, null, (PropagationContext) null,true); LeftTupleImpl t1_2_2 = new LeftTupleImpl(t1_2, null, (PropagationContext) null,true); LeftTupleImpl t1_2_2_1 = new LeftTupleImpl(t1_2_2, null,(PropagationContext) null, true); LeftTupleImpl t1_2_3 = new LeftTupleImpl(t1_2, null, (PropagationContext) null,true); LeftTupleImpl t2_1 = new LeftTupleImpl(t2, null, (PropagationContext) null,true); LeftTupleImpl t2_2 = new LeftTupleImpl(t2, null,(PropagationContext) null, true); LeftTupleImpl t2_3 = new LeftTupleImpl(t2, null, (PropagationContext) null,true); LeftTupleImpl t2_3_1 = new LeftTupleImpl(t2_3, null, (PropagationContext) null,true); LeftTupleImpl t2_3_1_1 = new LeftTupleImpl(t2_3_1, null, (PropagationContext) null,true); LeftTupleImpl t2_3_2 = new LeftTupleImpl(t2_3, null, (PropagationContext) null,true);
@Test public void testEmptyIterator() { final TupleList map = new TupleList(); final Cheese stilton1 = new Cheese( "stilton", 35 ); final InternalFactHandle h1 = new DefaultFactHandle( 1, stilton1 ); assertNull( map.getFirst( new LeftTupleImpl( h1, null, true ) ) ); } }
public T delete(Object... objects) { this.testStagedDelete = true; if ( objects == null ) { objects = new Object[0]; } for ( int i = 0; i < objects.length; i++ ) { if ( !(objects[i] instanceof Pair) ) { Object o1 = objects[i]; InternalFactHandle fh1 = (InternalFactHandle) wm.getFactHandle( o1 ); LeftTuple leftTuple = new LeftTupleImpl( fh1, sink, true ); leftTuples.addDelete( leftTuple ); } else { Pair p = (Pair )objects[i]; InternalFactHandle fh1 = (InternalFactHandle) wm.getFactHandle( p.getO1() ); LeftTuple leftTuple1 = new LeftTupleImpl( fh1, sink, true ); InternalFactHandle fh2 = (InternalFactHandle) wm.getFactHandle( p.getO2() ); LeftTuple leftTuple2 = sink.createLeftTuple( leftTuple1, new RightTupleImpl( fh2 ), sink ); leftTuples.addDelete( leftTuple2 ); } } return (T) this ; }
public T update(Object... objects) { this.testStagedUpdate = true; if ( objects == null ) { objects = new Object[0]; } for ( int i = 0; i < objects.length; i++ ) { if ( !(objects[i] instanceof Pair) ) { Object o1 = objects[i]; InternalFactHandle fh1 = (InternalFactHandle) wm.getFactHandle( o1 ); LeftTuple leftTuple = new LeftTupleImpl( fh1, sink, true ); leftTuples.addUpdate( leftTuple ); } else { Pair p = (Pair )objects[i]; InternalFactHandle fh1 = (InternalFactHandle) wm.getFactHandle( p.getO1() ); LeftTuple leftTuple1 = new LeftTupleImpl( fh1, sink, true ); InternalFactHandle fh2 = (InternalFactHandle) wm.getFactHandle( p.getO2() ); LeftTuple leftTuple2 = sink.createLeftTuple( leftTuple1, new RightTupleImpl( fh2 ), sink ); leftTuples.addUpdate( leftTuple2 ); } } return (T) this ; }