1.0.0

org.eclipse.soda.dk.data
Class LongFraction

java.lang.Object
  extended by java.lang.Number
      extended by org.eclipse.soda.dk.data.Fraction
          extended by org.eclipse.soda.dk.data.LongFraction
All Implemented Interfaces:
java.io.Serializable, Numeric
Direct Known Subclasses:
FixedLong

public class LongFraction
extends Fraction

The LongFraction class provides support for an long fraction.

Version:
1.0.0
See Also:
Fraction, Serializable, Serialized Form

Field Summary
protected  long denominator
          Define the denominator (long) field.
protected  long numerator
          Define the numerator (long) field.
 
Constructor Summary
LongFraction(int numerator)
          Constructs an LongFraction object using the input parameter(s).
LongFraction(int numerator, int denominator)
          Constructs an LongFraction object using the input parameter(s).
LongFraction(long numerator)
          Constructs an LongFraction object using the input parameter(s).
LongFraction(long numerator, long denominator)
          Constructs an LongFraction object using the input parameter(s).
LongFraction(java.lang.String value)
          Constructs an LongFraction object using the input parameter(s).
 
Method Summary
 java.lang.Number add(java.lang.Number fraction)
          Perform the add method and return the Number result.
 LongFraction divide(int value)
          Perform the divide method and return the LongFraction result.
 LongFraction divide(LongFraction fraction)
          Perform the divide method and return the LongFraction result.
 java.lang.Number divide(java.lang.Number value)
          Perform the divide method and return the Number result.
 double doubleValue()
          Perform the doubleValue method and return the double result.
 boolean equals(java.lang.Object compare)
          Perform the equals method and return the boolean result.
 float floatValue()
          Perform the floatValue method and return the float result.
 long getDenominator()
          Gets the long denominator property value.
 long getNumerator()
          Gets the long numerator property value.
 int intDenominator()
          Perform the intDenominator method and return the int result.
 int intNumerator()
          Perform the intNumerator method and return the int result.
 int intValue()
          Perform the intValue method and return the int result.
 long longDenominator()
          Perform the longDenominator method and return the long result.
 long longNumerator()
          Perform the longNumerator method and return the long result.
 long longValue()
          Perform the longValue method and return the long result.
 LongFraction multiply(int value)
          Perform the multiply method and return the LongFraction result.
 LongFraction multiply(LongFraction fraction)
          Perform the multiply method and return the LongFraction result.
 java.lang.Number multiply(java.lang.Number value)
          Perform the multiply method and return the Number result.
 java.lang.Number negate()
          Negate and return the Number result.
 java.lang.Number reciprocal()
          Reciprocal and return the Number result.
 void reduce()
          Perform the reduce action method.
 void setDenominator(long denominator)
          Sets the denominator property.
protected  void setNumerator(long numerator)
          Sets the numerator property.
 java.lang.Number subtract(java.lang.Number fraction)
          Perform the subtract method and return the Number result.
 java.lang.String toString()
          Perform the toString method and return the String result.
 
Methods inherited from class org.eclipse.soda.dk.data.Fraction
hashCode
 
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

numerator

protected long numerator
Define the numerator (long) field.


denominator

protected long denominator
Define the denominator (long) field.

Constructor Detail

LongFraction

public LongFraction(int numerator)
Constructs an LongFraction object using the input parameter(s).

Parameters:
numerator - int
See Also:
LongFraction(int,int), LongFraction(long), LongFraction(long,long), LongFraction(String)

LongFraction

public LongFraction(int numerator,
                    int denominator)
Constructs an LongFraction object using the input parameter(s).

Parameters:
numerator - int
denominator - int
See Also:
LongFraction(int), LongFraction(long), LongFraction(long,long), LongFraction(String)

LongFraction

public LongFraction(long numerator)
Constructs an LongFraction object using the input parameter(s).

Parameters:
numerator - long
See Also:
LongFraction(int), LongFraction(int,int), LongFraction(long,long), LongFraction(String)

LongFraction

public LongFraction(long numerator,
                    long denominator)
Constructs an LongFraction object using the input parameter(s).

Parameters:
numerator - long
denominator - long
See Also:
LongFraction(int), LongFraction(int,int), LongFraction(long), LongFraction(String)

LongFraction

public LongFraction(java.lang.String value)
Constructs an LongFraction object using the input parameter(s).

Parameters:
value - java.lang.String
See Also:
LongFraction(int), LongFraction(int,int), LongFraction(long), LongFraction(long,long)
Method Detail

add

public java.lang.Number add(java.lang.Number fraction)
Perform the add method and return the Number result.

Specified by:
add in interface Numeric
Specified by:
add in class Fraction
Parameters:
fraction - java.lang.Number
Returns:
Results of the add (Number) value.

divide

public LongFraction divide(int value)
Perform the divide method and return the LongFraction result.

Parameters:
value - int
Returns:
Results of the divide (LongFraction) value.
See Also:
divide(LongFraction), divide(Number)

divide

