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 int
A constant holding the maximum finite value aUnlimitedInteger
can have.static final int
A constant holding the minimum finite value aUnlimitedInteger
can have.static final UnlimitedInteger
A constant holding the negative infinity.static final UnlimitedInteger
A constant holding the positive infinity. -
Constructor Summary
ConstructorsConstructorDescriptionUnlimitedInteger
(int value) Constructs a newly allocatedUnlimitedInteger
object that represents the specifiedint
value. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(UnlimitedInteger other) Compares twoUnlimitedInteger
objects numerically.double
Returns the value of thisUnlimitedInteger
as adouble
.boolean
Compares this number with the specified object for equality.float
Returns the value of thisUnlimitedInteger
as afloat
.int
hashCode()
Returns a hash code for this integer.int
intValue()
Returns the value of thisUnlimitedInteger
as anint
.boolean
Returnstrue
if this integer represents a positive or negative infinity.long
Returns the value of thisUnlimitedInteger
as 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 aUnlimitedInteger
can have.- See Also:
-
MAX_VALUE
public static final int MAX_VALUEA constant holding the maximum finite value aUnlimitedInteger
can have.- See Also:
-
-
Constructor Details
-
UnlimitedInteger
public UnlimitedInteger(int value) Constructs a newly allocatedUnlimitedInteger
object that represents the specifiedint
value.Integer.MAX_VALUE
andMIN_VALUE
maps to positive and negative infinities respectively.
-
-
Method Details
-
isInfinite
public boolean isInfinite()Returnstrue
if this integer represents a positive or negative infinity. -
intValue
public int intValue()Returns the value of thisUnlimitedInteger
as anint
. Positive and negative infinities map toInteger.MAX_VALUE
andMIN_VALUE
respectively. -
longValue
public long longValue()Returns the value of thisUnlimitedInteger
as along
. Positive and negative infinities map toLong.MAX_VALUE
andMIN_VALUE
respectively. -
floatValue
public float floatValue()Returns the value of thisUnlimitedInteger
as afloat
. Positive and negative infinities map toFloat.POSITIVE_INFINITY
andNEGATIVE_INFINITY
respectively.- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()Returns the value of thisUnlimitedInteger
as adouble
. Positive and negative infinities map toDouble.POSITIVE_INFINITY
andNEGATIVE_INFINITY
respectively.- Specified by:
doubleValue
in 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 twoUnlimitedInteger
objects numerically.- Specified by:
compareTo
in interfaceComparable<UnlimitedInteger>
- Parameters:
other
- the unlimited integer to be compared.- Returns:
0
if thisUnlimitedInteger
is equal to the given value,-1
if thisUnlimitedInteger
is numerically less than the given value, and+1
if thisUnlimitedInteger
is numerically greater than the given value,
-