|
Copyright 2012-04-26 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Number
org.monte.media.math.Rational
public class Rational
Represents a TIFF RATIONAL number.
Two LONGs 32-bit (4-byte) unsigned integer: the first represents the numerator of a fraction; the second, the denominator.
Invariants:
| Field Summary | |
|---|---|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
Rational(long numerator,
long denominator)
|
|
Rational(Rational r)
|
|
| Method Summary | |
|---|---|
Rational |
add(Rational that)
|
Rational |
ceil(long d)
Returns the closest rational with the specified denominator which is greater or equal than this number. |
int |
compareTo(Rational that)
return { -1, 0, +1 } if a < b, a = b, or a > b. |
Rational |
divide(Rational that)
|
double |
doubleValue()
|
boolean |
equals(java.lang.Object obj)
|
float |
floatValue()
|
Rational |
floor(long d)
Returns the closest rational with the specified denominator which is smaller or equal than this number. |
long |
getDenominator()
|
long |
getNumerator()
|
int |
hashCode()
|
int |
intValue()
|
Rational |
inverse()
|
boolean |
isLessOrEqualZero()
|
boolean |
isZero()
|
long |
longValue()
|
static void |
main(java.lang.String[] args)
|
static Rational |
max(Rational a,
Rational b)
|
static Rational |
min(Rational a,
Rational b)
|
Rational |
multiply(long integer)
|
Rational |
multiply(Rational that)
Warning. |
Rational |
negate()
|
Rational |
round(long d)
|
Rational |
subtract(Rational that)
Warning. |
java.lang.String |
toDescriptiveString()
|
java.lang.String |
toString()
|
static Rational |
valueOf(double d)
|
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public Rational(long numerator,
long denominator)
public Rational(Rational r)
| Method Detail |
|---|
public long getNumerator()
public long getDenominator()
public Rational add(Rational that)
public Rational subtract(Rational that)
public Rational negate()
public Rational inverse()
public Rational floor(long d)
public Rational ceil(long d)
public Rational multiply(Rational that)
public Rational multiply(long integer)
public Rational divide(Rational that)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toDescriptiveString()
public int intValue()
intValue in class java.lang.Numberpublic long longValue()
longValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic double doubleValue()
doubleValue in class java.lang.Numberpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int compareTo(Rational that)
public int hashCode()
hashCode in class java.lang.Object
public static Rational max(Rational a,
Rational b)
public static Rational min(Rational a,
Rational b)
public boolean isZero()
public boolean isLessOrEqualZero()
public static Rational valueOf(double d)
public static void main(java.lang.String[] args)
public Rational round(long d)
|
Copyright 2012-04-26 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||