private BetaNode createBetaNode(int id, int type, LeftTupleSource leftTupleSource) { MockObjectSource mockObjectSource = new MockObjectSource( 8 ); BetaNode betaNode = null; switch ( type ) { case JOIN_NODE : { betaNode = new JoinNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; } case EXISTS_NODE : { betaNode = new ExistsNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; } case NOT_NODE : { betaNode = new NotNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; } } mockObjectSource.attach(buildContext); betaNode.attach(buildContext); return betaNode; }
MockBetaNode(final int id, final LeftTupleSource leftInput, final ObjectSource rightInput, BuildContext buildContext) { super( id, leftInput, rightInput, EmptyBetaConstraints.getInstance(), buildContext ); }
MockBetaNode(final int id, final LeftTupleSource leftInput, final ObjectSource rightInput) { super( id, leftInput, rightInput, EmptyBetaConstraints.getInstance(), null ); }
switch ( type ) { case JOIN_NODE : { networkNode = new JoinNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; networkNode = new ExistsNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; networkNode = new NotNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break;
ts, os, EmptyBetaConstraints.getInstance(), buildContext ); final BetaNode j2 = new JoinNode( 2, ts, os, EmptyBetaConstraints.getInstance(), buildContext ); final BetaNode n1 = new NotNode( 3, ts, os, EmptyBetaConstraints.getInstance(), buildContext ); final BetaNode n2 = new NotNode( 4, ts, os, EmptyBetaConstraints.getInstance(), buildContext );
switch ( type ) { case JOIN_NODE : { networkNode = new JoinNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; networkNode = new ExistsNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break; networkNode = new NotNode( id, leftTupleSource, mockObjectSource, new EmptyBetaConstraints(), buildContext ); break;
@Test public void testMemory() { when( constraint.isAllowedCachedLeft( any( ContextEntry.class ), any( InternalFactHandle.class ) ) ).thenReturn( true ); when( constraint.isAllowedCachedRight( any( LeftTupleImpl.class ), any( ContextEntry.class ) ) ).thenReturn( true ); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase()); final MockObjectSource objectSource = new MockObjectSource( 1 ); final MockTupleSource tupleSource = new MockTupleSource( 1 ); InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(); BuildContext buildContext = new BuildContext( kBase, kBase.getReteooBuilder().getIdGenerator() ); final JoinNode joinNode = new JoinNode( 2, tupleSource, objectSource, EmptyBetaConstraints.getInstance(), buildContext ); final BetaMemory memory = (BetaMemory) workingMemory .getNodeMemory( joinNode ); assertNotNull( memory ); }
new EmptyBetaConstraints(), buildContext ); BetaNode n2 = new JoinNode( 11, n1, mockObjectSource, new EmptyBetaConstraints(), buildContext ); BetaNode n3 = new JoinNode( 12, n1, mockObjectSource, new EmptyBetaConstraints(), buildContext ); BetaNode n4 = new JoinNode( 13, n2, mockObjectSource, new EmptyBetaConstraints(), buildContext ); BetaNode n5 = new JoinNode( 14, n2, mockObjectSource, new EmptyBetaConstraints(), buildContext );
this.objectSource, EmptyBetaConstraints.getInstance(), buildContext );
constraintOperator), buildContext.getKnowledgeBase().getConfiguration()); } else { betaConstraints = new EmptyBetaConstraints();
this.objectSource, EmptyBetaConstraints.getInstance(), buildContext);