Package org.geotools.api.util
Class UnlimitedInteger
- All Implemented Interfaces:
Serializable,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
FieldsModifier and TypeFieldDescriptionstatic final intA constant holding the maximum finite value aUnlimitedIntegercan have.static final intA constant holding the minimum finite value aUnlimitedIntegercan have.static final UnlimitedIntegerA constant holding the negative infinity.static final UnlimitedIntegerA constant holding the positive infinity. -
Constructor Summary
ConstructorsConstructorDescriptionUnlimitedInteger(int value) Constructs a newly allocatedUnlimitedIntegerobject that represents the specifiedintvalue. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(UnlimitedInteger other) Compares twoUnlimitedIntegerobjects numerically.doubleReturns the value of thisUnlimitedIntegeras adouble.booleanCompares this number with the specified object for equality.floatReturns the value of thisUnlimitedIntegeras afloat.inthashCode()Returns a hash code for this integer.intintValue()Returns the value of thisUnlimitedIntegeras anint.booleanReturnstrueif this integer represents a positive or negative infinity.longReturns the value of thisUnlimitedIntegeras along.toString()Returns a string representation of this number.Methods inherited from class Number
byteValue, shortValue
-
Field Details
-
NEGATIVE_INFINITY
A constant holding the negative infinity. -
POSITIVE_INFINITY
A constant holding the positive infinity. -
MIN_VALUE
public static final int MIN_VALUEA constant holding the minimum finite value aUnlimitedIntegercan have.- See Also:
-
MAX_VALUE
public static final int MAX_VALUEA constant holding the maximum finite value aUnlimitedIntegercan have.- See Also:
-
-
Constructor Details
-
UnlimitedInteger
public UnlimitedInteger(int value) Constructs a newly allocatedUnlimitedIntegerobject that represents the specifiedintvalue.Integer.MAX_VALUEandMIN_VALUEmaps to positive and negative infinities respectively.
-
-
Method Details
-
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
Returns a string representation of this number. -
hashCode
public int hashCode()Returns a hash code for this integer. -
equals
Compares this number with the specified object for equality. -
compareTo
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,
-