com.cra.bnet.engine
Class BeliefEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.cra.bnet.engine.BeliefEvent
All Implemented Interfaces:
Serializable

public class BeliefEvent
extends EventObject

An event representing a change in beliefs for a node in a Bayesian network.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
BeliefEvent(Node node, double[] beliefs, boolean valid)
          Creates a new BeliefEvent.
 
Method Summary
 double getBelief(String state)
          Returns the new belief for the specified state.
 double[] getBeliefs()
          Returns the new beliefs.
 Node getNode()
          Returns the node whose beliefs changed.
 boolean isValid()
          Returns true if the new beliefs are valid and false if they are invalid.
 String toString()
          Returns a string representation of this belief event.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeliefEvent

public BeliefEvent(Node node,
                   double[] beliefs,
                   boolean valid)
Creates a new BeliefEvent.

Parameters:
node - node whose beliefs changed.
beliefs - new beliefs.
valid - true if the view beliefs are valid and false if they are not.
Method Detail

getNode

public Node getNode()
Returns the node whose beliefs changed.

Returns:
the node whose beliefs changed.

getBeliefs

public double[] getBeliefs()
Returns the new beliefs.

Returns:
the new beliefs.

getBelief

public double getBelief(String state)
Returns the new belief for the specified state. If this belief event's node does not contain the specified state, this method returns -1.0.

Parameters:
state - state whose new belief is to be returned.
Returns:
the new belief for the specified state.

isValid

public boolean isValid()
Returns true if the new beliefs are valid and false if they are invalid. Invalid beliefs represent the fact that some modification was made to the Bayesian network that caused its beliefs to become invalid. If this method returns true, all beliefs will be Double.NaN.

Returns:
true if the new beliefs are valid and false if they are invalid.

toString

public String toString()
Returns a string representation of this belief event.

Overrides:
toString in class EventObject
Returns:
a string representation of this belief event.