Class UnlimitedInteger

Object
Number
UnlimitedInteger
All Implemented Interfaces:
Serializable, Comparable<UnlimitedInteger>

public final class UnlimitedInteger extends Number implements Comparable<UnlimitedInteger>
An integer with associated infinite flag. This implementation uses Integer.MAX_VALUE as a sentinel value for positive infinity. This approach is consistent with J2SE Collection.size() contract. For consistency, Integer.MIN_VALUE is a sentinal value for negative infinity.
Since:
GeoAPI 2.1
Author:
Jody Garnett (Refractions Research), Martin Desruisseaux (IRD)
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A constant holding the maximum finite value a UnlimitedInteger can have.
    static final int
    A constant holding the minimum finite value a UnlimitedInteger can have.
    static final UnlimitedInteger
    A constant holding the negative infinity.
    static final UnlimitedInteger
    A constant holding the positive infinity.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UnlimitedInteger(int value)
    Constructs a newly allocated UnlimitedInteger object that represents the specified int value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares two UnlimitedInteger objects numerically.
    double
    Returns the value of this UnlimitedInteger as a double.
    boolean
    equals(Object object)
    Compares this number with the specified object for equality.
    float
    Returns the value of this UnlimitedInteger as a float.
    int
    Returns a hash code for this integer.
    int
    Returns the value of this UnlimitedInteger as an int.
    boolean
    Returns true if this integer represents a positive or negative infinity.
    long
    Returns the value of this UnlimitedInteger as a long.
    Returns a string representation of this number.

    Methods inherited from class Number

    byteValue, shortValue

    Methods inherited from class Object

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

    • NEGATIVE_INFINITY

      public static final UnlimitedInteger NEGATIVE_INFINITY
      A constant holding the negative infinity.
    • POSITIVE_INFINITY

      public static final UnlimitedInteger POSITIVE_INFINITY
      A constant holding the positive infinity.
    • MIN_VALUE

      public static final int MIN_VALUE
      A constant holding the minimum finite value a UnlimitedInteger can have.
      See Also:
    • MAX_VALUE

      public static final int MAX_VALUE
      A constant holding the maximum finite value a UnlimitedInteger can have.
      See Also:
  • Constructor Details

    • UnlimitedInteger

      public UnlimitedInteger(int value)
      Constructs a newly allocated UnlimitedInteger object that represents the specified int value. Integer.MAX_VALUE and MIN_VALUE maps to positive and negative infinities respectively.
  • Method Details

    • isInfinite

      public boolean isInfinite()
      Returns true if this integer represents a positive or negative infinity.
    • intValue

      public int intValue()
      Returns the value of this UnlimitedInteger as an int. Positive and negative infinities map to Integer.MAX_VALUE and MIN_VALUE respectively.
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Returns the value of this UnlimitedInteger as a long. Positive and negative infinities map to Long.MAX_VALUE and MIN_VALUE respectively.
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Returns the value of this UnlimitedInteger as a float. Positive and negative infinities map to Float.POSITIVE_INFINITY and NEGATIVE_INFINITY respectively.
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Returns the value of this UnlimitedInteger as a double. Positive and negative infinities map to Double.POSITIVE_INFINITY and NEGATIVE_INFINITY respectively.
      Specified by:
      doubleValue in class Number
    • toString

      public String toString()
      Returns a string representation of this number.
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Returns a hash code for this integer.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Compares this number with the specified object for equality.
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(UnlimitedInteger other)
      Compares two UnlimitedInteger objects numerically.
      Specified by:
      compareTo in interface Comparable<UnlimitedInteger>
      Parameters:
      other - the unlimited integer to be compared.
      Returns:
      0 if this UnlimitedInteger is equal to the given value, -1 if this UnlimitedInteger is numerically less than the given value, and +1 if this UnlimitedInteger is numerically greater than the given value,