Package org.drools.core.common

Examples of org.drools.core.common.NamedEntryPoint


        ArrayList list = new ArrayList();
        kSession.setGlobal( "list", list );

       
        NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
        JTMSBeliefSystem bs = ( JTMSBeliefSystem ) ep.getTruthMaintenanceSystem().getBeliefSystem();
        bs.STRICT = true;

        try {
            kSession.fireAllRules();
            fail( "A fact and its negation should have been asserted, but no exception was thorwn in strict mode" );
View Full Code Here


        NodeFactory nFacotry = kBase.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

        FactHandle fhGo2 = kSession.insert( "go2" );
        kSession.fireAllRules();  
        FactHandle fhGo3 = kSession.insert( "go3" );
        kSession.fireAllRules();
       
        NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
        assertEquals( 4, ep.getObjects().size() ); //just go1, go2, go3, Person(darth)
       
        int count = 0;
        for ( Object object : ep.getObjects() ) {
            if ( object instanceof Person ) {
                assertEquals( new Integer(1), ((Person)object).getNotInEqualTestObject() );
                count++;
            }
        }
        assertEquals( 1, count );
       
        ObjectHashMap equalityMap =  ep.getTruthMaintenanceSystem().getEqualityKeyMap();
        assertEquals( 1, equalityMap.size() ); // Only Person type is logical
        org.drools.core.util.Iterator it = equalityMap.iterator();
        EqualityKey key = ( EqualityKey  ) (( ObjectEntry ) it.next() ).getValue();
        while ( !key.getFactHandle().getObject().equals( new Person( "darth") ) ) {
            key = ( EqualityKey  ) (( ObjectEntry ) it.next() ).getValue();
View Full Code Here

        FactHandle fhGo2 = kSession.insert( "go2" );
        kSession.fireAllRules();  
        FactHandle fhGo3 = kSession.insert( "go3" );
        kSession.fireAllRules();
       
        NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
        assertEquals( 3, ep.getObjects().size() ); //just go1, go2, go3

        NamedEntryPoint negEp = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "neg" );
        assertEquals( 1, negEp.getObjects().size() ); //just Person(darth)       
       
        int count = 0;
        for ( Object object : negEp.getObjects() ) {
            if ( object instanceof Person ) {
                assertEquals( new Integer(1), ((Person)object).getNotInEqualTestObject() );
                count++;
            }
        }
View Full Code Here

        assertTrue( list.contains( "-neg" ) );       
       
        assertEquals( 1, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
        assertEquals( 1, kSession.getEntryPoint( "neg" ).getObjects().size() ); // neg
       
        NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
        ObjectHashMap equalityMap =  ep.getTruthMaintenanceSystem().getEqualityKeyMap();
        assertEquals( 2, equalityMap.size() ); // go1, neg are two different strings.
        org.drools.core.util.Iterator it = equalityMap.iterator();
        EqualityKey key = ( EqualityKey  ) (( ObjectEntry ) it.next() ).getValue();
        while ( !key.getFactHandle().getObject().equals( "neg") ) {
            key = ( EqualityKey  ) (( ObjectEntry ) it.next() ).getValue();
        }
       
        assertEquals( 3, key.getBeliefSet().size() );       
        kSession.retract( key.getBeliefSet().getFactHandle() )
        assertEquals( 0, key.getBeliefSet().size() );    

        assertEquals( 1, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
        assertEquals( 0, kSession.getEntryPoint( "neg" ).getObjects().size() ); // neg
        assertEquals( 0, key.getBeliefSet().size() );
        assertEquals( 1, ep.getTruthMaintenanceSystem().getEqualityKeyMap().size() );
   
View Full Code Here

        ArrayList list = new ArrayList();
        kSession.setGlobal( "list", list );

       
        NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
        JTMSBeliefSystem bs = ( JTMSBeliefSystem ) ep.getTruthMaintenanceSystem().getBeliefSystem();
        bs.STRICT = true;

        try {
            kSession.fireAllRules();
            fail( "A fact and its negation should have been asserted, but no exception was thorwn in strict mode" );
View Full Code Here

        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

            } else {
                fh = jtmsBeliefSet.getPositiveFactHandle();
                jtmsBeliefSet.setPositiveFactHandle( null );
                fullyRetract = false; // Positives only retract from the rete network, handle must remain

                NamedEntryPoint nep = (NamedEntryPoint) fh.getEntryPoint() ;

//                final ObjectTypeConf typeConf = nep.getObjectTypeConfigurationRegistry().getObjectTypeConf( nep.getEntryPoint(),
//                                                                                                            handle.getObject() );

                nep.getEntryPointNode().retractObject( fh, context, typeConf, nep.getInternalWorkingMemory() );
            }

        } else {
            if ( wasUndecided && ! jtmsBeliefSet.isUndecided() ) {
                insertBelief( node, typeConf, jtmsBeliefSet, context, wasEmpty, wasNegated, wasUndecided );
View Full Code Here

            DefeasibleBeliefSet dbs = (DefeasibleBeliefSet) beliefSet;

            if ( ! wasNegated && beliefSet.isNegated() ) {
                InternalFactHandle fh = dbs.getPositiveFactHandle();
                NamedEntryPoint pep =  ((NamedEntryPoint) fh.getEntryPoint());
                pep.getEntryPointNode().retractObject( fh, context, typeConf, pep.getInternalWorkingMemory() );

                insertBelief( node, typeConf, dbs, context, wasEmpty, wasNegated, false );
            } else if ( wasNegated && ! beliefSet.isNegated() ) {
                InternalFactHandle fh = dbs.getNegativeFactHandle();
                ((NamedEntryPoint) fh.getEntryPoint()).delete( fh, context.getRuleOrigin(), node.getJustifier() );
View Full Code Here

    public void updateEntryPointsCache() {
        if (kBase.getAddedEntryNodeCache() != null) {
            for (EntryPointNode addedNode : kBase.getAddedEntryNodeCache()) {
                EntryPointId id = addedNode.getEntryPoint();
                if (EntryPointId.DEFAULT.equals(id)) continue;
                WorkingMemoryEntryPoint wmEntryPoint = new NamedEntryPoint(id, addedNode, this);
                entryPoints.put(id.getEntryPointId(), wmEntryPoint);
            }
        }

        if (kBase.getRemovedEntryNodeCache() != null) {
View Full Code Here

TOP

Related Classes of org.drools.core.common.NamedEntryPoint

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.