Package org.drools.core.rule

Examples of org.drools.core.rule.RuleConditionElement


            }
        }

        // lets see if it maps to a query
        if ( objectType == null ) {
            RuleConditionElement rce = null;
            // it might be a recursive query, so check for same names
            if ( context.getRule().getName().equals( patternDescr.getObjectType() ) ) {
                // it's a query so delegate to the QueryElementBuilder
                QueryElementBuilder qeBuilder = QueryElementBuilder.getInstance();
                rce = qeBuilder.build( context,
View Full Code Here


            }
        }

        // lets see if it maps to a query
        if ( objectType == null ) {
            RuleConditionElement rce = null;
            // it might be a recursive query, so check for same names
            if ( context.getRule().getName().equals( patternDescr.getObjectType() ) ) {
                // it's a query so delegate to the QueryElementBuilder
                QueryElementBuilder qeBuilder = QueryElementBuilder.getInstance();
                rce = qeBuilder.build( context,
View Full Code Here

        private void traversePatternTree(List<PatternInfo> patternInfos, List<RuleConditionElement> ruleElements, List<BaseDescr> lhsDescrs) {
          if (ruleElements.size() != lhsDescrs.size()) {
            throw new RuntimeException("Cannot traverse pattern tree");
          }
          for (int i = 0; i < ruleElements.size(); i++) {
            RuleConditionElement ruleElement = ruleElements.get(i);
            BaseDescr lhsDescr = lhsDescrs.get(i);
           
            if (ruleElement instanceof Pattern && lhsDescr instanceof PatternDescr) {
              patternInfos.add(new PatternInfo((PatternDescr)lhsDescr, (Pattern)ruleElement));
              endPatternsCharacter = Math.max(endPatternsCharacter, ((PatternDescr)lhsDescr).getEndCharacter());
View Full Code Here

        private void traversePatternTree(List<PatternInfo> patternInfos, List<RuleConditionElement> ruleElements, List<BaseDescr> lhsDescrs) {
          if (ruleElements.size() != lhsDescrs.size()) {
            throw new RuntimeException("Cannot traverse pattern tree");
          }
          for (int i = 0; i < ruleElements.size(); i++) {
            RuleConditionElement ruleElement = ruleElements.get(i);
            BaseDescr lhsDescr = lhsDescrs.get(i);
           
            if (ruleElement instanceof Pattern && lhsDescr instanceof PatternDescr) {
              patternInfos.add(new PatternInfo((PatternDescr)lhsDescr, (Pattern)ruleElement));
              endPatternsCharacter = Math.max(endPatternsCharacter, ((PatternDescr)lhsDescr).getEndCharacter());
View Full Code Here

        }
    }

    private boolean isNegative(final BuildContext context) {
        for ( ListIterator<RuleConditionElement> it = context.stackIterator(); it.hasPrevious(); ) {
            RuleConditionElement rce = it.previous();
            if ( rce instanceof GroupElement && ((GroupElement) rce).isNot() ) {
                return true;
            }
        }
        return false;
View Full Code Here

        if( input instanceof AndDescr && ((AndDescr) input).getDescrs().size() == 1 ) {
            input = ((AndDescr) input).getDescrs().get( 0 );
        }
       
        final RuleConditionBuilder builder = (RuleConditionBuilder) context.getDialect().getBuilder( input.getClass() );
        final RuleConditionElement source = builder.build( context,
                                                           input );
        if ( source == null ) {
            return null;
        }
View Full Code Here

            }
        }

        // lets see if it maps to a query
        if ( objectType == null ) {
            RuleConditionElement rce = null;
            // it might be a recursive query, so check for same names
            if ( context.getRule().getName().equals( patternDescr.getObjectType() ) ) {
                // it's a query so delegate to the QueryElementBuilder
                rce = buildQueryElement(context, descr, prefixPattern, (QueryImpl) context.getRule());
            }
View Full Code Here

            }

            final RuleConditionBuilder builder = (RuleConditionBuilder) context.getDialect().getBuilder( accumDescr.getInput().getClass() );

            // create source CE
            final RuleConditionElement source = builder.build( context,
                                                               accumDescr.getInput() );

            if ( source == null ) {
                return null;
            }

            MVELDialect dialect = (MVELDialect) context.getDialect();

            Map<String, Declaration> decls = context.getDeclarationResolver().getDeclarations( context.getRule() );
            Map<String, Declaration> sourceOuterDeclr = source.getOuterDeclarations();

            Map<String, Declaration> mergedDecl = new HashMap( decls );
            mergedDecl.putAll( sourceOuterDeclr );

            Map<String, Class< ? >> declarationClasses = context.getDeclarationResolver().getDeclarationClasses( decls );
View Full Code Here

        if ( this.map.containsKey( (name) ) ) {
            return true;
        }

        for ( int i = this.buildStack.size() - 1; i >= 0; i-- ) {
            final RuleConditionElement rce = buildStack.get( i );
            final Declaration declaration = rce.getInnerDeclarations().get( name );
            if ( declaration != null ) {
                // if it is an OR and it is duplicated, we can stop looking for duplication now
                // as it is a separate logical branch
                boolean inOr = ((rce instanceof GroupElement) && ((GroupElement) rce).isOr());
                if ( ! inOr || type == null ) {
View Full Code Here

        context.pushRuleComponent( accumulate );

        final List resultBetaConstraints = context.getBetaconstraints();
        final List resultAlphaConstraints = context.getAlphaConstraints();

        RuleConditionElement source = accumulate.getSource();
        if( source instanceof GroupElement ) {
            GroupElement ge = (GroupElement) source;
            if( ge.isAnd() && ge.getChildren().size() == 1 ) {
                source = (RuleConditionElement) ge.getChildren().get( 0 );
            }
View Full Code Here

TOP

Related Classes of org.drools.core.rule.RuleConditionElement

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.