com.rational.test.ft.value

Class NumericRange



  • public class NumericRange
    extends Pattern
    Serves as a lower and upper boundary for a target value. This class includes a metadata type of property that controls whether the upper or lower boundaries are both included in comparisons against the range. Because the upper and lower boundaries are generic Number types, both integer and floating point ranges can be supported by this one class.
    Since:
    RFT1.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int LOWER
      Include the lower bound and not the upper bound of the numeric range in any comparisons.
      static int LOWER_AND_UPPER
      Include both lower and upper bounds of the numeric range in any comparisons.
      static int NEITHER
      Do not include the lower or upper bound of the numeric range in any comparisons.
      static int UPPER
      Include the upper bound and not the lower bound of the numeric range in any comparisons.
    • Constructor Summary

      Constructors 
      Constructor and Description
      NumericRange(java.lang.Number original, int compareBounds, boolean tryUnknownAsLong)
      Specifies the numeric range and how the boundaries are treated in a range comparison.
      NumericRange(java.lang.Number lower, java.lang.Number upper, int compareBounds)
      Specifies the numeric range and how the boundaries are treated in a range comparison.
      NumericRange(java.lang.Number lower, java.lang.Number upper, int compareBounds, java.lang.Object originalValue)
      Specifies the numeric range and how the boundaries are treated in a range comparison.
      NumericRange(java.lang.Object originalObj, int compareBounds, boolean tryUnknownAsLong, boolean isString)
      Specifies the numeric range and how the boundaries are treated in a range comparison.
      NumericRange(java.lang.String original, int compareBounds, boolean tryUnknownAsLong)
      Specifies the numeric range and how the boundaries are treated in a range comparison.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean canConvert(java.lang.String text)
      Returns true if text can be converted into a number.
      boolean equals(java.lang.Object right)
      Overloads the default Object.equals to check the specific range that is being compared.
      int getCompareBounds()
      Returns the flag that determines how the range boundaries are treated in a range comparison.
      java.lang.Number getLower()
      Returns the lower boundary of the numeric range.
      static java.lang.Number getNumber(java.lang.String text)
      Returns a Number converted from text.
      static java.lang.String getText(int compareBounds)
      Returns a text image for the compareBounds attribute.
      java.lang.Number getUpper()
      Returns the upper boundary of the numeric range.
      int hashCode()
      Overloads the java.lang.Object core specification to return a data-specific hash value rather than the default instance-specific hash code.
      boolean isValidRange()
      Returns true if the current values denote an invalid range.
      static boolean isValidRange(java.lang.Number lower, java.lang.Number upper, int compareBounds)
      Returns true if the specified values denote an invalid range.
      void setCompareBounds(int compareBounds)
      Defines how the range boundaries are treated in a range comparison.
      void setLower(java.lang.Number lower)
      Sets the lower boundary of the numeric range.
      void setUpper(java.lang.Number upper)
      Sets the upper boundary of the numeric range.
      java.lang.String toString()
      Creates a string of the value that this class represents.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • LOWER_AND_UPPER

        public static final int LOWER_AND_UPPER
        Include both lower and upper bounds of the numeric range in any comparisons. This is the default setting for any newly defined ranges.
        See Also:
        Constant Field Values
      • LOWER

        public static final int LOWER
        Include the lower bound and not the upper bound of the numeric range in any comparisons.
        See Also:
        Constant Field Values
      • UPPER

        public static final int UPPER
        Include the upper bound and not the lower bound of the numeric range in any comparisons.
        See Also:
        Constant Field Values
      • NEITHER

        public static final int NEITHER
        Do not include the lower or upper bound of the numeric range in any comparisons.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NumericRange

        public NumericRange(java.lang.Number lower,
                            java.lang.Number upper,
                            int compareBounds,
                            java.lang.Object originalValue)
        Specifies the numeric range and how the boundaries are treated in a range comparison.
        Since:
        RFT1.0
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
      • NumericRange

        public NumericRange(java.lang.Number lower,
                            java.lang.Number upper,
                            int compareBounds)
        Specifies the numeric range and how the boundaries are treated in a range comparison.
        Since:
        RFT1.0
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
      • NumericRange

        public NumericRange(java.lang.String original,
                            int compareBounds,
                            boolean tryUnknownAsLong)
        Specifies the numeric range and how the boundaries are treated in a range comparison.
        Since:
        RFT1.1
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
      • NumericRange

        public NumericRange(java.lang.Number original,
                            int compareBounds,
                            boolean tryUnknownAsLong)
        Specifies the numeric range and how the boundaries are treated in a range comparison.
        Since:
        RFT1.0
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
      • NumericRange

        public NumericRange(java.lang.Object originalObj,
                            int compareBounds,
                            boolean tryUnknownAsLong,
                            boolean isString)
        Specifies the numeric range and how the boundaries are treated in a range comparison.
        Since:
        RFT1.1
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
    • Method Detail

      • getLower

        public java.lang.Number getLower()
        Returns the lower boundary of the numeric range.
        Since:
        RFT1.0
      • setLower

        public void setLower(java.lang.Number lower)
        Sets the lower boundary of the numeric range.
        Since:
        RFT1.0
      • getUpper

        public java.lang.Number getUpper()
        Returns the upper boundary of the numeric range.
      • setUpper

        public void setUpper(java.lang.Number upper)
        Sets the upper boundary of the numeric range.
      • getCompareBounds

        public int getCompareBounds()
        Returns the flag that determines how the range boundaries are treated in a range comparison.
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
      • setCompareBounds

        public void setCompareBounds(int compareBounds)
        Defines how the range boundaries are treated in a range comparison.
        See Also:
        LOWER_AND_UPPER, LOWER, UPPER, NEITHER
      • isValidRange

        public boolean isValidRange()
        Returns true if the current values denote an invalid range.
      • isValidRange

        public static boolean isValidRange(java.lang.Number lower,
                                           java.lang.Number upper,
                                           int compareBounds)
        Returns true if the specified values denote an invalid range.
      • equals

        public boolean equals(java.lang.Object right)
        Overloads the default Object.equals to check the specific range that is being compared.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overloads the java.lang.Object core specification to return a data-specific hash value rather than the default instance-specific hash code.
        Overrides:
        hashCode in class java.lang.Object
        Since:
        RFT1.0
      • getNumber

        public static java.lang.Number getNumber(java.lang.String text)
        Returns a Number converted from text.
      • canConvert

        public static boolean canConvert(java.lang.String text)
        Returns true if text can be converted into a number.
        Since:
        RFT1.1
      • toString

        public java.lang.String toString()
        Creates a string of the value that this class represents.
        Overrides:
        toString in class java.lang.Object
        Since:
        RFT1.1