public List<RuleMatch> startMatch(
      RuleMatch ruleMatch,
      RuleApply ruleApply,
      ComposedRuleElementMatch containerMatch,
      RuleElement entryPoint,
      RutaStream stream,
      InferenceCrowd crowd) {
    List<RuleMatch> result = new ArrayList<RuleMatch>();
    ComposedRuleElementMatch composedMatch = createComposedMatch(ruleMatch, containerMatch, stream);
    boolean allMatched = true;
    for (RuleElement each : elements) {
      List<RuleMatch> startMatch =
          each.startMatch(ruleMatch, null, composedMatch, each, stream, crowd);
      boolean oneMatched = false;
      ;
      for (RuleMatch eachRuleMatch : startMatch) {
        boolean matched = eachRuleMatch.matched();
        if (matched) {
          oneMatched = true;
          break;
        }
      }
      allMatched &= oneMatched;
      result.addAll(startMatch);
    }

    for (RuleMatch each : result) {
      if (!each.isApplied()) {
        ruleApply.add(each);
        if (each.matched() && allMatched) {
          each.getRule().getRoot().applyRuleElements(each, stream, crowd);
        }
        each.setApplied(true);
      }
    }
    return result;
  }
Exemplo n.º 2
0
 public synchronized boolean equals(java.lang.Object obj) {
   if (!(obj instanceof RuleElement)) return false;
   RuleElement other = (RuleElement) obj;
   if (obj == null) return false;
   if (this == obj) return true;
   if (__equalsCalc != null) {
     return (__equalsCalc == obj);
   }
   __equalsCalc = obj;
   boolean _equals;
   _equals =
       true
           && ((this.logical == null && other.getLogical() == null)
               || (this.logical != null && this.logical.equals(other.getLogical())))
           && this.openBrackets == other.getOpenBrackets()
           && ((this.vocabulary == null && other.getVocabulary() == null)
               || (this.vocabulary != null && this.vocabulary.equals(other.getVocabulary())))
           && ((this.function == null && other.getFunction() == null)
               || (this.function != null && this.function.equals(other.getFunction())))
           && ((this.value == null && other.getValue() == null)
               || (this.value != null && this.value.equals(other.getValue())))
           && this.closeBrackets == other.getCloseBrackets();
   __equalsCalc = null;
   return _equals;
 }