Interface RepresentativeFraction
-
@UML(identifier="MD_RepresentativeFraction", specification=ISO_19115) public interface RepresentativeFraction
A scale defined as the inverse of a denominator. This is derived from ISO 19103Scalewhere denominator = 1 / scale.Implementations are encouraged to extend
Numberin a manner equivalent to:class MyRepresentedFraction extends Number implements RepresentedFraction { ... public double doubleValue() { return 1.0 / (double) denominator; } public float floatValue() { return 1.0f / (float) denominator; } public long longValue() { return 1 / denominator; // Result is zero except for denominator=[0,1]. } ... }- Since:
- 2.1
- Version:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description doubledoubleValue()Returns the scale value in a form usable for computation.booleanequals(java.lang.Object other)Compares this representative fraction with the specified object for equality.longgetDenominator()The number below the line in a vulgar fraction.inthashCode()Returns a hash value for this representative fraction.
-
-
-
Method Detail
-
doubleValue
double doubleValue()
Returns the scale value in a form usable for computation.- Returns:
1.0 / (double) getDenominator()- Since:
- 2.2
-
getDenominator
@UML(identifier="denominator", obligation=MANDATORY, specification=ISO_19115) long getDenominator()
The number below the line in a vulgar fraction.- Returns:
- The denominator.
-
equals
boolean equals(java.lang.Object other)
Compares this representative fraction with the specified object for equality.RepresentativeFractionis a data object -equalsis defined according togetDenominator();Implementations should match the following:
public boolean equals(Object object) { if (object instanceof RepresentativeFraction) { final RepresentativeFraction that = (RepresentativeFraction) object; return getDenominator() == that.getDenominator(); } return false; }- Overrides:
equalsin classjava.lang.Object- Parameters:
other- The object to compare with.- Returns:
trueifotheris aRepresentedFractionwith the same denominator value.
-
hashCode
int hashCode()
Returns a hash value for this representative fraction.RepresentativeFractionis a data object -hashcodeis defined according togetDenominator().Implementations should match the following:
public int hashCode() { return (int) getDenominator(); }- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code value for this representative fraction.
-
-