|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
com.clarkparsia.pellet.datatypes.types.real.Rational
public class Rational
Title: Rational
Description: Object representation of rational numbers.
Note: care should be exercised if Rational
objects are used as
keys in a SortedMap
or elements in a SortedSet since
Rational
's natural ordering is inconsistent with equals.
See Comparable
, SortedMap
or SortedSet
for more information.
Copyright: Copyright (c) 2009
Company: Clark & Parsia, LLC.
Constructor Summary | |
---|---|
Rational(java.lang.Number numerator,
java.lang.Number denominator)
Construct a rational number from |
Method Summary | |
---|---|
static int |
compare(Rational a,
Rational b)
|
int |
compareTo(Rational that)
|
double |
doubleValue()
|
boolean |
equals(java.lang.Object obj)
Compares this Rational with the specified
Object for equality. |
float |
floatValue()
|
java.lang.Number |
getDenominator()
|
java.lang.Number |
getNumerator()
|
java.lang.Number |
getQuotient()
|
int |
hashCode()
|
int |
intValue()
|
boolean |
isQuotientExact()
|
long |
longValue()
|
int |
signum()
|
static Rational |
simplify(Rational r)
|
java.lang.String |
toString()
|
static Rational |
valueOf(java.lang.String s)
|
Methods inherited from class java.lang.Number |
---|
byteValue, shortValue |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rational(java.lang.Number numerator, java.lang.Number denominator)
numerator
- An integer valuedenominator
- A positive integer value
java.lang.IllegalArgumentException
- if this condition does not hold for the input parameters
OWLRealUtils.acceptable(numerator) && OWLRealUtils.isInteger(numerator) && OWLRealUtils.acceptable(denominator) && OWLRealUtils.isInteger(denominator) && denominator > 0
Method Detail |
---|
public static int compare(Rational a, Rational b)
public static Rational valueOf(java.lang.String s) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public static Rational simplify(Rational r)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Rational
with the specified
Object
for equality. Unlike compareTo, this method considers
two Rational
objects equal only if they are equal in
numerator and denominator.
equals
in class java.lang.Object
obj
- Object
to which this Rational
is to
be compared
true> if and only if the specified Object
is a
Rational
whose numerator and denominator are equal
to this Rational
's.
public int compareTo(Rational that)
compareTo
in interface java.lang.Comparable<Rational>
public double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public java.lang.Number getDenominator()
public java.lang.Number getNumerator()
public java.lang.Number getQuotient()
public int intValue()
intValue
in class java.lang.Number
public boolean isQuotientExact()
public long longValue()
longValue
in class java.lang.Number
public int signum()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |