Reads in a collection of unary and binary rules, adding the rules
to {@code binaryRules} and {@code unaryRules}, respectively.

@param unfilteredRuleLines
@param binaryRules
@param unaryRules
505941
public static void parseBinaryAndUnaryRules(Iterable<String> unfilteredRuleLines, 
      List<CcgBinaryRule> binaryRules, List<CcgUnaryRule> unaryRules) {
    for (String line : unfilteredRuleLines) {
      // System.out.println(line);
      if (!line.startsWith("#")) {
        try {
          binaryRules.add(CcgBinaryRule.parseFrom(line));
        } catch (IllegalArgumentException e) {
          unaryRules.add(CcgUnaryRule.parseFrom(line));
        }
      }
    }
  }
67008
public void setRules(java.lang.String rules) {
        getStateHelper().put(PropertyKeys.rules, rules);
        handleAttribute("rules", rules);
    }
39140
public void setSubscriptionFilters(java.util.Collection<SubscriptionFilter> subscriptionFilters) {
        if (subscriptionFilters == null) {
            this.subscriptionFilters = null;
            return;
        }

        this.subscriptionFilters = new com.amazonaws.internal.SdkInternalList<SubscriptionFilter>(subscriptionFilters);
    }
1049050
List<Rule> getRules() {
        List<Rule> rulesToReturn = new ArrayList<>(this.rules);
        new DeletedProposition().toRules(rulesToReturn);
        return rulesToReturn;
    }
1313066
public <RO> MultipleRuleContext<DPO, TDPO, RO> check(Collection<Rule<TDPO, RO>> rules) {
        List<Rule<TDPO, RO>> addedRules = new ArrayList<Rule<TDPO, RO>>();
        if (rules != null) {
            addedRules.addAll(rules);
        }

        // Change context
        return new MultipleRuleContext<DPO, TDPO, RO>(addedTriggers, addedDataProviders, dataProviderToRuleMapping,
                addedRuleInputTransformers, addedRules);
    }
310545
public synchronized void addRule(final RuleImpl rule) throws InvalidPatternException {
        final List<TerminalNode> terminals = this.ruleBuilder.addRule( rule,
                                                                       this.kBase );

        BaseNode[] nodes = terminals.toArray( new BaseNode[terminals.size()] );
        this.rules.put( rule.getFullyQualifiedName(), nodes );
        if (rule.isQuery()) {
            this.queries.put( rule.getName(), nodes );
        }
    }
381224
public void setRules(Collection<ServerSideEncryptionRule> rules) {
        if (rules == null) {
            this.rules = null;
            return;
        }

        this.rules = new ArrayList<ServerSideEncryptionRule>(rules);
    }
230491
public void setAuthorizationRules(java.util.Collection<AuthorizationRule> authorizationRules) {
        if (authorizationRules == null) {
            this.authorizationRules = null;
            return;
        }

        this.authorizationRules = new com.amazonaws.internal.SdkInternalList<AuthorizationRule>(authorizationRules);
    }
812560
public Factor getBinaryRuleExpectations() {
    Tensor binaryRuleWeights = binaryRuleDistribution.coerceToDiscrete().getWeights();
    SparseTensor tensor = SparseTensor.copyRemovingZeros(binaryRuleWeights,
        binaryRuleExpectations);

    return new TableFactor(binaryRuleDistribution.getVars(), tensor);
  }
292727
public void setRulesPackages(java.util.Collection<RulesPackage> rulesPackages) {
        if (rulesPackages == null) {
            this.rulesPackages = null;
            return;
        }

        this.rulesPackages = new java.util.ArrayList<RulesPackage>(rulesPackages);
    }
1149216
public void setSamplingRuleRecords(java.util.Collection<SamplingRuleRecord> samplingRuleRecords) {
        if (samplingRuleRecords == null) {
            this.samplingRuleRecords = null;
            return;
        }

        this.samplingRuleRecords = new java.util.ArrayList<SamplingRuleRecord>(samplingRuleRecords);
    }
487573
@InternalFunction(precedence=1,isAssign=true)
    public void readonly(RuleContext ruleContext,RuleProxyField ruleProxyField)
    {
        setReadOnly(ruleProxyField,ruleContext);
    }
72973
public void setRules(java.util.Collection<Rule> rules) {
        if (rules == null) {
            this.rules = null;
            return;
        }

        this.rules = new java.util.ArrayList<Rule>(rules);
    }
