Package org.drools.lang.descr

Examples of org.drools.lang.descr.RestrictionConnectiveDescr


        AndDescr andConstr1 = (AndDescr) orConstr.getDescrs().get( 0 );

        FieldConstraintDescr fcd = (FieldConstraintDescr) andConstr1.getDescrs().get( 0 );
        assertEquals( "age",
                      fcd.getFieldName() );
        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fcd.getRestriction().getRestrictions().get( 0 );
        RestrictionConnectiveDescr and1 = (RestrictionConnectiveDescr) or.getRestrictions().get( 0 );
        RestrictionConnectiveDescr and2 = (RestrictionConnectiveDescr) or.getRestrictions().get( 1 );

        assertEquals( ">",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 0 )).getEvaluator() );
        assertEquals( "60",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 0 )).getText() );

        assertEquals( "<",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 1 )).getEvaluator() );
        assertEquals( "70",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 1 )).getText() );

        assertEquals( ">",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 0 )).getEvaluator() );
        assertEquals( "50",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 0 )).getText() );

        assertEquals( "<",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 1 )).getEvaluator() );
        assertEquals( "55",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 1 )).getText() );

        fcd = (FieldConstraintDescr) andConstr1.getDescrs().get( 1 );
        assertEquals( "hair",
                      fcd.getFieldName() );
View Full Code Here


        fld = (FieldConstraintDescr) and.getDescrs().get( 0 );
        assertEquals( "type",
                      fld.getFieldName() );
        assertEquals( 1,
                      fld.getRestrictions().size() );
        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fld.getRestrictions().get( 0 );
        assertEquals( RestrictionConnectiveDescr.OR,
                      or.getConnective() );
        assertEquals( 2,
                      or.getRestrictions().size() );
        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 0 );
        assertEquals( "==",
                      lit.getEvaluator() );
        assertEquals( "sedan",
                      lit.getText() );

        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 1 );
        assertEquals( "==",
                      lit.getEvaluator() );
        assertEquals( "wagon",
                      lit.getText() );
View Full Code Here

        assertEquals( "type",
                      fld.getFieldName() );
        assertEquals( 1,
                      fld.getRestrictions().size() );

        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fld.getRestrictions().get( 0 );
        assertEquals( RestrictionConnectiveDescr.OR,
                      or.getConnective() );
        assertEquals( 2,
                      or.getRestrictions().size() );

        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 0 );
        assertEquals( "==",
                      lit.getEvaluator() );
        assertEquals( "sedan",
                      lit.getText() );

        lit = (LiteralRestrictionDescr) or.getRestrictions().get( 1 );
        assertEquals( "==",
                      lit.getEvaluator() );
        assertEquals( "wagon",
                      lit.getText() );
View Full Code Here

        if ( parent instanceof FieldConstraintDescr ) {
            final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parent;
            fieldConstraintDescr.addRestriction( returnValueDescr );
        } else if ( parent instanceof RestrictionConnectiveDescr ) {
            final RestrictionConnectiveDescr rcDescr = (RestrictionConnectiveDescr) parent;
            rcDescr.addRestriction( returnValueDescr );
        }
        return returnValueDescr;
    }
View Full Code Here

        if ( parent instanceof FieldConstraintDescr ) {
            final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parent;
            fieldConstraintDescr.addRestriction( variableDescr );
        } else if ( parent instanceof RestrictionConnectiveDescr ) {
            final RestrictionConnectiveDescr restrictionConDescr = (RestrictionConnectiveDescr) parent;
            restrictionConDescr.addRestriction( variableDescr );
        }

        return variableDescr;
    }
View Full Code Here

        if ( parent instanceof FieldConstraintDescr ) {
            final FieldConstraintDescr fieldConstriantDescr = (FieldConstraintDescr) parent;
            fieldConstriantDescr.addRestriction( literalDescr );
        } else if ( parent instanceof RestrictionConnectiveDescr ) {
            final RestrictionConnectiveDescr restrictionDescr = (RestrictionConnectiveDescr) parent;
            restrictionDescr.addRestriction( literalDescr );
        }
        return literalDescr;
    }
View Full Code Here

        if ( parent instanceof FieldConstraintDescr ) {
            final FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) parent;
            fieldConstraintDescr.addRestriction( qualifiedIdentifierRestricionDescr );
        } else if ( parent instanceof RestrictionConnectiveDescr ) {
            final RestrictionConnectiveDescr restrictionConDescr = (RestrictionConnectiveDescr) parent;
            restrictionConDescr.addRestriction( qualifiedIdentifierRestricionDescr );
        }
        return qualifiedIdentifierRestricionDescr;
    }
View Full Code Here

                        final Attributes attrs,
                        final ExtensibleXmlParser parser) throws SAXException {
        parser.startElementBuilder( localName,
                                    attrs );

        RestrictionConnectiveDescr connectiveDescr = null;
        if ( localName.equals( RestrictionConnectiveHandler.OR ) ) {
            connectiveDescr = new RestrictionConnectiveDescr( RestrictionConnectiveDescr.OR );
        } else if ( localName.equals( RestrictionConnectiveHandler.AND ) ) {
            connectiveDescr = new RestrictionConnectiveDescr( RestrictionConnectiveDescr.AND );
        }

        return connectiveDescr;
    }
View Full Code Here

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

        final RestrictionConnectiveDescr connectiveDescr = (RestrictionConnectiveDescr) parser.getCurrent();

        final Object obj = parser.getParent();

        if ( obj instanceof FieldConstraintDescr ) {
            final FieldConstraintDescr fieldConstriantDescr = (FieldConstraintDescr) obj;
            fieldConstriantDescr.addRestriction( connectiveDescr );
        } else if ( obj instanceof RestrictionConnectiveDescr ) {
            final RestrictionConnectiveDescr restconective = (RestrictionConnectiveDescr) obj;
            restconective.addRestriction( connectiveDescr );
        }

        return connectiveDescr;
    }
View Full Code Here

        AndDescr andConstr1 = (AndDescr) orConstr.getDescrs().get( 0 );

        FieldConstraintDescr fcd = (FieldConstraintDescr) andConstr1.getDescrs().get( 0 );
        assertEquals( "age",
                      fcd.getFieldName() );
        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fcd.getRestriction().getRestrictions().get( 0 );
        RestrictionConnectiveDescr and1 = (RestrictionConnectiveDescr) or.getRestrictions().get( 0 );
        RestrictionConnectiveDescr and2 = (RestrictionConnectiveDescr) or.getRestrictions().get( 1 );

        assertEquals( ">",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 0 )).getEvaluator() );
        assertEquals( "60",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 0 )).getText() );

        assertEquals( "<",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 1 )).getEvaluator() );
        assertEquals( "70",
                      ((LiteralRestrictionDescr) and1.getRestrictions().get( 1 )).getText() );

        assertEquals( ">",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 0 )).getEvaluator() );
        assertEquals( "50",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 0 )).getText() );

        assertEquals( "<",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 1 )).getEvaluator() );
        assertEquals( "55",
                      ((LiteralRestrictionDescr) and2.getRestrictions().get( 1 )).getText() );

        fcd = (FieldConstraintDescr) andConstr1.getDescrs().get( 1 );
        assertEquals( "hair",
                      fcd.getFieldName() );
View Full Code Here

TOP

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

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.