Class TiffRational

java.lang.Object
java.lang.Number
loci.formats.tiff.TiffRational
All Implemented Interfaces:
Serializable, Comparable<TiffRational>

public class TiffRational extends Number implements Comparable<TiffRational>
A rational number (numerator over denominator).
Author:
Curtis Rueden ctrueden at wisc.edu
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected long
    Components of the rational's fractional representation.
    protected long
    Components of the rational's fractional representation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TiffRational(long numer, long denom)
    Constructs a rational number.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte
    Returns the value of the specified number as a byte.
    int
    Compares this object with the specified object for order.
    double
    Returns the value of the specified number as a double.
    boolean
    Indicates whether some other object is "equal to" this one.
    float
    Returns the value of the specified number as a float.
    long
    Gets this number's denominator.
    long
    Gets this number's numerator.
    int
    Reasonable hash value for use with hashtables.
    int
    Returns the value of the specified number as an int.
    long
    Returns the value of the specified number as a long.
    void
    Reduces this rational's fraction to lowest terms.
    short
    Returns the value of the specified number as a short.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • numer

      protected long numer
      Components of the rational's fractional representation.
    • denom

      protected long denom
      Components of the rational's fractional representation.
  • Constructor Details

    • TiffRational

      public TiffRational(long numer, long denom)
      Constructs a rational number.
  • Method Details

    • 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 Number
    • doubleValue

      public double doubleValue()
      Returns the value of the specified number as a double.
      Specified by:
      doubleValue in class Number
    • floatValue

      public float floatValue()
      Returns the value of the specified number as a float.
      Specified by:
      floatValue in class Number
    • intValue

      public int intValue()
      Returns the value of the specified number as an int.
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Returns the value of the specified number as a long.
      Specified by:
      longValue in class Number
    • shortValue

      public short shortValue()
      Returns the value of the specified number as a short.
      Overrides:
      shortValue in class Number
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Reasonable hash value for use with hashtables.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class 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 Comparable<TiffRational>