|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--com.bigzip.plugin.support.Ratio
The Ratio class wraps a value of a fraction made in an object. An
object of type ratio
contains a two fields, a numerator
and denominator whose type inherits from number
.
Field Summary | |
static Ratio |
INFINITY_LIMIT
The largest reciprocal value of type ratio . |
static Ratio |
MAX_VALUE
The largest value of type ratio . |
static Ratio |
MIN_VALUE
The smallest value of type ratio . |
static Ratio |
ONE_VALUE
The value for which type ratio . |
static Ratio |
UNDEFINED
The value for which type ratio . |
static Ratio |
ZERO_LIMIT
The smallest reciprocal value of type ratio . |
static Ratio |
ZERO_VALUE
The value for which type ratio . |
Constructor Summary | |
Ratio(java.lang.Number numerator)
Creates an instance of ratio with the value of numerator / 1. |
|
Ratio(java.lang.Number numerator,
java.lang.Number denominator)
Creates an instance of ratio with the value of numerator / denominator. |
Method Summary | |
java.lang.Object |
clone()
Creates and returns a copy of this object and values stored. |
int |
compareTo(java.lang.Object object)
Compares this Ratio to another Object. |
double |
doubleValue()
Returns the double value of this Ratio. |
boolean |
equals(Ratio ratio)
Returns the result of comparing this Ratio's numerator and denominator with the Ratio parsed. |
float |
floatValue()
Returns the float value of this Ratio. |
java.lang.Number |
getDenominator()
Provides access to the denominator. |
java.lang.Number |
getNumerator()
Provides access to the numerator. |
Ratio |
getReciprocal()
Returns the reciprocal of the current instance of ratio. |
int |
intValue()
Returns the integer value of this Ratio. |
boolean |
isInfinity()
Checks to see if the numerator and denominator satifies an infinity result. |
boolean |
isUndefined()
Checks to see if the numerator and denominator satifies an undefined result. |
boolean |
isZero()
Checks to see if the numerator and denominator satifies a zero result. |
long |
longValue()
Returns the long value of this Ratio. |
void |
reciprocal()
The reciprocal of the current values are stored in the current object. |
void |
setDenominator(java.lang.Number number)
Allocates a new denominator. |
void |
setNumerator(java.lang.Number number)
Allocates a new numerator. |
java.lang.String |
toString()
Returns the string equivalent of the numerator and denominator. |
Methods inherited from class java.lang.Number |
byteValue, shortValue |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final transient Ratio ZERO_VALUE
ratio
. is 0.
The constant value of this field is (0 / 1).public static final transient Ratio ONE_VALUE
ratio
. is 1.
The constant value of this field is (1 / 1).public static final transient Ratio MIN_VALUE
ratio
. The constant
value of this field is -2147483648.public static final transient Ratio MAX_VALUE
ratio
. The constant
value of this field is 2147483647.public static final transient Ratio ZERO_LIMIT
ratio
. The
constant value of this field is (1 / -2147483648).public static final transient Ratio INFINITY_LIMIT
ratio
. The
constant value of this field is (1 / 2147483647).public static final transient Ratio UNDEFINED
ratio
. is undefiend.
The constant value of this field is (0 / 1).Constructor Detail |
public Ratio(java.lang.Number numerator)
numerator
- the numerator part of the fraction.public Ratio(java.lang.Number numerator, java.lang.Number denominator)
numerator
- the numerator part of the fraction.denominator
- the demoniator part of the fraction.Method Detail |
public java.lang.Number getNumerator()
public void setNumerator(java.lang.Number number)
number
- the new numerator part of the fraction.public java.lang.Number getDenominator()
public void setDenominator(java.lang.Number number)
number
- the new denominator part of the fraction.public java.lang.Object clone()
clone
in class java.lang.Object
public int intValue()
intValue
in class java.lang.Number
ratio
value represented by this object is
converted to type int and the result of the conversion is
returned.public long longValue()
longValue
in class java.lang.Number
ratio
value represented by this object is
converted to type long
and the result of the
conversion is returned.public float floatValue()
floatValue
in class java.lang.Number
ratio
value represented by this object is
converted to type float
and the result of the
conversion is returned.public double doubleValue()
doubleValue
in class java.lang.Number
ratio
value represented by this object is
converted to type double
and the result of the
conversion is returned.public void reciprocal()
public Ratio getReciprocal()
public int compareTo(java.lang.Object object) throws java.lang.Exception
compareTo(Ratio)
. Otherwise,
it throws a ClassCastException
(as Doubles are comparable
only to other Doubles).object
- the Object
to be compared.0
if the argument is a Double
numerically equal to this Double; a value less than
0
if the argument is a Double numerically
greater than this Double; and a value greater than
0
if the argument is a Double numerically
less than this Double.ClassCastException
- if the argument is not a
Ratio
.public boolean equals(Ratio ratio)
public boolean isUndefined()
public boolean isZero()
public boolean isInfinity()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |