Package org.drools.core.reteoo

Examples of org.drools.core.reteoo.EntryPointNode


        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl(1, kBase);

        final Rete source = kBase.getRete();

        final EntryPointNode entryPoint = new EntryPointNode(0,
                                                             source,
                                                             buildContext);
        entryPoint.attach(buildContext);

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode(1,
                                                                 this.entryPoint,
                                                                 new ClassObjectType(Cheese.class),
                                                                 buildContext);

        final MockObjectSink sink = new MockObjectSink();
        objectTypeNode.addObjectSink(sink);
        entryPoint.addObjectSink(objectTypeNode);

        final Object cheese = new Cheese("muzzarela",
                                         5);

        final InternalFactHandle handle1 = (InternalFactHandle) workingMemory.insert(cheese);
View Full Code Here


        IdGenerator idGenerator = kBase.getReteooBuilder().getIdGenerator();
        StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newStatefulKnowledgeSession();

        final Rete source = kBase.getRete();

        final EntryPointNode entryPoint = new EntryPointNode(0,
                                                             source,
                                                             buildContext);
        entryPoint.attach(buildContext);

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode(idGenerator.getNextId(),
                                                                 entryPoint,
                                                                 new ClassObjectType(Person.class),
                                                                 buildContext);
View Full Code Here

        this.constraintVariableName = constraintVariableName;
        return this;
    }

    public BetaNode build() {
        EntryPointNode epn = new EntryPointNode( buildContext.getNextId(),
                                                 buildContext.getRuleBase().getRete(),
                                                 buildContext );
        epn.attach( buildContext );

        ObjectTypeNode otn = new ObjectTypeNode( buildContext.getNextId(),
                                                 epn,
                                                 new ClassObjectType( leftType ),
                                                 buildContext );
View Full Code Here

        AbstractWorkingMemory abstractWorkingMemory = (AbstractWorkingMemory) reteWorkingMemory;

        InternalRuleBase ruleBase = (InternalRuleBase) abstractWorkingMemory.getRuleBase();
        Collection<EntryPointNode> entryPointNodes = ruleBase.getRete().getEntryPointNodes().values();

        EntryPointNode defaultEntryPointNode = null;
        for ( EntryPointNode epNode : entryPointNodes ) {
            if ( epNode.getEntryPoint().getEntryPointId().equals( "DEFAULT" ) ) {
                defaultEntryPointNode = epNode;
                break;
            }
        }
        assertNotNull( defaultEntryPointNode );

        Map<ObjectType, ObjectTypeNode> obnodes = defaultEntryPointNode.getObjectTypeNodes();

        ObjectType key = new ClassObjectType( DroolsQuery.class );
        ObjectTypeNode droolsQueryNode = obnodes.get( key );
        ObjectHashSet droolsQueryMemory = ((ObjectTypeNodeMemory) abstractWorkingMemory.getNodeMemory( droolsQueryNode )).memory;
        assertEquals( 0,
View Full Code Here

    protected void setupRete() {
        this.rete = new Rete( this );
        this.reteooBuilder = new ReteooBuilder( this );

        // always add the default entry point
        EntryPointNode epn = kieComponentFactory.getNodeFactoryService().buildEntryPointNode( this.reteooBuilder.getIdGenerator().getNextId(),
                                                                                              RuleBasePartitionId.MAIN_PARTITION,
                                                                                              this.getConfiguration().isMultithreadEvaluation(),
                                                                                              this.rete,
                                                                                              EntryPointId.DEFAULT );
        epn.attach();
    }
View Full Code Here

            }
        }
    }

    private void initTransient() {
        EntryPointNode epn = this.ruleBase.getRete().getEntryPointNode( EntryPointId.DEFAULT );

        this.defaultEntryPoint = new NamedEntryPoint( EntryPointId.DEFAULT,
                                                      epn,
                                                      this );
View Full Code Here

        Rete rete = ((ReteooRuleBase) ruleBase).getRete();

        NodeFactory nFacotry = ((ReteooRuleBase) ruleBase).getConfiguration().getComponentFactory().getNodeFactoryService();

        RuleBasePartitionId partionId = new RuleBasePartitionId("P-MAIN");
        EntryPointNode entryPointNode = nFacotry.buildEntryPointNode(1, partionId, false, (ObjectSource) rete , EntryPointId.DEFAULT);
        EntryPoint wmEntryPoint = new NamedEntryPoint(EntryPointId.DEFAULT, entryPointNode, wm);

        EventFactHandle factHandle = new EventFactHandle(1, (Object) new Person(),0, (new Date()).getTime(), 0, wmEntryPoint);
       
        return factHandle;
View Full Code Here

                            InternalFactHandle handle = (InternalFactHandle) element;
                            PropagationContext pContext = pctxFactory.createPropagationContext(wm.getNextPropagationIdCounter(), PropagationContext.MODIFICATION,
                                                                                               null, null, handle);
                            ModifyPreviousTuples modifyPreviousTuples = new ModifyPreviousTuples( handle.getFirstLeftTuple(),
                                                                                                  handle.getFirstRightTuple(),
                                                                                                  new EntryPointNode() );
                            handle.clearRightTuples();
                            handle.clearLeftTuples();
                            ((ObjectSink) sink).modifyObject( handle,
                                                              modifyPreviousTuples,
                                                              pContext,
View Full Code Here

                      BuildUtils utils,
                      RuleConditionElement rce) {
        final EntryPointId entry = (EntryPointId) rce;
        context.setCurrentEntryPoint( entry );
       
        EntryPointNode epn = context.getRuleBase().getRete().getEntryPointNode( entry );
        if( epn == null ) {
            NodeFactory nFactory = context.getComponentFactory().getNodeFactoryService();
            context.setObjectSource( (ObjectSource) utils.attachNode( context,
                                                                      nFactory.buildEntryPointNode( context.getNextId(),
                                                                                                    context.getRuleBase().getRete(),
View Full Code Here

        ruleBase.lock();
        try {
            InternalWorkingMemory[] wms = context.getWorkingMemories();
            NodeFactory nfactory = context.getComponentFactory().getNodeFactoryService();

            EntryPointNode epn = ruleBase.getRete().getEntryPointNode( context.getCurrentEntryPoint() );
            if ( epn == null ) {
                epn = new EntryPointNode( context.getNextId(),
                                          ruleBase.getRete(),
                                          context );
                epn.attach( context );
            }

            ObjectTypeNode otn = nfactory.buildObjectTypeNode( context.getNextId(), epn, objectType, context );

            long expirationOffset = getExpiratioOffsetForType( context,
View Full Code Here

TOP

Related Classes of org.drools.core.reteoo.EntryPointNode

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.