Package org.drools.base.evaluators

Examples of org.drools.base.evaluators.AfterEvaluatorDefinition


                                                { new Interval(-2,3), new Interval(0,2), new Interval(0, 0), new Interval(2, 3), new Interval(3, 13) },
                                                { new Interval(-4,1), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(1, 10) },
                                                { new Interval(-14,0), new Interval(-12,-2), new Interval(-13,-3), new Interval(-10, -1), new Interval(0,0) }
                                        };

        AfterEvaluatorDefinition evals = new AfterEvaluatorDefinition();
        ClassObjectType ot = new ClassObjectType(StockTick.class, true);
       
        Pattern a = new Pattern( 0, ot, "$a" );
        Pattern b = new Pattern( 1, ot, "$b" );
        b.addConstraint( new VariableConstraint(
                         new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                         new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                AfterEvaluatorDefinition.AFTER,
                                                                                                "-2,2" ) ) ) );
        Pattern c = new Pattern( 2, ot, "$c" );
        c.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "-3,4" ) ) ) );
        Pattern d = new Pattern( 3, ot, "$d" );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, b.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,2" ) ) ) );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, c.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "2,3" ) ) ) );
        Pattern e = new Pattern( 4, ot, "$e" );
        e.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, d.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,10" ) ) ) );

        GroupElement not = new GroupElement( Type.NOT );
        not.addChild( e );
View Full Code Here


                                                { new Interval(-2,3), new Interval(0,2), new Interval(0, 0), new Interval(2, 3), new Interval(3, 13) },
                                                { new Interval(-4,1), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(1, 10) },
                                                { new Interval(-14,0), new Interval(-12,-2), new Interval(-13,-3), new Interval(-10, -1), new Interval(0,0) }
                                        };

        AfterEvaluatorDefinition evals = new AfterEvaluatorDefinition();
        ClassObjectType ot = new ClassObjectType(StockTick.class, true);
       
        Pattern a = new Pattern( 0, ot, "$a" );
        Pattern b = new Pattern( 1, ot, "$b" );

        b.addConstraint( new EvaluatorConstraint( new Declaration[] { a.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "-2,2"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        Pattern c = new Pattern( 2, ot, "$c" );
        c.addConstraint( new EvaluatorConstraint( new Declaration[] { a.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "-3,4"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        Pattern d = new Pattern( 3, ot, "$d" );
        d.addConstraint( new EvaluatorConstraint( new Declaration[] { b.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "1,2"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        d.addConstraint( new EvaluatorConstraint( new Declaration[] { c.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "2,3"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        Pattern e = new Pattern( 4, ot, "$e" );
        e.addConstraint(new EvaluatorConstraint(new Declaration[]{d.getDeclaration()},
                evals.getEvaluator(ValueType.OBJECT_TYPE,
                        AfterEvaluatorDefinition.AFTER,
                        "1,10"),
                new SelfReferenceClassFieldReader(StockTick.class, "this")));

        GroupElement not = new GroupElement( Type.NOT );
View Full Code Here

                                                { new Interval(-2,3), new Interval(0,2), new Interval(0, 0), new Interval(2, 3), new Interval(3, 13) },
                                                { new Interval(-4,1), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(1, 10) },
                                                { new Interval(-14,0), new Interval(-12,-2), new Interval(-13,-3), new Interval(-10, -1), new Interval(0,0) }
                                        };

        AfterEvaluatorDefinition evals = new AfterEvaluatorDefinition();
        ClassObjectType ot = new ClassObjectType(StockTick.class, true);
       
        Pattern a = new Pattern( 0, ot, "$a" );
        Pattern b = new Pattern( 1, ot, "$b" );
        b.addConstraint( new VariableConstraint(
                         new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                         new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                AfterEvaluatorDefinition.AFTER,
                                                                                                "-2,2" ) ) ) );
        Pattern c = new Pattern( 2, ot, "$c" );
        c.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "-3,4" ) ) ) );
        Pattern d = new Pattern( 3, ot, "$d" );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, b.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,2" ) ) ) );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, c.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "2,3" ) ) ) );
        Pattern e = new Pattern( 4, ot, "$e" );
        e.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, d.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,10" ) ) ) );

        GroupElement not = new GroupElement( Type.NOT );
        not.addChild( e );
View Full Code Here

    }
   
    @Test
    public void testEvaluatorConfiguration() {
        // in this use case, the application already has the instance of the evaluator definition
        EvaluatorDefinition afterDef = new AfterEvaluatorDefinition();
        assertNotNull( afterDef );
       
        // creating the option and storing in a local var just to make test easier
        EvaluatorOption option = EvaluatorOption.get( "after", afterDef );
       
View Full Code Here

                      config.getProperty( DumpDirOption.PROPERTY_NAME ) );
    }
   
    public void testEvaluatorConfiguration() {
        // in this use case, the application already has the instance of the evaluator definition
        EvaluatorDefinition afterDef = new AfterEvaluatorDefinition();
        assertNotNull( afterDef );
       
        // creating the option and storing in a local var just to make test easier
        EvaluatorOption option = EvaluatorOption.get( "after", afterDef );
       
View Full Code Here

                      config.getProperty( DumpDirOption.PROPERTY_NAME ) );
    }
   
    public void testEvaluatorConfiguration() {
        // in this use case, the application already has the instance of the evaluator definition
        EvaluatorDefinition afterDef = new AfterEvaluatorDefinition();
        assertNotNull( afterDef );
       
        // creating the option and storing in a local var just to make test easier
        EvaluatorOption option = EvaluatorOption.get( "after", afterDef );
       
View Full Code Here

                                                { new Interval(-2,3), new Interval(0,2), new Interval(0, 0), new Interval(2, 3), new Interval(3, 13) },
                                                { new Interval(-4,1), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(1, 10) },
                                                { new Interval(-14,0), new Interval(-12,-2), new Interval(-13,-3), new Interval(-10, -1), new Interval(0,0) }
                                        };

        AfterEvaluatorDefinition evals = new AfterEvaluatorDefinition();
        ClassObjectType ot = new ClassObjectType(StockTick.class, true);
       
        Pattern a = new Pattern( 0, ot, "$a" );
        Pattern b = new Pattern( 1, ot, "$b" );
        b.addConstraint( new VariableConstraint(
                         new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                         new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                AfterEvaluatorDefinition.AFTER,
                                                                                                "-2,2" ) ) ) );
        Pattern c = new Pattern( 2, ot, "$c" );
        c.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, a.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "-3,4" ) ) ) );
        Pattern d = new Pattern( 3, ot, "$d" );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, b.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,2" ) ) ) );
        d.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, c.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "2,3" ) ) ) );
        Pattern e = new Pattern( 4, ot, "$e" );
        e.addConstraint( new VariableConstraint(
                                                new SelfReferenceClassFieldReader( StockTick.class, "this" ),
                                                new VariableRestriction( null, d.getDeclaration(), evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                                                                       AfterEvaluatorDefinition.AFTER,
                                                                                                                       "1,10" ) ) ) );

        GroupElement not = new GroupElement( Type.NOT );
        not.addChild( e );
