com.motlin.risk.odds
Class Fraction

java.lang.Object
  extended by com.motlin.risk.odds.Fraction
All Implemented Interfaces:
Probability<Fraction>, Comparable<Fraction>

public final class Fraction
extends Object
implements Comparable<Fraction>, Probability<Fraction>


Constructor Summary
Fraction(BigInteger num, BigInteger den)
           
Fraction(long num, long den)
           
 
Method Summary
 Fraction add(BigInteger n)
           
 Fraction add(Fraction b)
           
 Fraction add(long n)
           
 BigDecimal asBigDecimal(int scale, int roundingMode)
           
 int compareTo(BigInteger n)
           
 int compareTo(Fraction other)
           
 Fraction divide(BigInteger n)
           
 Fraction divide(Fraction b)
           
 Fraction divide(long n)
           
 boolean equals(Object obj)
           
 String exactString()
           
 BigInteger getDenominator()
           
 BigInteger getNumerator()
           
 boolean greaterThan(Fraction other)
           
 int hashCode()
           
 Fraction inverse()
           
 boolean lessThan(Fraction other)
           
 Fraction max(Fraction val)
           
 Fraction min(Fraction val)
           
 Fraction multiply(BigInteger n)
           
 Fraction multiply(Fraction b)
           
 Fraction multiply(long n)
           
 Fraction negate()
           
 Fraction subtract(BigInteger n)
           
 Fraction subtract(Fraction b)
           
 Fraction subtract(long n)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fraction

public Fraction(BigInteger num,
                BigInteger den)

Fraction

public Fraction(long num,
                long den)
Method Detail

getNumerator

public BigInteger getNumerator()

getDenominator

public BigInteger getDenominator()

toString

public String toString()
Overrides:
toString in class Object

exactString

public String exactString()

min

public Fraction min(Fraction val)

max

public Fraction max(Fraction val)

asBigDecimal

public BigDecimal asBigDecimal(int scale,
                               int roundingMode)

negate

public Fraction negate()

inverse

public Fraction inverse()

add

public Fraction add(Fraction b)
Specified by:
add in interface Probability<Fraction>

add

public Fraction add(BigInteger n)

add

public Fraction add(long n)

subtract

public Fraction subtract(Fraction b)

subtract

public Fraction subtract(BigInteger n)

subtract

public Fraction subtract(long n)

multiply

public Fraction multiply(Fraction b)
Specified by:
multiply in interface Probability<Fraction>

multiply

public Fraction multiply(BigInteger n)

multiply

public Fraction multiply(long n)

divide

public Fraction divide(Fraction b)

divide

public Fraction divide(BigInteger n)

divide

public Fraction divide(long n)

compareTo

public int compareTo(Fraction other)
Specified by:
compareTo in interface Comparable<Fraction>

compareTo

public int compareTo(BigInteger n)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

greaterThan

public boolean greaterThan(Fraction other)
Specified by:
greaterThan in interface Probability<Fraction>

lessThan

public boolean lessThan(Fraction other)