|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectNumber
DefaultRepresentativeFraction
@ThreadSafe public class DefaultRepresentativeFraction
A scale where denominator = 1 / scale.
This implementation is set up as a number because it is.
| metadata/geotk-metadata (download) | View source code for this class |
| Constructor Summary | |
|---|---|
DefaultRepresentativeFraction()
Default empty constructor. |
|
DefaultRepresentativeFraction(long denominator)
Creates a new representative fraction from the specified denominator. |
|
DefaultRepresentativeFraction(RepresentativeFraction source)
Constructs a metadata entity initialized with the values from the specified metadata. |
|
| Method Summary | |
|---|---|
static DefaultRepresentativeFraction |
castOrCopy(RepresentativeFraction object)
Returns a Geotk metadata implementation with the same values than the given arbitrary implementation. |
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. |
| Methods inherited from class Number |
|---|
byteValue, shortValue |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultRepresentativeFraction()
public DefaultRepresentativeFraction(RepresentativeFraction source)
source - The metadata to copy, or null if none.public DefaultRepresentativeFraction(long denominator)
denominator - The denominator.| Method Detail |
|---|
public static DefaultRepresentativeFraction castOrCopy(RepresentativeFraction object)
null, then this method returns null.
Otherwise if the given object is already a Geotk implementation, then the given object is
returned unchanged. Otherwise a new Geotk implementation is created and initialized to the
attribute values of the given object.
object - The object to get as a Geotk implementation, or null if none.
null if the argument was null.
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.public double doubleValue()
doubleValue in interface RepresentativeFractiondoubleValue in class Number1.0 / denominatorpublic float floatValue()
float type.
floatValue in class Number
public 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 Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||