Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.opengis.metadata.identification
Interface RepresentativeFraction

    @UML(identifier="MD_RepresentativeFraction",
         specification=ISO_19115)
    public interface RepresentativeFraction

Derived from ISO 19103 Scale where denominator = 1 / Scale. `Measure` and `Scale.targetUnits` = `Scale.sourceUnits`.

Implementations are encouraged to extend `Number` in the following manner:

      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 0;
          }
          public int intValue() {
              return 0;
          }
          ...
      }

Since:
  GeoAPI 2.1

Method Summary
`boolean` | `equals(Object other)` Compares this representative fraction with the specified object for equality.
`int` | `getDenominator()` The number below the line in a vulgar fraction.
`int` | `hashCode()` Returns a hash value for this representative fraction.
`double` | `toScale()` Returns this value in a form usable for computation.

Method Detail

### toScale

    double toScale()

  Returns this value in a form usable for computation.

  Returns:
    `1.0 / (double) getDenominator()`

### getDenominator

    @UML(identifier="denominator",
         obligation=MANDATORY,
         specification=ISO_19115)
    int getDenominator()

  The number below the line in a vulgar fraction.

  TODO:
    Return type may need to be a `long`? Source interface seems to indicate such.

### equals

    boolean equals(Object other)

  Compares this representative fraction with the specified object for equality. `RepresentativeFraction` is a data object - `equals` is defined acoording to `getDenominator()`;

  Implementations should exactly match the following:

       public boolean equals(final Object object) {
           if (object instanceof RepresentativeFraction) {
               final RepresentativeFraction that = (RepresentativeFraction) object;
               return denominator == that.getDenominator();
           }
           return false;
       }

  Overrides:
    `equals` in class `Object`
  Parameters:
    `other` - The object to compare with.
  Returns:
    `true` if `other` is a `RepresentedFraction` with the same denominator value.

### hashCode

    int hashCode()

  Returns a hash value for this representative fraction. `RepresentativeFraction` is a data object - `hashcode` is defined according to `getDenominator()`.

  Implementations should exactly match the following:

       public int hashCode() {
           return getDenominator();
       }

  Overrides:
    `hashCode` in class `Object`
  Returns:
    A hash code value for this representative fraction.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.