Package org.drools.lang.descr

Examples of org.drools.lang.descr.RestrictionConnectiveDescr


        assertEquals( 1,
                      descrs.getDescrs().size() );
        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 0 );
        FieldConstraintDescr fieldConstr = (FieldConstraintDescr) pat.getConstraint().getDescrs().get( 0 );
        RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) fieldConstr.getRestrictions().get( 0 );
        LiteralRestrictionDescr gt1 = (LiteralRestrictionDescr) or.getRestrictions().get( 0 );
        LiteralRestrictionDescr eq1 = (LiteralRestrictionDescr) or.getRestrictions().get( 1 );

        assertEquals( ">",
                      gt1.getEvaluator() );
        assertEquals( false,
                      gt1.isNegated() );
View Full Code Here


        final AndDescr and = (AndDescr) eventE.getConstraint();

        FieldConstraintDescr fcdE = (FieldConstraintDescr) and.getDescrs().get( 0 );
        assertEquals( 1,
                      fcdE.getRestrictions().size() );
        final RestrictionConnectiveDescr orrestr = (RestrictionConnectiveDescr) fcdE.getRestrictions().get( 0 );
        assertEquals( RestrictionConnectiveDescr.OR,
                      orrestr.getConnective() );
        assertEquals( 2,
                      orrestr.getRestrictions().size() );
        assertTrue( orrestr.getRestrictions().get( 0 ) instanceof VariableRestrictionDescr );
        VariableRestrictionDescr re = (VariableRestrictionDescr) orrestr.getRestrictions().get( 0 );
        assertEquals( "before",
                      re.getEvaluator() );
        assertEquals( "$b",
                      re.getText() );
        assertEquals( "1, 10",
                      re.getParameterText() );
        assertTrue( re.isNegated() );
        re = (VariableRestrictionDescr) orrestr.getRestrictions().get( 1 );
        assertEquals( "after",
                      re.getEvaluator() );
        assertEquals( "$c",
                      re.getText() );
        assertEquals( "1, 10",
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 null;
    }
View Full Code Here

                        final String localName,
                        final Attributes attrs) throws SAXException {
        this.xmlPackageReader.startConfiguration( 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) throws SAXException {
        final Configuration config = this.xmlPackageReader.endConfiguration();

        final RestrictionConnectiveDescr connectiveDescr = (RestrictionConnectiveDescr) this.xmlPackageReader.getCurrent();

        final LinkedList parents = this.xmlPackageReader.getParents();
        final int size = parents.size();
        final ListIterator ite = parents.listIterator( parents.size() );

        ite.previous();

        final Object obj = ite.previous();

        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 null;
    }
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 null;
    }
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 null;
    }
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 null;
    }
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

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.