Package org.drools.core.reteoo

Examples of org.drools.core.reteoo.ReteooRuleBase


        typeCache.put( name, wrapper );
    }

    public void init( WorkingMemory wm ) {
        needsInit = false;
        ReteooRuleBase rb = (ReteooRuleBase) wm.getRuleBase();
        for ( TypeWrapper wrapper : typeCache.values() ) {
            if ( wrapper.getKlass() == null ) {
                try {
                    wrapper.setKlass( Class.forName( wrapper.getName(), false, rb.getRootClassLoader() ) );
                } catch ( ClassNotFoundException e ) {
                    e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                }
            }
        }
View Full Code Here


        }

    }

    public static TraitFactory getTraitBuilderForKnowledgeBase( KieBase kb ) {
        ReteooRuleBase arb = (ReteooRuleBase) ((KnowledgeBaseImpl) kb ).getRuleBase();
        return arb.getConfiguration().getComponentFactory().getTraitFactory();
    }
View Full Code Here

        public void execute(InternalWorkingMemory workingMemory) {
            PropagationContextFactory pctxFactory = ((InternalRuleBase) workingMemory.getRuleBase()).getConfiguration().getComponentFactory().getPropagationContextFactory();

            final PropagationContext context = pctxFactory.createPropagationContext(workingMemory.getNextPropagationIdCounter(), PropagationContext.INSERTION,
                                                                                    this.ruleOrigin, this.leftTuple, this.factHandle);
            ReteooRuleBase ruleBase = (ReteooRuleBase) workingMemory.getRuleBase();
            ruleBase.assertObject( this.factHandle,
                                   this.factHandle.getObject(),
                                   context,
                                   workingMemory );
            context.evaluateActionQueue( workingMemory );
        }
View Full Code Here

        public void execute(InternalWorkingMemory workingMemory) {
            PropagationContextFactory pctxFactory = ((InternalRuleBase) workingMemory.getRuleBase()).getConfiguration().getComponentFactory().getPropagationContextFactory();

            final PropagationContext context = pctxFactory.createPropagationContext(workingMemory.getNextPropagationIdCounter(), PropagationContext.INSERTION,
                                                                                    this.ruleOrigin, this.leftTuple, this.factHandle);
            ReteooRuleBase ruleBase = (ReteooRuleBase) workingMemory.getRuleBase();
            ruleBase.assertObject( this.factHandle,
                                   this.factHandle.getObject(),
                                   context,
                                   workingMemory );
            context.evaluateActionQueue( workingMemory );
        }
View Full Code Here

        context.put( "TestCase",
                     testCase );

        RuleBaseConfiguration conf = new RuleBaseConfiguration();

        ReteooRuleBase rbase = new ReteooRuleBase( "ID",
                                                   conf );
        BuildContext buildContext = new BuildContext( rbase,
                                                      rbase.getReteooBuilder().getIdGenerator() );

        Rule rule = new Rule("rule1", "org.pkg1", null);
        org.drools.core.rule.Package pkg = new org.drools.core.rule.Package( "org.pkg1" );
        pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() );
        pkg.addRule( rule );
       
        buildContext.setRule( rule );

        pctxFactory = conf.getComponentFactory().getPropagationContextFactory();
       
        rbase.addPackage( pkg );
        context.put( BUILD_CONTEXT,
                     buildContext );
        context.put( "ClassFieldAccessorStore",
                     this.reteTesterHelper.getStore() );

        InternalWorkingMemory wm = (InternalWorkingMemory) rbase.newStatefulSession( true );
        context.put( WORKING_MEMORY,
                     wm );
        return context;
    }
View Full Code Here

        for (String[] configOption : args) {
            conf.setProperty(configOption[0], configOption[1]);
        }

        ReteooRuleBase rbase = new ReteooRuleBase("ID", conf);
        BuildContext buildContext = new BuildContext(rbase, rbase
                .getReteooBuilder().getIdGenerator());

        InternalWorkingMemory wm = (InternalWorkingMemory) rbase
                .newStatefulSession(true);

        // Overwrite values now taking into account the configuration options.
        context.put(BUILD_CONTEXT, buildContext);
        context.put(WORKING_MEMORY, wm);
View Full Code Here

        Map<String, Object> map = result.context;

        JoinNode join1 = (JoinNode) map.get( "join1" );
        assertNotNull( join1 );

        ReteooRuleBase rbase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();

        PropagationContextFactory pctxFactory = rbase.getConfiguration().getComponentFactory().getPropagationContextFactory();

        PropagationContext context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null);
        AbstractWorkingMemory workingMemory = new AbstractWorkingMemory( 1, rbase );

        BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( join1 );
View Full Code Here

public class RuleTest {

    @Test
    public void testDateEffective() {
        WorkingMemory wm = new ReteooRuleBase("x", null).newStatefulSession();

        final Rule rule = new Rule( "myrule" );

        assertTrue( rule.isEffective(null, new RuleTerminalNode(), wm ) );
View Full Code Here

    }

    @Test
    public void testDateExpires() throws Exception {
        WorkingMemory wm = new ReteooRuleBase("x", null).newStatefulSession();
       
        final Rule rule = new Rule( "myrule" );

        assertTrue( rule.isEffective(null, new RuleTerminalNode(), wm ) );
View Full Code Here

    }

    @Test
    public void testDateEffectiveExpires() {
        WorkingMemory wm = new ReteooRuleBase("x",null).newStatefulSession();
       
        final Rule rule = new Rule( "myrule" );

        final Calendar past = Calendar.getInstance();
        past.setTimeInMillis( 10 );
View Full Code Here

TOP

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

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.