Lines Matching full:rule
141 // throw new IllegalArgumentException("Empty rule set description");
146 // if the description begins with a rule set name (the rule set
148 // of only one rule set), copy it out into our "name" member
153 // throw new IllegalArgumentException("Rule set name doesn't end in colon");
166 // throw new IllegalArgumentException("Empty rule set description");
185 // the descriptions of the rules (one rule per element). The rules
187 // semicolons are rule delimiters)
193 // ensure we are starting with an empty rule list
222 NFRule* rule = rules[i];
224 switch (rule->getType()) {
225 // if the rule's base value is 0, fill in a default
227 // rule's base value for regular rule sets, and the
228 // same as the preceding rule's base value in fraction
229 // rule sets)
231 rule->setBaseValue(defaultBaseValue, status);
238 // if it's the negative-number rule, copy it into its own
247 // if it's the improper fraction rule, copy it into the
256 // if it's the proper fraction rule, copy it into the
265 // if it's the master rule, copy it into the
274 // if it's a regular rule that already knows its base value,
276 // the default base value for the next rule
278 if (rule->getBaseValue() < defaultBaseValue) {
283 defaultBaseValue = rule->getBaseValue();
340 NFRule *rule = findNormalRule(number);
341 if (rule) { // else error, but can't report it
347 rule->doFormat(number, toAppendTo, pos);
356 NFRule *rule = findDoubleRule(number);
357 if (rule) { // else error, but can't report it
363 rule->doFormat(number, toAppendTo, pos);
372 // if this is a fraction rule set, use findFractionRuleSetRule()
377 // if the number is negative, return the negative number rule
378 // (if there isn't a negative-number rule, we pretend it's a
391 // fraction rule
395 // otherwise, return the improper fraction rule
401 // if there's a master rule, use it to format the number
406 // and if we haven't yet returned a rule, use findNormalRule()
407 // to find the applicable rule
415 // if this is a fraction rule set, use findFractionRuleSetRule()
416 // to find the rule (we should only go into this clause if the
422 // if the number is negative, return the negative-number rule
437 // rule, since it's considered a fraction rule. Skipping the
438 // master rule in this function is also how we avoid infinite
442 // special rules. If there are no rules, use the master rule.
444 // binary-search the rule list for the applicable rule
445 // (a rule is used for all values from its base value to
446 // the next rule's base value)
463 if (hi == 0) { // bad rule set, minimum base > 0
470 // rollback rule (see shouldRollBack()'s documentation for
471 // an explanation of the rollback rule). If we do, roll back
472 // one rule and return that one instead of the one we'd normally
475 if (hi == 1) { // bad rule set, no prior rule to rollback to from this base
482 // else use the master rule
487 * If this rule is a fraction rule set, this function is used by
488 * findRule() to select the most appropriate rule for formatting
489 * the number. Basically, the base value of each rule in the rule
495 * fraction would be 1, and the second rule is used the rest of the
499 * @return The rule to use to format this number
505 // by each rule's base value until you get an integral result)
521 // for each rule, do the following...
527 // denominator is the LCD. The numerator if the rule's
543 // that is, and the line number of the rule that did it. If
560 // a whole bunch of extra rule sets)
569 // finally, return the winning rule
576 * the value produced by the rule that matched the most charcters
581 * first character position this rule set didn't consume.
586 * be the matching rule's base value, composed appropriately with
612 // try matching each rule in the rule set against the text being
635 // start by trying the negative number rule (if there is one)
678 // sigificant rule first (this helps ensure that we parse
683 // limit ambiguity by making sure the rules that match a rule's
684 // are less significant than the rule containing the substitutions)/
723 // the rule set name goes first...