public class RepresentativeFractionImpl extends Number implements RepresentativeFraction
| Constructor and Description |
|---|
RepresentativeFractionImpl()
Default empty constructor.
|
RepresentativeFractionImpl(long denominator)
Creates a new representative fraction from the specified denominator.
|
| Modifier and Type | Method and Description |
|---|---|
double |
doubleValue()
Returns the scale in a form usable for computation.
|
boolean |
equals(Object object)
Compares this object with the specified value for equality.
|
float |
floatValue()
Returns the scale as a
float type. |
static 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(). |
byteValue, shortValuepublic RepresentativeFractionImpl()
public RepresentativeFractionImpl(long denominator)
denominator - The denominator.public static RepresentativeFraction fromScale(double scale) throws IllegalArgumentException
double value. The denominator will be set to 1/scale.scale - The scale as a number between 0 and 1.IllegalArgumentException - if the condition abs(scale) <= 1 is not meet.@Deprecated public double toScale()
doubleValue().toScale in interface RepresentativeFractionpublic double doubleValue()
doubleValue in interface RepresentativeFractiondoubleValue in class Number1.0 / denominatorpublic float floatValue()
float type.floatValue in class Numberpublic long longValue()
throws ArithmeticException
intValue().longValue in class NumberArithmeticException - if the denominator is 0.public int intValue()
throws 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 NumberArithmeticException - if the denominator is 0.public long getDenominator()
getDenominator in interface RepresentativeFractionpublic void setDenominator(long denominator)
denominator - The new denominator value.public boolean equals(Object object)
equals in interface RepresentativeFractionequals in class Objectobject - The object to compare with.true if both objects are equal.public int hashCode()
hashCode in interface RepresentativeFractionhashCode in class ObjectCopyright © 1996–2019 Geotools. All rights reserved.