Package org.drools.spi

Examples of org.drools.spi.ReturnValueExpression


        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            /**
             *
             */
            private static final long serialVersionUID = 400L;

View Full Code Here


        Rule rule3 = ((KnowledgePackageImp)pkg3).pkg.getRule( "rule1" );
       
        // test return value
        Pattern p1 = ( Pattern ) rule1.getLhs().getChildren().get( 0 );
        VariableConstraint rvc1 = ( VariableConstraint ) p1.getConstraints().get( 0 );       
        ReturnValueExpression rve1 = ((ReturnValueRestriction) rvc1.getRestriction()).getExpression();
       
        Pattern p2 = ( Pattern ) rule2.getLhs().getChildren().get( 0 );       
        VariableConstraint rvc2 = ( VariableConstraint ) p2.getConstraints().get( 0 );       
        ReturnValueExpression rve2 = ((ReturnValueRestriction) rvc2.getRestriction()).getExpression();       
       
        assertNotSame( rve1, rve2 );
        assertEquals( rve1, rve2 );
       
        Pattern p3 = ( Pattern ) rule3.getLhs().getChildren().get( 0 );
        VariableConstraint rvc3 = ( VariableConstraint ) p3.getConstraints().get( 0 );       
        ReturnValueExpression rve3 = ((ReturnValueRestriction) rvc3.getRestriction()).getExpression();
       
        assertNotSame( rve1, rve3 );
        assertThat(rve1, not( equalTo( rve3 ) ) );
       
        // test inline eval
View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            private static final long serialVersionUID = 510l;

            public FieldValue evaluate(Object object,
                                       Tuple tuple, // ?price
                                       Declaration[] previousDeclarations,
View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            /**
             *
             */
            private static final long serialVersionUID = 400L;

View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            private static final long serialVersionUID = 510l;

            public FieldValue evaluate(Object object,
                                       Tuple tuple, // ?price
                                       Declaration[] previousDeclarations,
View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            /**
             *
             */
            private static final long serialVersionUID = 400L;

View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            /**
             *
             */
            private static final long serialVersionUID = 400L;

View Full Code Here

        Rule rule3 = ((KnowledgePackageImp)pkg3).pkg.getRule( "rule1" );              
       
        // test return value
        Pattern p1 = ( Pattern ) rule1.getLhs().getChildren().get( 0 );
        ReturnValueConstraint rvc1 = ( ReturnValueConstraint ) p1.getConstraints().get( 1 );
        ReturnValueExpression rve1 = rvc1.getExpression();
       
        Pattern p2 = ( Pattern ) rule2.getLhs().getChildren().get( 0 );
        ReturnValueConstraint rvc2 = ( ReturnValueConstraint ) p2.getConstraints().get( 1 );
        ReturnValueExpression rve2 = rvc2.getExpression();
        assertNotSame( rve1, rve2 );
        assertEquals( rve1, rve2 );
       
        Pattern p3 = ( Pattern ) rule3.getLhs().getChildren().get( 0 );
        ReturnValueConstraint rvc3 = ( ReturnValueConstraint ) p3.getConstraints().get( 1 );
        ReturnValueExpression rve3 = rvc3.getExpression();               
        assertNotSame( rve1, rve3 );
        assertThat(rve1, not( equalTo( rve3 ) ) );
       
        // test inline eval
        PredicateConstraint pc1 = ( PredicateConstraint p1.getConstraints().get( 2 );
View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            /**
             *
             */
            private static final long serialVersionUID = 510l;

View Full Code Here

        // Declarations know the pattern they derive their value form
        final Declaration priceDeclaration = new Declaration( "price1",
                                                              priceExtractor,
                                                              pattern );

        final ReturnValueExpression isDoubleThePrice = new ReturnValueExpression() {
            private static final long serialVersionUID = 510l;

            public FieldValue evaluate(Object object,
                                       Tuple tuple, // ?price
                                       Declaration[] previousDeclarations,
View Full Code Here

TOP

Related Classes of org.drools.spi.ReturnValueExpression

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.