EDU.oswego.cs.dl.util.concurrent.misc
public class Fraction extends Object implements Cloneable, Comparable, Serializable
Field Summary | |
---|---|
protected long | denominator_ |
protected long | numerator_ |
Constructor Summary | |
---|---|
Fraction(long num, long den) Create a Fraction equal in value to num / den * | |
Fraction(Fraction f) Create a fraction with the same value as Fraction f * |
Method Summary | |
---|---|
double | asDouble() Return the value of the Fraction as a double * |
Object | clone() |
int | compareTo(Object other) return a number less, equal, or greater than zero
reflecting whether this Fraction is less, equal or greater than
the value of Fraction other.
|
int | compareTo(long n) return a number less, equal, or greater than zero
reflecting whether this Fraction is less, equal or greater than n.
|
long | denominator() Return the denominator * |
Fraction | dividedBy(Fraction b) return a Fraction representing this Fraction divided by b * |
Fraction | dividedBy(long n) return a Fraction representing this Fraction divided by n * |
boolean | equals(Object other) |
boolean | equals(long n) |
static long | gcd(long a, long b)
Compute the nonnegative greatest common divisor of a and b.
|
int | hashCode() |
Fraction | inverse() return a Fraction representing 1 / this Fraction * |
Fraction | minus(Fraction b) return a Fraction representing this Fraction minus b * |
Fraction | minus(long n) return a Fraction representing this Fraction minus n * |
Fraction | negative() return a Fraction representing the negated value of this Fraction * |
long | numerator() Return the numerator * |
Fraction | plus(Fraction b) return a Fraction representing this Fraction plus b * |
Fraction | plus(long n) return a Fraction representing this Fraction plus n * |
Fraction | times(Fraction b) return a Fraction representing this Fraction times b * |
Fraction | times(long n) return a Fraction representing this Fraction times n * |
String | toString() |