Package org.geotools.api.util
Class UnlimitedInteger
-
- All Implemented Interfaces:
Serializable,Comparable<UnlimitedInteger>
public final class UnlimitedInteger extends Number implements Comparable<UnlimitedInteger>
An integer with associated infinite flag. This implementation usesInteger.MAX_VALUEas a sentinel value for positive infinity. This approach is consistent with J2SECollection.size()contract. For consistency,Integer.MIN_VALUEis a sentinal value for negative infinity.- Since:
- GeoAPI 2.1
- Author:
- Jody Garnett (Refractions Research), Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_VALUEA constant holding the maximum finite value aUnlimitedIntegercan have.static intMIN_VALUEA constant holding the minimum finite value aUnlimitedIntegercan have.static UnlimitedIntegerNEGATIVE_INFINITYA constant holding the negative infinity.static UnlimitedIntegerPOSITIVE_INFINITYA constant holding the positive infinity.
-
Constructor Summary
Constructors Constructor Description UnlimitedInteger(int value)Constructs a newly allocatedUnlimitedIntegerobject that represents the specifiedintvalue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(UnlimitedInteger other)Compares twoUnlimitedIntegerobjects numerically.doubledoubleValue()Returns the value of thisUnlimitedIntegeras adouble.booleanequals(Object object)Compares this number with the specified object for equality.floatfloatValue()Returns the value of thisUnlimitedIntegeras afloat.inthashCode()Returns a hash code for this integer.intintValue()Returns the value of thisUnlimitedIntegeras anint.booleanisInfinite()Returnstrueif this integer represents a positive or negative infinity.longlongValue()Returns the value of thisUnlimitedIntegeras along.StringtoString()Returns a string representation of this number.-
Methods inherited from class Number
byteValue, shortValue
-
-
-
-
Field Detail
-
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 aUnlimitedIntegercan have.- See Also:
- Constant Field Values
-
MAX_VALUE
public static final int MAX_VALUE
A constant holding the maximum finite value aUnlimitedIntegercan have.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnlimitedInteger
public UnlimitedInteger(int value)
Constructs a newly allocatedUnlimitedIntegerobject that represents the specifiedintvalue.Integer.MAX_VALUEandMIN_VALUEmaps to positive and negative infinities respectively.
-
-
Method Detail
-
isInfinite
public boolean isInfinite()
Returnstrueif this integer represents a positive or negative infinity.
-
intValue
public int intValue()
Returns the value of thisUnlimitedIntegeras anint. Positive and negative infinities map toInteger.MAX_VALUEandMIN_VALUErespectively.
-
longValue
public long longValue()
Returns the value of thisUnlimitedIntegeras along. Positive and negative infinities map toLong.MAX_VALUEandMIN_VALUErespectively.
-
floatValue
public float floatValue()
Returns the value of thisUnlimitedIntegeras afloat. Positive and negative infinities map toFloat.POSITIVE_INFINITYandNEGATIVE_INFINITYrespectively.- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()
Returns the value of thisUnlimitedIntegeras adouble. Positive and negative infinities map toDouble.POSITIVE_INFINITYandNEGATIVE_INFINITYrespectively.- Specified by:
doubleValuein classNumber
-
toString
public String toString()
Returns a string representation of this number.
-
hashCode
public int hashCode()
Returns a hash code for this integer.
-
equals
public boolean equals(Object object)
Compares this number with the specified object for equality.
-
compareTo
public int compareTo(UnlimitedInteger other)
Compares twoUnlimitedIntegerobjects numerically.- Specified by:
compareToin interfaceComparable<UnlimitedInteger>- Parameters:
other- the unlimited integer to be compared.- Returns:
0if thisUnlimitedIntegeris equal to the given value,-1if thisUnlimitedIntegeris numerically less than the given value, and+1if thisUnlimitedIntegeris numerically greater than the given value,
-
-