Package org.drools.reteoo

Examples of org.drools.reteoo.NotNode


                                                                                    false );
            // then attach the NOT node. It will work both as a simple not node
            // or as subnetwork join node as the context was set appropriatelly
            // in each case
            context.setTupleSource( (TupleSource) utils.attachNode( context,
                                                                    new NotNode( context.getNextId(),
                                                                                 context.getTupleSource(),
                                                                                 context.getObjectSource(),
                                                                                 betaConstraints,
                                                                                 context ) ) );
            context.setBetaconstraints( null );
View Full Code Here


                                                                                    context.getBetaconstraints(),
                                                                                    false );
            // then attach the NOT node. It will work both as a simple not node
            // or as subnetwork join node as the context was set appropriatelly
            // in each case
            NotNode node = new NotNode( context.getNextId(),
                                        context.getTupleSource(),
                                        context.getObjectSource(),
                                        betaConstraints,
                                        context );
            context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
View Full Code Here

            Behavior[] behaviors = createBehaviorArray( context );

            // then attach the NOT node. It will work both as a simple not node
            // or as subnetwork join node as the context was set appropriatelly
            // in each case
            NotNode node = null;
            if( GroupElement.FORALL_NOT.equals( not.getType() ) ) {
                node = new ForallNotNode( context.getNextId(),
                             context.getTupleSource(),
                             context.getObjectSource(),
                             betaConstraints,
                             behaviors,
                             context,
                             not.getForallBaseObjectType() );
            } else {
                node = new NotNode( context.getNextId(),
                                    context.getTupleSource(),
                                    context.getObjectSource(),
                                    betaConstraints,
                                    behaviors,
                                    context );
View Full Code Here

        ExistsNode existsNode = (ExistsNode) riaNode2.getSinkPropagator().getSinks()[0];

        QueryElementNode queryElementNode3 = (QueryElementNode) existsNode.getSinkPropagator().getSinks()[0];
        FromNode fromNode = (FromNode) queryElementNode3.getSinkPropagator().getSinks()[0];
        RightInputAdapterNode riaNode3 = (RightInputAdapterNode) fromNode.getSinkPropagator().getSinks()[0];
        NotNode notNode = (NotNode) riaNode3.getSinkPropagator().getSinks()[0];

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ReteooWorkingMemoryInterface wm = ((StatefulKnowledgeSessionImpl) ksession).session;
        AccumulateMemory accMemory = (AccumulateMemory) wm.getNodeMemory( accNode );
        BetaMemory existsMemory = (BetaMemory) wm.getNodeMemory( existsNode );
View Full Code Here

        ReteooWorkingMemoryInterface wm = ((StatefulKnowledgeSessionImpl)kbase.newStatefulKnowledgeSession()).session;

        AlphaNode alphanode = ( AlphaNode ) node.getSinkPropagator().getSinks()[0];
        LeftInputAdapterNode liaNode = (LeftInputAdapterNode) alphanode.getSinkPropagator().getSinks()[0];

        NotNode n = (NotNode) liaNode.getSinkPropagator().getSinks()[0];

        DoubleNonIndexSkipBetaConstraints c = (DoubleNonIndexSkipBetaConstraints) n.getRawConstraints();
        //assertEquals( "$name", ((VariableConstraint)c.getConstraint()).getRequiredDeclarations()[0].getIdentifier() );
        assertTrue( c.isIndexed() );
        BetaMemory bm = ( BetaMemory ) wm.getNodeMemory( n );
        System.out.println( bm.getLeftTupleMemory().getClass() );
        System.out.println( bm.getRightTupleMemory().getClass() );
View Full Code Here

        ReteooWorkingMemoryInterface wm = ((StatefulKnowledgeSessionImpl)kbase.newStatefulKnowledgeSession()).session;

        AlphaNode alphanode = ( AlphaNode ) node.getSinkPropagator().getSinks()[0];
        LeftInputAdapterNode liaNode = (LeftInputAdapterNode) alphanode.getSinkPropagator().getSinks()[0];

        NotNode n = (NotNode) liaNode.getSinkPropagator().getSinks()[0];

        DoubleNonIndexSkipBetaConstraints c = (DoubleNonIndexSkipBetaConstraints) n.getRawConstraints();
        //assertEquals( "$name", ((VariableConstraint)c.getConstraint()).getRequiredDeclarations()[0].getIdentifier() );
        assertTrue( c.isIndexed() );
        BetaMemory bm = ( BetaMemory ) wm.getNodeMemory( n );
        System.out.println( bm.getLeftTupleMemory().getClass() );
        System.out.println( bm.getRightTupleMemory().getClass() );
        assertTrue(bm.getLeftTupleMemory() instanceof LeftTupleIndexHashTable);
        assertTrue( bm.getRightTupleMemory() instanceof RightTupleIndexHashTable );


        final Map<String, Integer> map = new HashMap<String, Integer>();
        map.put("inserted", new Integer(0));
        map.put("deleted", new Integer(0));
        map.put("updated", new Integer(0));
        wm.openLiveQuery("peeps", new Object[] {Variable.v, 99 }, new ViewChangedEventListener() {
            public void rowAdded(Row row) {
            }

            public void rowRemoved(Row row) {
            }

            public void rowUpdated(Row row) {
            }
        });

        Map<String, InternalFactHandle> peeps = new HashMap<String, InternalFactHandle>();

        Person p = new Person( "x0", 100);
        InternalFactHandle fh = ( InternalFactHandle ) wm.insert( p );

        peeps.put(p.getName(), fh);

        for ( int i = 1; i < 100; i++ ) {
            p = new Person( "x" + i, 101);
            fh = ( InternalFactHandle ) wm.insert( p );
            wm.fireAllRules();
            peeps.put(p.getName(), fh);
        }

        List<RightTuple> list = new ArrayList<RightTuple>(100);
        FastIterator it = n.getRightIterator( bm.getRightTupleMemory() );
        for ( RightTuple rt =n.getFirstRightTuple(null, bm.getRightTupleMemory(), null, it); rt != null; rt = (RightTuple)it.next(rt) ) {
            list.add(rt);
        }
        assertEquals( 100, list.size() );

        // check we can resume from each entry in the list above.
        for ( int i = 0; i < 100; i++ ) {
            RightTuple rightTuple = list.get(i);
            it = n.getRightIterator( bm.getRightTupleMemory(), rightTuple ); // resumes from the current rightTuple
            int j = i + 1;
            for ( RightTuple rt = ( RightTuple ) it.next(rightTuple); rt != null; rt = (RightTuple)it.next(rt) ) {
                assertSame( list.get(j), rt);
                j++;
            }
View Full Code Here

            Behavior[] behaviors = createBehaviorArray( context );

            // then attach the NOT node. It will work both as a simple not node
            // or as subnetwork join node as the context was set appropriatelly
            // in each case
            NotNode node = null;
            node = new NotNode( context.getNextId(),
                                context.getTupleSource(),
                                context.getObjectSource(),
                                betaConstraints,
                                behaviors,
                                context );
View Full Code Here

            // then attach the NOT node. It will work both as a simple not node
            // or as subnetwork join node as the context was set appropriatelly
            // in each case
            context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                        new NotNode( context.getNextId(),
                                                                                     context.getTupleSource(),
                                                                                     context.getObjectSource(),
                                                                                     betaConstraints,
                                                                                     behaviors,
                                                                                     context ) ) );
