loci.formats
Class TiffRational

java.lang.Object
  extended by java.lang.Number
      extended by loci.formats.TiffRational
All Implemented Interfaces:
Serializable, Comparable

public class TiffRational
extends Number
implements Comparable

A rational number (numerator over denominator).

Source code:
Trac, SVN

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 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.
 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 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(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