ppotentials
Class Probability

java.lang.Object
  extended by ppotentials.Probability
All Implemented Interfaces:
Serializable, Element, RegularElement

public class Probability
extends Object
implements RegularElement

This class represents probabilities as dividable semiring element.

Version:
1.1
Author:
Marc Pouly
See Also:
Serialized Form

Constructor Summary
Probability(double value)
          Constructor:
 
Method Summary
 Element add(Element element)
           
 boolean equals(Object o)
           
protected  double getValue()
           
 RegularElement inverse()
           
 Element multiply(Element element)
           
protected static boolean numericTest(double d1, double d2)
          This test compares two numeric double values on equality.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Probability

public Probability(double value)
Constructor:

Parameters:
value - The probability value.
Method Detail

add

public Element add(Element element)
Specified by:
add in interface Element
See Also:
Element.add(nenok.va.semiring.Element)

multiply

public Element multiply(Element element)
Specified by:
multiply in interface Element
See Also:
Element.multiply(nenok.va.semiring.Element)

inverse

public RegularElement inverse()
Specified by:
inverse in interface RegularElement
See Also:
RegularElement.inverse()

equals

public boolean equals(Object o)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

getValue

protected double getValue()
Returns:
The probability object's value.

numericTest

protected static boolean numericTest(double d1,
                                     double d2)
This test compares two numeric double values on equality. They are equal if their distance is smaller that the EPSILON constant.

Parameters:
d1 - The first value.
d2 - The second value.
Returns:
true, if the two values are equal.