Package net.sourceforge.jiu.codecs.tiff
Class TIFFRational
java.lang.Object
net.sourceforge.jiu.codecs.tiff.TIFFRational
Data class to store a TIFF rational number.
A TIFF rational number is a fraction given by 32 bit integer numerator and denominator values.
It is one of the data types used in TIFF tags (
TIFFTag).
For more information on TIFF's internals, see TIFFCodec, which lists a few links
to TIFF specification documents.- Author:
- Marco Schmidt
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTIFFRational(int numerator, int denominator) Creates a TiffRational object from the arguments. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the fraction as adoublevalue.floatReturns the fraction as afloatvalue.intReturns the denominator value that was given to the constructor.intReturns the numerator value that was given to the constructor.
-
Field Details
-
numerator
private int numerator -
denominator
private int denominator
-
-
Constructor Details
-
TIFFRational
public TIFFRational(int numerator, int denominator) Creates a TiffRational object from the arguments.- Parameters:
numerator- the numerator of the fraction stored in this objectdenominator- the denominator of the fraction stored in this object- Throws:
IllegalArgumentException- if denominator is0(division by zero is not allowed)
-
-
Method Details
-
getDenominator
public int getDenominator()Returns the denominator value that was given to the constructor.- Returns:
- denominator value
-
getAsDouble
public double getAsDouble()Returns the fraction as adoublevalue.- Returns:
- the fraction stored in this object
- See Also:
-
getAsFloat
public float getAsFloat()Returns the fraction as afloatvalue.- Returns:
- the fraction stored in this object
- See Also:
-
getNumerator
public int getNumerator()Returns the numerator value that was given to the constructor.- Returns:
- numerator value
-