|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
org.geotools.metadata.iso.identification.RepresentativeFractionImpl
public class RepresentativeFractionImpl
A scale where denominator = 1 / scale
.
This implementation is set up as a number - because it is.
Constructor Summary | |
---|---|
RepresentativeFractionImpl()
Default empty constructor. |
|
RepresentativeFractionImpl(long denominator)
Creates a new representative fraction from the specified denominator. |
Method Summary | |
---|---|
double |
doubleValue()
Returns the scale in a form usable for computation. |
boolean |
equals(java.lang.Object object)
Compares this object with the specified value for equality. |
float |
floatValue()
Returns the scale as a float type. |
static org.opengis.metadata.identification.RepresentativeFraction |
fromScale(double scale)
Creates a representative fraction from a scale as a double value. |
long |
getDenominator()
Returns the number below the line in a vulgar fraction. |
int |
hashCode()
Returns a hash value for this representative fraction. |
int |
intValue()
Returns the scale as an integer. |
long |
longValue()
Returns the scale as an integer. |
void |
setDenominator(long denominator)
Sets the denominator value. |
double |
toScale()
Deprecated. This is equivalent to doubleValue() . |
Methods inherited from class java.lang.Number |
---|
byteValue, shortValue |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RepresentativeFractionImpl()
public RepresentativeFractionImpl(long denominator)
denominator
- The denominator.Method Detail |
---|
public static org.opengis.metadata.identification.RepresentativeFraction fromScale(double scale) throws java.lang.IllegalArgumentException
double
value.
The denominator will be set to 1/scale
.
scale
- The scale as a number between 0 and 1.
java.lang.IllegalArgumentException
- if the condition abs(scale) <= 1
is not meet.@Deprecated public double toScale()
doubleValue()
.
toScale
in interface org.opengis.metadata.identification.RepresentativeFraction
public double doubleValue()
doubleValue
in interface org.opengis.metadata.identification.RepresentativeFraction
doubleValue
in class java.lang.Number
1.0 / denominator
public float floatValue()
float
type.
floatValue
in class java.lang.Number
public long longValue() throws java.lang.ArithmeticException
intValue()
.
longValue
in class java.lang.Number
java.lang.ArithmeticException
- if the denominator is 0.public int intValue() throws java.lang.ArithmeticException
ArithmeticException
since infinities can not be represented by an integer.
Otherwise if the denominator is 1, then this method returns 1. Otherwise returns 0
0 since the scale is a fraction between 0 and 1, and such value can not be represented
as an integer.
intValue
in class java.lang.Number
java.lang.ArithmeticException
- if the denominator is 0.public long getDenominator()
getDenominator
in interface org.opengis.metadata.identification.RepresentativeFraction
public void setDenominator(long denominator)
denominator
- The new denominator value.public boolean equals(java.lang.Object object)
equals
in interface org.opengis.metadata.identification.RepresentativeFraction
equals
in class java.lang.Object
object
- The object to compare with.
true
if both objects are equal.public int hashCode()
hashCode
in interface org.opengis.metadata.identification.RepresentativeFraction
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |