com.cra.bnet.engine
Class ThresholdBeliefCondition

java.lang.Object
  |
  +--com.cra.bnet.engine.ThresholdBeliefCondition
All Implemented Interfaces:
BeliefCondition

public class ThresholdBeliefCondition
extends Object
implements BeliefCondition

A condition of the form belief for node=state operator threshold. For example, to create the condition belief for WetGrass=true > 0.9 use the following:

 DiscreteNode wetGrass = ...;
 BeliefCondition condition = new ThresholdBeliefCondition(wetGrass, 
                                                          "true",  
                                                          ThresholdBeliefCondition.GREATER_THAN, 
                                                          0.9);
 


Nested Class Summary
static class ThresholdBeliefCondition.ComparisonOperator
          An operator that compares two numbers.
 
Field Summary
static ThresholdBeliefCondition.ComparisonOperator EQUAL_TO
          The equal-to operator.
static ThresholdBeliefCondition.ComparisonOperator GREATER_THAN
          The greater-than operator.
static ThresholdBeliefCondition.ComparisonOperator GREATER_THAN_OR_EQUAL_TO
          The greater-than-or-equal-to operator.
static ThresholdBeliefCondition.ComparisonOperator LESS_THAN
          The less-than operator.
static ThresholdBeliefCondition.ComparisonOperator LESS_THAN_OR_EQUAL_TO
          The less-than-or-equal-to operator.
static ThresholdBeliefCondition.ComparisonOperator NOT_EQUAL_TO
          The not-equal-to operator.
 
Constructor Summary
ThresholdBeliefCondition(DiscreteNode node, String state, ThresholdBeliefCondition.ComparisonOperator operator, double threshold)
          Creates a new ThresholdBeliefCondition using the specified node, state, threshold, and comparison operator.
 
Method Summary
 boolean accept(BeliefEvent event)
          Returns true if the specified belief event meets this condition.
 ThresholdBeliefCondition.ComparisonOperator getComparisonOperator()
          Returns this condition's comparison operator.
 Node getNode()
          Returns the node that this condition operates on.
 String getState()
          Returns this condition's state.
 double getThreshold()
          Returns this condition's threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GREATER_THAN

public static final ThresholdBeliefCondition.ComparisonOperator GREATER_THAN
The greater-than operator. Returns true if the first number is greater-than the second number.


GREATER_THAN_OR_EQUAL_TO

public static final ThresholdBeliefCondition.ComparisonOperator GREATER_THAN_OR_EQUAL_TO
The greater-than-or-equal-to operator. Returns true if the first number is greater-than-or-equal-to the second number.


LESS_THAN

public static final ThresholdBeliefCondition.ComparisonOperator LESS_THAN
The less-than operator. Returns true if the first number is less-than the second number.


LESS_THAN_OR_EQUAL_TO

public static final ThresholdBeliefCondition.ComparisonOperator LESS_THAN_OR_EQUAL_TO
The less-than-or-equal-to operator. Returns true if the first number is less-than-or-equal-to the second number.


EQUAL_TO

public static final ThresholdBeliefCondition.ComparisonOperator EQUAL_TO
The equal-to operator. Returns true if the first number is equal-to the second number.


NOT_EQUAL_TO

public static final ThresholdBeliefCondition.ComparisonOperator NOT_EQUAL_TO
The not-equal-to operator. Returns true if the first number is not-equal-to the second number.

Constructor Detail

ThresholdBeliefCondition

public ThresholdBeliefCondition(DiscreteNode node,
                                String state,
                                ThresholdBeliefCondition.ComparisonOperator operator,
                                double threshold)
Creates a new ThresholdBeliefCondition using the specified node, state, threshold, and comparison operator.

Parameters:
node - node.
state - state whose belief is tested by this condition.
operator - comparison operator used to compare the belief and the threshold.
threshold - threshold value.
Method Detail

accept

public boolean accept(BeliefEvent event)
Description copied from interface: BeliefCondition
Returns true if the specified belief event meets this condition.

Specified by:
accept in interface BeliefCondition
Parameters:
event - belief event to test.
Returns:
true if the specified belief event meets this condition.

getNode

public Node getNode()
Description copied from interface: BeliefCondition
Returns the node that this condition operates on.

Specified by:
getNode in interface BeliefCondition
Returns:
the node that this condition operates on.

getState

public String getState()
Returns this condition's state.

Returns:
this condition's state.

getThreshold

public double getThreshold()
Returns this condition's threshold.

Returns:
this condition's threshold.

getComparisonOperator

public ThresholdBeliefCondition.ComparisonOperator getComparisonOperator()
Returns this condition's comparison operator.

Returns:
this condition's comparison operator.