Rational (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.record

## Interface Rational

- All Known Implementing Classes:
    RationalImpl

      public interface Rational

  Specifies a rational number by means of a Java integer numerator (`Int32`) and a Java integer (`Int32`) denominator.

  To make values of this type, use the following methods from the MAJ forge:

  - From its numerator and denominator: `Forge.makeRational(int, int)`;
  - A zero default value: `Forge.zeroRational()`;
  - From a string representation as generated by `toString()`: `Forge.parseRational(String)`.
  See Also:
    `TypeDefinitions.Rational`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Rational` | `clone()` Create a cloned copy of this rational value.
    `double` | `doubleValue()` Returns the value of this rational as a Java double.
    `int` | `getDenominator()` Returns the denominator of the value represented by this rational number.
    `int` | `getNumerator()` Returns the numerator of the value represented by this rational number.
    `void` | `setDenominator(int denominator)` Sets the denominator of the value represented by this rational number.
    `void` | `setNumerator(int numerator)` Sets the numerator of the value represented by this rational number.
    `void` | `setRational(int numerator, int denominator)` Set the value of this rational number with both its numerator and denominator.
    `String` | `toString()` Formats a string representation of this rational value as the numerator, followed by a slash (/), followed by the denominator.

- - ### Method Detail

    - #### getNumerator

          @Int32
          int getNumerator()

      Returns the numerator of the value represented by this rational number.

      Returns:
        Numerator part of the rational value.

    - #### setNumerator

          void setNumerator(@Int32
                            int numerator)

      Sets the numerator of the value represented by this rational number.

      Parameters:
        `numerator` - Numerator part of the rational value.

    - #### getDenominator

          @Int32
          int getDenominator()

      Returns the denominator of the value represented by this rational number.

      Returns:
        Denominator part of the rational value.

    - #### setDenominator

          void setDenominator(@Int32
                              int denominator)

      Sets the denominator of the value represented by this rational number.

      Parameters:
        `denominator` - Denominator part of the rational value.

    - #### setRational

          void setRational(@Int32
                           int numerator,
                           @Int32
                           int denominator)

      Set the value of this rational number with both its numerator and denominator.

      Parameters:
        `numerator` - Numerator part of the rational value.
        `denominator` - Denominator part of the rational value.

    - #### clone

          Rational clone()

      Create a cloned copy of this rational value.

      Returns:
        Cloned copy of this rational value.

    - #### doubleValue

          double doubleValue()

      Returns the value of this rational as a Java double.

      Returns:
        Value of this rational as a Java double.

    - #### toString

          String toString()

      Formats a string representation of this rational value as the numerator, followed by a slash (/), followed by the denominator. For example, "1/4". The format is the same as that parsed by `Forge.parseRational(String)`.

      Overrides:
        `toString` in class `Object`
      Returns:
        This rational value formatted as a string.
      See Also:
        `Forge.parseRational(String)`

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.