Package org.drools.lang.descr

Examples of org.drools.lang.descr.ConditionalElementDescr


                    helper.emit( Location.LOCATION_LHS_BEGIN_OF_CONDITION );
                }
                lhsOr( lhs,
                       true );
                if ( lhs.getDescr() != null && lhs.getDescr() instanceof ConditionalElementDescr ) {
                    ConditionalElementDescr root = (ConditionalElementDescr) lhs.getDescr();
                    BaseDescr[] descrs = root.getDescrs().toArray( new BaseDescr[root.getDescrs().size()] );
                    root.getDescrs().clear();
                    for ( int i = 0; i < descrs.length; i++ ) {
                        root.addOrMerge( descrs[i] );
                    }
                }
                if ( state.failed ) return;
            }
        } finally {
View Full Code Here


                    lhsAnd( source,
                            false );
                    if ( state.failed ) return null;

                    if ( source.getDescr() != null && source.getDescr() instanceof ConditionalElementDescr ) {
                        ConditionalElementDescr root = (ConditionalElementDescr) source.getDescr();
                        BaseDescr[] descrs = root.getDescrs().toArray( new BaseDescr[root.getDescrs().size()] );
                        root.getDescrs().clear();
                        for ( int i = 0; i < descrs.length; i++ ) {
                            root.addOrMerge( descrs[i] );
                        }
                    }
                } finally {
                    helper.end( CEDescrBuilder.class,
                                source );
View Full Code Here

                lhsAnd( source,
                        false );
                if ( state.failed ) return;

                if ( source.getDescr() != null && source.getDescr() instanceof ConditionalElementDescr ) {
                    ConditionalElementDescr root = (ConditionalElementDescr) source.getDescr();
                    BaseDescr[] descrs = root.getDescrs().toArray( new BaseDescr[root.getDescrs().size()] );
                    root.getDescrs().clear();
                    for ( int i = 0; i < descrs.length; i++ ) {
                        root.addOrMerge( descrs[i] );
                    }
                }
            } finally {
                helper.end( CEDescrBuilder.class,
                            source );
View Full Code Here

    }

    public RuleConditionElement build(final RuleBuildContext context,
                                    final BaseDescr descr,
                                    final Pattern prefixPattern) {
        final ConditionalElementDescr cedescr = (ConditionalElementDescr) descr;

        final GroupElement ge = newGroupElementFor( cedescr.getClass() );
        context.getBuildStack().push( ge );

        if ( prefixPattern != null ) {
            ge.addChild( prefixPattern );
        }

        // iterate over child descriptors
        for ( final Iterator it = cedescr.getDescrs().iterator(); it.hasNext(); ) {
            // gets child to build
            final BaseDescr child = (BaseDescr) it.next();

            // gets corresponding builder
            final RuleConditionBuilder builder = (RuleConditionBuilder) context.getDialect().getBuilder( child.getClass() );
View Full Code Here

        final ForallDescr forallDescr = (ForallDescr) parser.getCurrent();

        final Object parent = parser.getParent();

        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
        parentDescr.addDescr( forallDescr );

        return null;
    }
View Full Code Here

        final OrDescr orDescr = (OrDescr) parser.getCurrent();

        final Object parent = parser.getParent();

        if ( parent instanceof ConditionalElementDescr ) {
            final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
            parentDescr.addDescr( orDescr );
        } else if ( parent instanceof PatternDescr ) {
            final PatternDescr parentDescr = (PatternDescr) parent;
            parentDescr.addConstraint( orDescr );
        }

        return orDescr;
    }
View Full Code Here

        if ( (notDescr.getDescrs().size() != 1) && (notDescr.getDescrs().get( 0 ).getClass() != PatternDescr.class) ) {
            throw new SAXParseException( "<not> can only have a single <pattern...> as a child element",
                                         parser.getLocator() );
        }

        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
        parentDescr.addDescr( notDescr );

        return null;
    }
View Full Code Here

        if ( (existsDescr.getDescrs().size() != 1) && (existsDescr.getDescrs().get( 0 ).getClass() != PatternDescr.class) ) {
            throw new SAXParseException( "<exists> can only have a single <pattern...> as a child element",
                                         parser.getLocator() );
        }

        final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
        parentDescr.addDescr( existsDescr );

        return existsDescr;
    }
View Full Code Here

        if ( parent.getClass().getName().equals( FromDescr.class.getName() ) ) {
            final PatternDescr resultPattern = (PatternDescr) parser.getParent( 1 );
            resultPattern.setSource( collectDescr );
        } else if ( parent instanceof ConditionalElementDescr ) {
            final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
            parentDescr.addDescr( collectDescr );
        }

        return collectDescr;
    }
View Full Code Here

        Object parent = parser.getParent();

        final PatternDescr patternDescr = (PatternDescr) parent;

        final ConditionalElementDescr parentDescr = (ConditionalElementDescrparser.getParent( 1 );
               
        if ( element.getElementsByTagName( "expression" ).getLength() > 0 ) {
            patternDescr.setSource( fromDescr );   
        }
View Full Code Here

TOP

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

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.