Package org.drools.lang.descr

Examples of org.drools.lang.descr.FieldBindingDescr


        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
                                                       "stilton" );
        lhs.addDescr( pattern );

        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
                                                                           "x" );
        pattern.addConstraint( fieldBindingDescr );

        final FieldBindingDescr fieldBindingDescr2 = new FieldBindingDescr( "price",
                                                                            "y" );
        pattern.addConstraint( fieldBindingDescr2 );

        packageDescr.addGlobal( new GlobalDescr( "map",
                                                 "java.util.Map" ) );
View Full Code Here


        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
                                                       "stilton" );
        lhs.addDescr( pattern );

        FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
                                                                     "x" );
        pattern.addConstraint( fieldBindingDescr );
        fieldBindingDescr = new FieldBindingDescr( "price",
                                                   "y" );
        pattern.addConstraint( fieldBindingDescr );

        packageDescr.addGlobal( new GlobalDescr( "map",
                                                 "java.util.Map" ) );
View Full Code Here

        ruleDescr.setLhs( lhs );

        final PatternDescr pattern1 = new PatternDescr( Cheese.class.getName() );
        lhs.addDescr( pattern1 );

        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "type",
                                                                           "$type" );

        final FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
        literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
                                                                  "stilton" ) );
View Full Code Here

        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
                                                       "stilton" );
        lhs.addDescr( pattern );

        FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
                                                                     "x" );
        pattern.addConstraint( fieldBindingDescr );
        fieldBindingDescr = new FieldBindingDescr( "price",
                                                   "y" );
        pattern.addConstraint( fieldBindingDescr );

        packageDescr.addGlobal( new GlobalDescr( "map",
                                                 "java.util.Map" ) );
View Full Code Here

        final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
                                                       "stilton" );
        lhs.addDescr( pattern );

        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( "price",
                                                                           "x" );
        pattern.addConstraint( fieldBindingDescr );

        final FieldBindingDescr fieldBindingDescr2 = new FieldBindingDescr( "price",
                                                                            "y" );
        pattern.addConstraint( fieldBindingDescr2 );

        packageDescr.addGlobal( new GlobalDescr( "map",
                                                 "java.util.Map" ) );
View Full Code Here

        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",
                      fieldBindingDescr.getIdentifier() );

        final NotDescr notDescr = (NotDescr) lhsDescr.getDescrs().get( 5 );
        assertEquals( 1,
                      notDescr.getDescrs().size() );
        PatternDescr patternDescr = (PatternDescr) notDescr.getDescrs().get( 0 );
View Full Code Here

            if ( previous == null ) {
                descrString += this.template;
            } else if ( previous instanceof FieldBindingDescr && !(temp instanceof FieldBindingDescr) && !(temp instanceof PredicateDescr) ) {
                final FieldConstraintDescr tempDescr = (FieldConstraintDescr) temp;
                final FieldBindingDescr previousDescr = (FieldBindingDescr) previous;
                if ( tempDescr.getFieldName().equals( previousDescr.getFieldName() ) ) {
                    // as its a binding followed by a field constraint we need to remove
                    // the extra field name                   
                    descrString += this.template.substring( tempDescr.getFieldName().length() + 1 );
                } else {
                    descrString += " , " + this.template;
View Full Code Here

        final String fieldName = attrs.getValue( "field-name" );
       
        emptyAttributeCheck( localName, "identifier", identifier, parser );       
        emptyAttributeCheck( localName, "fieldName", fieldName, parser );

        final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( fieldName,
                                                                           identifier );

        return fieldBindingDescr;
    }
View Full Code Here

    public Object end(final String uri,
                      final String localName,
                      final ExtensibleXmlParser parser) throws SAXException {
        final Element element = parser.endElementBuilder();

        final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) parser.getCurrent();

        final PatternDescr patternDescr = (PatternDescr) parser.getParent( );

        patternDescr.addConstraint( fieldBindingDescr );
View Full Code Here

            if ( previous == null ) {
                descrString += this.template;
            } else if ( previous instanceof FieldBindingDescr && !(temp instanceof FieldBindingDescr) && !(temp instanceof PredicateDescr) ) {
                final FieldConstraintDescr tempDescr = (FieldConstraintDescr) temp;
                final FieldBindingDescr previousDescr = (FieldBindingDescr) previous;
                if ( tempDescr.getFieldName().equals( previousDescr.getFieldName() ) ) {
                    // as its a binding followed by a field constraint we need to remove
                    // the extra field name                   
                    descrString += this.template.substring( tempDescr.getFieldName().length() + 1 );
                } else {
                    descrString += " , " + this.template;
View Full Code Here

TOP

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

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.