public LongFraction divide(LongFraction fraction)
Perform the divide method and return the LongFraction result.

Parameters:
fraction - org.eclipse.soda.dk.data.LongFraction
Returns:
Results of the divide (LongFraction) value.
See Also:
divide(int), divide(Number)

divide

public java.lang.Number divide(java.lang.Number value)
Perform the divide method and return the Number result.

Specified by:
divide in interface Numeric
Specified by:
divide in class Fraction
Parameters:
value - java.lang.Number
Returns:
Results of the divide (Number) value.
See Also:
divide(int), divide(LongFraction)

doubleValue

public double doubleValue()
Perform the doubleValue method and return the double result.

Specified by:
doubleValue in class java.lang.Number
Returns:
Results of the double value (double) value.
See Also:
floatValue(), intValue(), longValue()

equals

public boolean equals(java.lang.Object compare)
Perform the equals method and return the boolean result.

Overrides:
equals in class java.lang.Object
Parameters:
compare - java.lang.Object
Returns:
Results of the equals (boolean) value.

floatValue

public float floatValue()
Perform the floatValue method and return the float result.

Specified by:
floatValue in class java.lang.Number
Returns:
Results of the float value (float) value.
See Also:
doubleValue(), intValue(), longValue()

getDenominator

public long getDenominator()
Gets the long denominator property value.

Returns:
Results of the get denominator (long) value.
See Also:
intDenominator(), longDenominator(), setDenominator(long)

getNumerator

public long getNumerator()
Gets the long numerator property value.

Returns:
Results of the get numerator (long) value.
See Also:
intNumerator(), longNumerator(), setNumerator(long)

intDenominator

public int intDenominator()
Perform the intDenominator method and return the int result.

Specified by:
intDenominator in class Fraction
Returns:
Results of the int denominator (int) value.
See Also:
getDenominator(), longDenominator(), setDenominator(long)

intNumerator

public int intNumerator()
Perform the intNumerator method and return the int result.

Specified by:
intNumerator in class Fraction
Returns:
Results of the int numerator (int) value.
See Also:
getNumerator(), longNumerator(), setNumerator(long)

intValue

public int intValue()
Perform the intValue method and return the int result.

Specified by:
intValue in class java.lang.Number
Returns:
Results of the int value (int) value.
See Also:
doubleValue(), floatValue(), longValue()

longDenominator

public long longDenominator()
Perform the longDenominator method and return the long result.

Specified by:
longDenominator in class Fraction
Returns:
Results of the long denominator (long) value.
See Also:
getDenominator(), intDenominator(), setDenominator(long)

longNumerator

public long longNumerator()
Perform the longNumerator method and return the long result.

Specified by:
longNumerator in class Fraction
Returns:
Results of the long numerator (long) value.
See Also:
getNumerator(), intNumerator(), setNumerator(long)

longValue

public long longValue()
Perform the longValue method and return the long result.

Specified by:
longValue in class java.lang.Number
Returns:
Results of the long value (long) value.
See Also:
doubleValue(), floatValue(), intValue()

multiply

public LongFraction multiply(int value)
Perform the multiply method and return the LongFraction result.

Parameters:
value - int
Returns:
Results of the multiply (LongFraction) value.
See Also:
multiply(LongFraction), multiply(Number)

multiply

public LongFraction multiply(LongFraction fraction)
Perform the multiply method and return the LongFraction result.

Parameters:
fraction - org.eclipse.soda.dk.data.LongFraction
Returns:
Results of the multiply (LongFraction) value.
See Also:
multiply(int), multiply(Number)

multiply

public java.lang.Number multiply(java.lang.Number value)
Perform the multiply method and return the Number result.

Specified by:
multiply in interface Numeric
Specified by:
multiply in class Fraction
Parameters:
value - java.lang.Number
Returns:
Results of the multiply (Number) value.
See Also:
multiply(int), multiply(LongFraction)

negate

public java.lang.Number negate()
Negate and return the Number result.

Returns:
Results of the negate (Number) value.

reciprocal

public java.lang.Number reciprocal()
Reciprocal and return the Number result.

Returns:
Results of the reciprocal (Number) value.

reduce

public void reduce()
Perform the reduce action method.


setDenominator

public void setDenominator(long denominator)
Sets the denominator property.

Parameters:
denominator - The new property value (long).
See Also:
getDenominator(), intDenominator(), longDenominator()

setNumerator

protected void setNumerator(long numerator)
Sets the numerator property.

Parameters:
numerator - The new property value (long).
See Also:
getNumerator(), intNumerator(), longNumerator()

subtract

public java.lang.Number subtract(java.lang.Number fraction)
Perform the subtract method and return the Number result.

Specified by:
subtract in interface Numeric
Specified by:
subtract in class Fraction
Parameters:
fraction - java.lang.Number
Returns:
Results of the subtract (Number) value.

toString

public java.lang.String toString()
Perform the toString method and return the String result.

Overrides:
toString in class java.lang.Object
Returns:
Results of the to string (String) value.

1.0.0

Copyright (c) 1999, 2007 IBM