Package org.drools.core.rule

Examples of org.drools.core.rule.EvalCondition


                                                                       null,
                                                                       context,
                                                                       "drools",
                                                                       KnowledgeHelper.class,
                                                                       false );
            final EvalCondition eval = new EvalCondition( previousDeclarations );

            MVELEvalExpression expr = new MVELEvalExpression( unit,
                                                              dialect.getId() );
            eval.setEvalExpression( KiePolicyHelper.isPolicyEnabled() ? new SafeEvalExpression(expr) : expr );

            MVELDialectRuntimeData data = (MVELDialectRuntimeData) context.getPkg().getDialectRuntimeRegistry().getDialectData( "mvel" );
            data.addCompileable( eval,
                                  expr );
View Full Code Here


        assertLength( 0,
                      builder.getErrors().getErrors() );

        InternalKnowledgePackage pkg = builder.getPackage();
        final RuleImpl rule = pkg.getRule( "rule-1" );
        final EvalCondition eval = (EvalCondition) rule.getLhs().getChildren().get( 1 );
        final CompiledInvoker invoker = (CompiledInvoker) eval.getEvalExpression();
        final List list = invoker.getMethodBytecode();
    }
View Full Code Here

        final KnowledgeBuilderImpl builder1 = new KnowledgeBuilderImpl();
        final PackageDescr packageDescr1 = new PackageDescr( "package1" );
        createEvalRule( packageDescr1,
                        "1==1" );
        builder1.addPackage( packageDescr1 );
        final EvalCondition eval1 = (EvalCondition) ((RuleImpl)builder1.getPackage().getRules().iterator().next()).getLhs().getChildren().get( 0 );

        final KnowledgeBuilderImpl builder2 = new KnowledgeBuilderImpl();
        final PackageDescr packageDescr2 = new PackageDescr( "package2" );
        createEvalRule( packageDescr2,
                        "1==1" );
        builder2.addPackage( packageDescr2 );
        final EvalCondition eval2 = (EvalCondition) ((RuleImpl)builder2.getPackage().getRules().iterator().next()).getLhs().getChildren().get( 0 );

        final KnowledgeBuilderImpl builder3 = new KnowledgeBuilderImpl();
        final PackageDescr packageDescr3 = new PackageDescr( "package3" );
        createEvalRule( packageDescr3,
                        "1==3" );
        builder3.addPackage( packageDescr3 );
        final EvalCondition eval3 = (EvalCondition) ((RuleImpl)builder3.getPackage().getRules().iterator().next()).getLhs().getChildren().get( 0 );

        assertEquals( eval1,
                      eval2 );
        assertFalse( eval1.equals( eval3 ) );
        assertFalse( eval2.equals( eval3 ) );
View Full Code Here

                              EvalMemory em,
                              LeftTupleSink sink,
                              InternalWorkingMemory wm,
                              LeftTupleSets srcLeftTuples,
                              LeftTupleSets trgLeftTuples) {
        EvalCondition condition = evalNode.getCondition();
        for (LeftTuple leftTuple = srcLeftTuples.getInsertFirst(); leftTuple != null; ) {
            LeftTuple next = leftTuple.getStagedNext();

            final boolean allowed = condition.isAllowed(leftTuple,
                                                        wm,
                                                        em.context);

            if (allowed) {
                boolean useLeftMemory = RuleNetworkEvaluator.useLeftMemory(evalNode, leftTuple);
View Full Code Here

                              LeftTupleSink sink,
                              InternalWorkingMemory wm,
                              LeftTupleSets srcLeftTuples,
                              LeftTupleSets trgLeftTuples,
                              LeftTupleSets stagedLeftTuples) {
        EvalCondition condition = evalNode.getCondition();
        for (LeftTuple leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) {
            LeftTuple next = leftTuple.getStagedNext();

            boolean wasPropagated = leftTuple.getFirstChild() != null && leftTuple.getObject() != EVAL_LEFT_TUPLE_DELETED;

            boolean allowed = condition.isAllowed(leftTuple,
                                                  wm,
                                                  em.context);
            if (allowed) {
                leftTuple.setObject(null);
View Full Code Here

     */
    public void build(final BuildContext context,
                      final BuildUtils utils,
                      final RuleConditionElement rce) {

        final EvalCondition eval = (EvalCondition) rce;
        context.pushRuleComponent( rce );
        utils.checkUnboundDeclarations( context,
                                        eval.getRequiredDeclarations() );
        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                    context.getComponentFactory()
                                                                           .getNodeFactoryService()
                                                                           .buildEvalNode( context.getNextId(),
                                                                                           context.getTupleSource(),
View Full Code Here

        assertLength( 0,
                      builder.getErrors().getErrors() );

        InternalKnowledgePackage pkg = builder.getPackage();
        final RuleImpl rule = pkg.getRule( "rule-1" );
        final EvalCondition eval = (EvalCondition) rule.getLhs().getChildren().get( 1 );
        final CompiledInvoker invoker = (CompiledInvoker) eval.getEvalExpression();
        final List list = invoker.getMethodBytecode();
    }
View Full Code Here

        final KnowledgeBuilderImpl builder1 = new KnowledgeBuilderImpl();
        final PackageDescr packageDescr1 = new PackageDescr( "package1" );
        createEvalRule( packageDescr1,
                        "1==1" );
        builder1.addPackage( packageDescr1 );
        final EvalCondition eval1 = (EvalCondition) ((RuleImpl)builder1.getPackage().getRules().iterator().next()).getLhs().getChildren().get( 0 );

        final KnowledgeBuilderImpl builder2 = new KnowledgeBuilderImpl();
        final PackageDescr packageDescr2 = new PackageDescr( "package2" );
        createEvalRule( packageDescr2,
                        "1==1" );
        builder2.addPackage( packageDescr2 );
        final EvalCondition eval2 = (EvalCondition) ((RuleImpl)builder2.getPackage().getRules().iterator().next()).getLhs().getChildren().get( 0 );

        final KnowledgeBuilderImpl builder3 = new KnowledgeBuilderImpl();
        final PackageDescr packageDescr3 = new PackageDescr( "package3" );
        createEvalRule( packageDescr3,
                        "1==3" );
        builder3.addPackage( packageDescr3 );
        final EvalCondition eval3 = (EvalCondition) ((RuleImpl)builder3.getPackage().getRules().iterator().next()).getLhs().getChildren().get( 0 );

        assertEquals( eval1,
                      eval2 );
        assertFalse( eval1.equals( eval3 ) );
        assertFalse( eval2.equals( eval3 ) );
View Full Code Here

            pnode = Mockito.mock( LeftTupleSource.class );
        } else {
            pnode = (LeftTupleSource) context.get( source );
        }

        EvalCondition eval = new EvalCondition( new InstrumentedEvalExpression( expr,
                                                                                context ),
                                                new Declaration[0] );
        EvalConditionNode evalNode = new EvalConditionNode( buildContext.getNextId(),
                                                            pnode,
                                                            eval,
View Full Code Here

     */
    public void build(final BuildContext context,
                      final BuildUtils utils,
                      final RuleConditionElement rce) {

        final EvalCondition eval = (EvalCondition) rce;
        context.pushRuleComponent( rce );
        utils.checkUnboundDeclarations( context,
                                        eval.getRequiredDeclarations() );
        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                new EvalConditionNode( context.getNextId(),
                                                                                       context.getTupleSource(),
                                                                                       eval,
                                                                                       context ) ) );
View Full Code Here

TOP

Related Classes of org.drools.core.rule.EvalCondition

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.