View Full Code Here

                      config.getProperty( DumpDirOption.PROPERTY_NAME ) );
    }
   
    public void testEvaluatorConfiguration() {
        // in this use case, the application already has the instance of the evaluator definition
        EvaluatorDefinition afterDef = new AfterEvaluatorDefinition();
        assertNotNull( afterDef );
       
        // creating the option and storing in a local var just to make test easier
        EvaluatorOption option = EvaluatorOption.get( "after", afterDef );
       
View Full Code Here

                                                { new Interval(-2,3), new Interval(0,2), new Interval(0, 0), new Interval(2, 3), new Interval(3, 13) },
                                                { new Interval(-4,1), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(1, 10) },
                                                { new Interval(-14,0), new Interval(-12,-2), new Interval(-13,-3), new Interval(-10, -1), new Interval(0,0) }
                                        };

        AfterEvaluatorDefinition evals = new AfterEvaluatorDefinition();
        ClassObjectType ot = new ClassObjectType(StockTick.class, true);
       
        Pattern a = new Pattern( 0, ot, "$a" );
        Pattern b = new Pattern( 1, ot, "$b" );

        b.addConstraint( new EvaluatorConstraint( new Declaration[] { a.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "-2,2"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        Pattern c = new Pattern( 2, ot, "$c" );
        c.addConstraint( new EvaluatorConstraint( new Declaration[] { a.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "-3,4"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        Pattern d = new Pattern( 3, ot, "$d" );
        d.addConstraint( new EvaluatorConstraint( new Declaration[] { b.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "1,2"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        d.addConstraint( new EvaluatorConstraint( new Declaration[] { c.getDeclaration() },
                                                  evals.getEvaluator( ValueType.OBJECT_TYPE,
                                                                      AfterEvaluatorDefinition.AFTER,
                                                                      "2,3"),
                                                  new SelfReferenceClassFieldReader( StockTick.class, "this" ) ) );

        Pattern e = new Pattern( 4, ot, "$e" );
        e.addConstraint(new EvaluatorConstraint(new Declaration[]{d.getDeclaration()},
                evals.getEvaluator(ValueType.OBJECT_TYPE,
                        AfterEvaluatorDefinition.AFTER,
                        "1,10"),
                new SelfReferenceClassFieldReader(StockTick.class, "this")));

        GroupElement not = new GroupElement( Type.NOT );
View Full Code Here

TOP

Related Classes of org.drools.base.evaluators.AfterEvaluatorDefinition

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.