Class SameValueSubstitution


  • class SameValueSubstitution
    extends NFSubstitution
    A substitution that passes the value passed to it through unchanged. Represented by == in rule descriptions.
    • Constructor Detail

      • SameValueSubstitution

        SameValueSubstitution​(int pos,
                              NFRuleSet ruleSet,
                              java.lang.String description)
        Constructs a SameValueSubstution. This function just uses the superclass constructor, but it performs a check that this substitution doesn't call the rule set that owns it, since that would lead to infinite recursion.
    • Method Detail

      • transformNumber

        public long transformNumber​(long number)
        Returns "number" unchanged.
        Specified by:
        transformNumber in class NFSubstitution
        Parameters:
        number - The number being formatted
        Returns:
        "number"
      • transformNumber

        public double transformNumber​(double number)
        Returns "number" unchanged.
        Specified by:
        transformNumber in class NFSubstitution
        Parameters:
        number - The number being formatted
        Returns:
        "number"
      • composeRuleValue

        public double composeRuleValue​(double newRuleValue,
                                       double oldRuleValue)
        Returns newRuleValue and ignores oldRuleValue. (The value we got matching the substitution supersedes the value of the rule that owns the substitution.)
        Specified by:
        composeRuleValue in class NFSubstitution
        Parameters:
        newRuleValue - The value resulting from matching the substitution
        oldRuleValue - The value of the rule containing the substitution.
        Returns:
        newRuleValue
      • calcUpperBound

        public double calcUpperBound​(double oldUpperBound)
        SameValueSubstitution doesn't change the upper bound.
        Specified by:
        calcUpperBound in class NFSubstitution
        Parameters:
        oldUpperBound - The current upper bound.
        Returns:
        oldUpperBound
      • tokenChar

        char tokenChar()
        The token character for a SameValueSubstitution is =.
        Specified by:
        tokenChar in class NFSubstitution
        Returns:
        '='