loci.formats
Class TiffRational

java.lang.Object
  extended byjava.lang.Number
      extended byloci.formats.TiffRational
All Implemented Interfaces:
Comparable, Serializable

public class TiffRational
extends Number
implements Comparable

A rational number (numerator over denominator).

See Also:
Serialized Form

Field Summary
protected  long denom
          Components of the rational's fractional representation.
protected  long numer
          Components of the rational's fractional representation.
 
Constructor Summary
TiffRational(long numer, long denom)
          Constructs a rational number.
 
Method Summary
 byte byteValue()
          Returns the value of the specified number as a byte.
 int compareTo(Object o)
          Compares this object with the specified object for order.
 double doubleValue()
          Returns the value of the specified number as a double.
 boolean equals(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 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.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, 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.


doubleValue

public double doubleValue()
Returns the value of the specified number as a double.


floatValue

public float floatValue()
Returns the value of the specified number as a float.


intValue

public int intValue()
Returns the value of the specified number as an int.


longValue

public long longValue()
Returns the value of the specified number as a long.


shortValue

public short shortValue()
Returns the value of the specified number as a short.


equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one.


toString

public String toString()
Returns a string representation of the object.


compareTo

public int compareTo(Object o)
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