Package loci.formats.tiff
Class TiffRational
java.lang.Object
java.lang.Number
loci.formats.tiff.TiffRational
- All Implemented Interfaces:
Serializable,Comparable<TiffRational>
A rational number (numerator over denominator).
- Author:
- Curtis Rueden ctrueden at wisc.edu
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteReturns the value of the specified number as a byte.intCompares this object with the specified object for order.doubleReturns the value of the specified number as a double.booleanIndicates whether some other object is "equal to" this one.floatReturns the value of the specified number as a float.longGets this number's denominator.longGets this number's numerator.inthashCode()Reasonable hash value for use with hashtables.intintValue()Returns the value of the specified number as an int.longReturns the value of the specified number as a long.voidreduce()Reduces this rational's fraction to lowest terms.shortReturns the value of the specified number as a short.toString()Returns a string representation of the object.
-
Field Details
-
numer
protected long numerComponents of the rational's fractional representation. -
denom
protected long denomComponents 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. -
doubleValue
public double doubleValue()Returns the value of the specified number as a double.- Specified by:
doubleValuein classNumber
-
floatValue
public float floatValue()Returns the value of the specified number as a float.- Specified by:
floatValuein classNumber
-
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.- Overrides:
shortValuein classNumber
-
equals
Indicates whether some other object is "equal to" this one. -
hashCode
public int hashCode()Reasonable hash value for use with hashtables. -
toString
Returns a string representation of the object. -
compareTo
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:
compareToin interfaceComparable<TiffRational>
-