Package org.drools.lang.descr

Examples of org.drools.lang.descr.PredicateDescr


                                          Map<String, OperatorDescr> aliases ) {
        Dialect dialect = context.getDialect();
        MVELDialect mvelDialect = (MVELDialect) context.getDialect( "mvel" );
        context.setDialect( mvelDialect );

        PredicateDescr pdescr = new PredicateDescr( expr );
        pdescr.copyLocation( base );
        buildEval( context,
                   pattern,
                   pdescr,
                   null,
                   aliases );
View Full Code Here


        assertEquals( "==",
                      variableDescr.getEvaluator() );
        assertEquals( "var1",
                      variableDescr.getIdentifier() );

        final PredicateDescr predicateDescr = (PredicateDescr) pattern3.getDescrs().get( 1 );
        assertEquals( "1==1",
                      predicateDescr.getContent() );

        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) pattern3.getDescrs().get( 2 );
        assertEquals( "field1",
                      fieldBindingDescr.getFieldName() );
        assertEquals( "var1",
View Full Code Here

        AndDescr and = (AndDescr) col.getConstraint();
        assertEquals( 2,
                      and.getDescrs().size() );

        final FieldBindingDescr field = (FieldBindingDescr) and.getDescrs().get( 0 );
        final PredicateDescr pred = (PredicateDescr) and.getDescrs().get( 1 );
        assertEquals( "age",
                      field.getFieldName() );
        assertEquals( "$age2",
                      field.getIdentifier() );
        assertEqualsIgnoreWhitespace( "$age2 == $age1+2",
                                      (String) pred.getContent() );

        assertFalse( parser.getErrorMessages().toString(),
                     parser.hasErrors() );
    }
View Full Code Here

        final List constraints = pattern.getConstraint().getDescrs();
        assertEquals( 2,
                      constraints.size() );

        final FieldBindingDescr field = (FieldBindingDescr) constraints.get( 0 );
        final PredicateDescr predicate = (PredicateDescr) constraints.get( 1 );
        assertEquals( "$var",
                      field.getIdentifier() );
        assertEquals( "attr",
                      field.getFieldName() );
        assertEquals( " $var.equals(\"xyz\") ",
                      predicate.getContent() );
    }
View Full Code Here

        final List constraints = pattern.getConstraint().getDescrs();
        assertEquals( 1,
                      constraints.size() );

        final PredicateDescr predicate = (PredicateDescr) constraints.get( 0 );
        assertEquals( " $var.equals(\"xyz\") ",
                      predicate.getContent() );
    }
View Full Code Here

        AndDescr and = (AndDescr) col.getConstraint();
        assertEquals( 2,
                      and.getDescrs().size() );

        final FieldBindingDescr field = (FieldBindingDescr) and.getDescrs().get( 0 );
        final PredicateDescr pred = (PredicateDescr) and.getDescrs().get( 1 );
        assertEquals( "age",
                      field.getFieldName() );
        assertEquals( "$age2",
                      field.getIdentifier() );
        assertEqualsIgnoreWhitespace( "$age2 == $age1+2",
                                      (String) pred.getContent() );

        assertFalse( parser.getErrorMessages().toString(),
                     parser.hasErrors() );
    }
View Full Code Here

        final List constraints = pattern.getConstraint().getDescrs();
        assertEquals( 2,
                      constraints.size() );

        final FieldBindingDescr field = (FieldBindingDescr) constraints.get( 0 );
        final PredicateDescr predicate = (PredicateDescr) constraints.get( 1 );
        assertEquals( "$var",
                      field.getIdentifier() );
        assertEquals( "attr",
                      field.getFieldName() );
        assertEquals( " $var.equals(\"xyz\") ",
                      predicate.getContent() );
    }
View Full Code Here

        final List constraints = pattern.getConstraint().getDescrs();
        assertEquals( 1,
                      constraints.size() );

        final PredicateDescr predicate = (PredicateDescr) constraints.get( 0 );
        assertEquals( " $var.equals(\"xyz\") ",
                      predicate.getContent() );
    }
View Full Code Here

        pattern.addConstraint( fieldBindingDescr2 );

        packageDescr.addGlobal( new GlobalDescr( "map",
                                                 "java.util.Map" ) );

        final PredicateDescr predicate = new PredicateDescr( "( ( Integer )map.get( new Integer(x) ) ).intValue() == y" );
        pattern.addConstraint( predicate );

        ruleDescr.setConsequence( "update(stilton);" );

        builder.addPackage( packageDescr );
View Full Code Here

        pattern.addConstraint( fieldBindingDescr2 );

        packageDescr.addGlobal( new GlobalDescr( "map",
                                                 "java.util.Map" ) );

        final PredicateDescr predicate = new PredicateDescr( expression );
        pattern.addConstraint( predicate );

        ruleDescr.setConsequence( "update(stilton);" );
    }
View Full Code Here

TOP

Related Classes of org.drools.lang.descr.PredicateDescr

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.