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.XML
instead.DefaultResolution.getEquivalentScale()
,
Serialized FormDefined 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 (0 … 1] range.
|
String |
toString()
Returns a string representation of this scale, or
NaN if undefined. |
byteValue, shortValue
public DefaultRepresentativeFraction()
public DefaultRepresentativeFraction(long denominator)
denominator
- The denominator as a positive number, or 0 if unspecified.IllegalArgumentException
- If the given value is negative.public DefaultRepresentativeFraction(RepresentativeFraction object)
object
- The metadata to copy values from, or null
if none.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.@ValueRange(minimum=0.0) public long getDenominator()
getDenominator
in interface RepresentativeFraction
public void setDenominator(long denominator)
denominator
- The new denominator value, or 0 if none.IllegalArgumentException
- if the given value is negative.public void setScale(double scale)
round(1 / scale)
.
The equivalent of a getScale()
method is doubleValue()
.
scale
- The scale as a number between 0 exclusive 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 String toString()
NaN
if undefined.
If defined, the string representation uses the colon as in "1:20000".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–2015 The Apache Software Foundation. All rights reserved.