View Full Code Here

                                                                               buildContext.getRuleBase().getConfiguration() );
            } else {
                constraints = new EmptyBetaConstraints();
            }

            NotNode notNode = new NotNode( buildContext.getNextId(),
                                           leftTupleSource,
                                           rightObjectSource,
                                           constraints,
                                           BehaviorManager.NO_BEHAVIORS,
                                           buildContext );
            notNode.attach();
            context.put( name,
                         notNode );

        } else {
            throw new IllegalArgumentException( "Cannot arguments " + args );
View Full Code Here

        ExistsNode existsNode = (ExistsNode) riaNode2.getSinkPropagator().getSinks()[0];

        QueryElementNode queryElementNode3 = (QueryElementNode) existsNode.getSinkPropagator().getSinks()[0];
        FromNode fromNode = (FromNode) queryElementNode3.getSinkPropagator().getSinks()[0];
        RightInputAdapterNode riaNode3 = (RightInputAdapterNode) fromNode.getSinkPropagator().getSinks()[0];
        NotNode notNode = (NotNode) riaNode3.getSinkPropagator().getSinks()[0];

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ReteooWorkingMemoryInterface wm = ((StatefulKnowledgeSessionImpl) ksession).session;
        AccumulateMemory accMemory = (AccumulateMemory) wm.getNodeMemory( accNode );
        BetaMemory existsMemory = (BetaMemory) wm.getNodeMemory( existsNode );
View Full Code Here

TOP

Related Classes of org.drools.reteoo.NotNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.