loci.formats.tiff

## Class TiffRational

- java.lang.Object
- - java.lang.Number
  - - loci.formats.tiff.TiffRational

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TiffRational>

      public class TiffRational
      extends java.lang.Number
      implements java.lang.Comparable<TiffRational>

  A rational number (numerator over denominator).
  Author:
    Curtis Rueden ctrueden at wisc.edu
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `denom` Components of the rational's fractional representation.
    `protected long` | `numer` Components of the rational's fractional representation.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TiffRational(long numer, long denom)` Constructs a rational number.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte` | `byteValue()` Returns the value of the specified number as a byte.
    `int` | `compareTo(TiffRational q)` Compares this object with the specified object for order.
    `double` | `doubleValue()` Returns the value of the specified number as a double.
    `boolean` | `equals(java.lang.Object o)` Indicates whether some other object is "equal to" this one.
    `float` | `floatValue()` Returns the value of the specified number as a float.
    `long` | `getDenominator()` Gets this number's denominator.
    `long` | `getNumerator()` Gets this number's numerator.
    `int` | `hashCode()` Reasonable hash value for use with hashtables.
    `int` | `intValue()` Returns the value of the specified number as an int.
    `long` | `longValue()` Returns the value of the specified number as a long.
    `void` | `reduce()` Reduces this rational's fraction to lowest terms.
    `short` | `shortValue()` Returns the value of the specified number as a short.
    `java.lang.String` | `toString()` Returns a string representation of the object.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### numer

          protected long numer

      Components of the rational's fractional representation.

    - #### denom

          protected long denom

      Components of the rational's fractional representation.

  - ### Constructor Detail

    - #### TiffRational

          public TiffRational(long numer,
                              long denom)

      Constructs a rational number.

  - ### Method Detail

    - #### getNumerator

          public long getNumerator()

      Gets this number's numerator.

    - #### getDenominator

          public long getDenominator()

      Gets this number's denominator.

    - #### reduce

          public void reduce()

      Reduces this rational's fraction to lowest terms.

    - #### byteValue

          public byte byteValue()

      Returns the value of the specified number as a byte.
      Overrides:
        `byteValue` in class `java.lang.Number`

    - #### doubleValue

          public double doubleValue()

      Returns the value of the specified number as a double.
      Specified by:
        `doubleValue` in class `java.lang.Number`

    - #### floatValue

          public float floatValue()

      Returns the value of the specified number as a float.
      Specified by:
        `floatValue` in class `java.lang.Number`

    - #### intValue

          public int intValue()

      Returns the value of the specified number as an int.
      Specified by:
        `intValue` in class `java.lang.Number`

    - #### longValue

          public long longValue()

      Returns the value of the specified number as a long.
      Specified by:
        `longValue` in class `java.lang.Number`

    - #### shortValue

          public short shortValue()

      Returns the value of the specified number as a short.
      Overrides:
        `shortValue` in class `java.lang.Number`

    - #### equals

          public boolean equals(java.lang.Object o)

      Indicates whether some other object is "equal to" this one.
      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Reasonable hash value for use with hashtables.
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Returns a string representation of the object.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(TiffRational q)

      Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      Specified by:
        `compareTo` in interface `java.lang.Comparable<TiffRational>`

Copyright © 2026 Open Microscopy Environment