Class RationalNumber
java.lang.Object
java.lang.Number
org.apache.commons.imaging.common.RationalNumber
- All Implemented Interfaces:
Serializable
Rational number, as used by the TIFF image format.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int
final int
private static final long
private static final double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
(package private) static RationalNumber
factoryMethod
(long n, long d) float
private static long
gcd
(long a, long b) Return the greatest common divisorint
intValue()
long
negate()
toString()
static RationalNumber
valueOf
(double value) Calculate rational number using successive approximations.Methods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
TOLERANCE
private static final double TOLERANCE- See Also:
-
numerator
public final int numerator -
divisor
public final int divisor
-
-
Constructor Details
-
RationalNumber
public RationalNumber(int numerator, int divisor)
-
-
Method Details
-
factoryMethod
-
gcd
private static long gcd(long a, long b) Return the greatest common divisor -
negate
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in classNumber
-
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
intValue
public int intValue() -
longValue
public long longValue() -
toString
-
toDisplayString
-
valueOf
Calculate rational number using successive approximations.- Parameters:
value
- rational number double value- Returns:
- the RationalNumber representation of the double value
-