Class Limit


  • public class Limit
    extends java.lang.Object
    An immutable numeric range limit which can be inclusive or exclusive
    Author:
    bratseth
    • Field Detail

      • NEGATIVE_INFINITY

        public static final Limit NEGATIVE_INFINITY
      • POSITIVE_INFINITY

        public static final Limit POSITIVE_INFINITY
    • Constructor Detail

      • Limit

        public Limit​(java.lang.Number number,
                     boolean inclusive)
    • Method Detail

      • number

        public java.lang.Number number()
      • isInclusive

        public boolean isInclusive()
        Returns true if this limit includes its number, false if it excludes it
      • min

        public Limit min​(Limit other)
        Returns the smaller of this and the given limit
      • max

        public Limit max​(Limit other)
        Returns the larger of this and the given limit
      • isSmallerOrEqualTo

        public boolean isSmallerOrEqualTo​(Limit other)
      • isLargerOrEqualTo

        public boolean isLargerOrEqualTo​(Limit other)
      • isInfinite

        public boolean isInfinite()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object