630718
public void doFilter(JsonRule jsonRule, EnumBuilderType type) throws FilterException {
        if (jsonRule.isGroup()) {
            IGroup group = jsonRule.toGroup();
            if (CollectionUtils.isEmpty(group.getRules())) {
                throw new FilterException("group's rules can not be empty for: " + group);
            }
        } else {
            IRule rule = jsonRule.toRule();
            // field
            if (StringUtils.isEmpty(rule.getField())) {
                throw new FilterException("rule's field can not be empty for:" + rule);
            }
            // operator
            if (StringUtils.isEmpty(rule.getOperator())) {
                throw new FilterException("rule's operator can not be empty for:" + rule);
            }
            // type
            if (StringUtils.isEmpty(rule.getType())) {
                throw new FilterException("rule's type can not be empty for:" + rule);
            }
            // equal
            if (EnumOperator.EQUAL.equals(rule.getOperator())) {
                if (rule.getValue() instanceof List) {
                    List<Object> list = (List<Object>) rule.getValue();
                    if (list.size() > 1) {
                        throw new FilterException("Operator \"equal\" cannot accept multiple values for:" + rule);
                    }
                    rule.setValue(list.get(0));
                }
            }

            // must be list
            if (EnumOperator.IN.equals(rule.getOperator()) || EnumOperator.NOT_IN.equals(rule.getOperator())
                    || EnumOperator.BETWEEN.equals(rule.getOperator()) || EnumOperator.NOT_BETWEEN.equals(rule.getOperator())) {
                // list
                if (!(rule.getValue() instanceof List)) {
                    throw new FilterException("rule's value must be Array for:" + rule);
                }

                // size
                if (EnumOperator.BETWEEN.equals(rule.getOperator()) || EnumOperator.NOT_BETWEEN.equals(rule.getOperator())) {
                    List list = (List) rule.getValue();
                    if (list.size() != 2) {
                        throw new FilterException("rule's value size must be 2 for:" + rule);
                    }
                }
            }
        }
    }
24069
@SafeVarargs
    public static <T, U, R> BiFunction<T, U, R> firstMatch(BinaryClause<T, U, R>... clauses) {
        final List<Clause<Pair<T, U>, R>> unaryClauses = Sequences.of(clauses).map(BinaryClause::tupled).toList();
        return Pairs.untupled(new FirstMatchStrategy<>(unaryClauses));
    }
1126640
def consume_rules(flags = {})
      rules = []

      while token = @tokens.consume
        case token[:node]
          # Non-standard. Spec says to discard comments and whitespace, but we
          # keep them so we can serialize faithfully.
        when :comment, :whitespace
          rules << token

        when :cdc, :cdo
          unless flags[:top_level]
            @tokens.reconsume
            rule = consume_qualified_rule
            rules << rule if rule
          end

        when :at_keyword
          @tokens.reconsume
          rule = consume_at_rule
          rules << rule if rule

        else
          @tokens.reconsume
          rule = consume_qualified_rule
          rules << rule if rule
        end
      end

      rules
    end
1296301
protected void getSAXRules() {

    arrRuleRecords.clear();

    Vector<SAXRule> rules = new Vector<SAXRule>(numRules.intValue());
    rules.addElement(this);

    SAXRule currentRule;

    int processedRules = 0;

    StringBuilder sbCurrentRule = new StringBuilder();

    while (processedRules < rules.size()) {

      currentRule = rules.elementAt(processedRules);

      for (SAXSymbol sym = currentRule.first(); (!sym.isGuard()); sym = sym.n) {
        if (sym.isNonTerminal()) {
          SAXRule referedTo = ((SAXNonTerminal) sym).r;
          if ((rules.size() > referedTo.index) && (rules.elementAt(referedTo.index) == referedTo)) {
            index = referedTo.index;
          }
          else {
            index = rules.size();
            referedTo.index = index;
            rules.addElement(referedTo);
          }
          sbCurrentRule.append('R');
          sbCurrentRule.append(index);
        }
        else {
          sbCurrentRule.append(sym.value);
        }
        sbCurrentRule.append(' ');
      }

      GrammarRuleRecord ruleConteiner = new GrammarRuleRecord();

      ruleConteiner.setRuleNumber(processedRules);
      ruleConteiner.setRuleString(sbCurrentRule.toString());

      ruleConteiner.setRuleLevel(currentRule.getLevel());

      ruleConteiner.setRuleUseFrequency(currentRule.count);
      ruleConteiner.setOccurrences(currentRule.getIndexes());

      arrRuleRecords.add(ruleConteiner);

      sbCurrentRule = new StringBuilder();
      processedRules++;
    }

  }