public class DefaultRepresentativeFraction extends Number implements RepresentativeFraction, IdentifiedObject
Number
.
In addition to the standard properties, SIS provides the following methods:
setScale(double)
for computing the denominator from a scale value.Defined in the sis-metadata
module
Constructor and Description |
---|
DefaultRepresentativeFraction()
Creates a uninitialized representative fraction.
|
DefaultRepresentativeFraction(long denominator)
Creates a new representative fraction from the specified denominator.
|
DefaultRepresentativeFraction(RepresentativeFraction object)
Constructs a new representative fraction initialized to the value of the given object.
|
Modifier and Type | Method and Description |
---|---|
static DefaultRepresentativeFraction |
castOrCopy(RepresentativeFraction object)
Returns a SIS metadata implementation with the same values than the given arbitrary
implementation.
|
double |
doubleValue()
Returns the scale value of this representative fraction.
|
boolean |
equals(Object object)
Compares this object with the specified value for equality.
|
float |
floatValue()
Returns the scale as a
float type. |
long |
getDenominator()
Returns the denominator of this representative fraction.
|
IdentifierMap |
getIdentifierMap()
Returns a map view of the identifiers collection as (authority,
code) entries.
|
Collection<Identifier> |
getIdentifiers()
Returns all identifiers associated to this object, or an empty collection if none.
|
int |
hashCode()
Returns a hash value for this representative fraction.
|
int |
intValue()
Returns 1 if the denominator is equals to 1, or 0 otherwise.
|
long |
longValue()
Returns 1 if the denominator is equals to 1, or 0 otherwise.
|
void |
setDenominator(long denominator)
Sets the denominator value.
|
void |
setScale(double scale)
Sets the denominator from a scale in the [-1 … +1] range.
|
byteValue, shortValue
public DefaultRepresentativeFraction()
public DefaultRepresentativeFraction(long denominator) throws IllegalArgumentException
denominator
- The denominator as a positive number, or 0 if unspecified.IllegalArgumentException
- If the given value is not a positive number or zero.public DefaultRepresentativeFraction(RepresentativeFraction object) throws IllegalArgumentException
object
- The metadata to copy values from, or null
if none.IllegalArgumentException
- If the denominator of the given source is negative.public static DefaultRepresentativeFraction castOrCopy(RepresentativeFraction object)
null
, then this method returns null
.
Otherwise if the given object is already a SIS implementation, then the given object is
returned unchanged. Otherwise a new SIS implementation is created and initialized to the
property values of the given object, using a shallow copy operation
(i.e. properties are not cloned).object
- The object to get as a SIS implementation, or null
if none.null
if the argument was null.public long getDenominator()
getDenominator
in interface RepresentativeFraction
public void setDenominator(long denominator) throws IllegalArgumentException
denominator
- The new denominator value, or 0 if none.IllegalArgumentException
- If the given value is not a positive number or zero.public void setScale(double scale) throws IllegalArgumentException
round(1 / scale)
.scale
- The scale as a number between -1 and +1 inclusive, or NaN.IllegalArgumentException
- if the given scale is our of range.public double doubleValue()
setScale(double)
.doubleValue
in interface RepresentativeFraction
doubleValue
in class Number
public float floatValue()
float
type.floatValue
in class Number
public long longValue()
public int intValue()
public boolean equals(Object object)
equals
in interface RepresentativeFraction
equals
in class Object
object
- The object to compare with.true
if both objects are equal.public int hashCode()
hashCode
in interface RepresentativeFraction
hashCode
in class Object
public Collection<Identifier> getIdentifiers()
id
or uuid
attributes.getIdentifiers
in interface IdentifiedObject
DefaultCitation.getIdentifiers()
,
DefaultObjective.getIdentifiers()
,
AbstractIdentifiedObject.getIdentifiers()
public IdentifierMap getIdentifierMap()
getIdentifierMap
in interface IdentifiedObject
Copyright © 2010–2014 The Apache Software Foundation. All rights reserved.