ABLE, Version 1.1b

com.ibm.able.beans.rules
Class AbleClause

java.lang.Object
  |
  +--com.ibm.able.beans.rules.AbleClause

public class AbleClause
extends java.lang.Object
implements java.io.Serializable

A Clause uses a relational operator to compare two Atoms (Facts, Variables, Sensors, or their derivatives). When evaluated, a clause can return one of three states as its truth value: true, false, and null, which is the case if either of the Atoms have null values. Note that this base clause is an antecedent clause.

Version:
1.0.0; change log:
 Version   Description
 --------  -----------
 1.0.0     Initial release.

 
See Also:
Serialized Form

Field Summary
protected  double clauseWeight
           
protected  AbleRuleCondition cond
          cond is the relation to be used to evaluate the lhs against the rhs of the clause.
protected  AbleAtom lhs
          lhs represents the lefthand side of the clause
protected  AbleAtom rhs
          rhs represents the righthand side of the clause
protected  java.util.Vector ruleRefs
          ruleRefs is a list of rules that reference this clause.
protected  java.lang.Object[] sensorArgs
          args is an array of objects to be passed to the effector or sensor as parameters when the method is invoked by the manager.
protected  AbleSensorManager sensorManager
          sensorManager is the inference engine that has registered the named sensor.
protected  java.lang.String sensorName
          sensorName is the name of a sensor (encapsulated method) that is registered with the sensorManager.
protected  java.lang.Boolean truth
          truth contains the current truth value of the clause if it has been evaluated (either true or false, or null if the truth value is unknown or cannot be evaluated (one of the operands has not been set).
 
Constructor Summary
AbleClause()
          Create a new, empty, clause whose truth value is unknown.
AbleClause(AbleAtom theLefthandSide, AbleRuleCondition theCondition, AbleAtom theRighthandSide)
          Create a new clause with the specified parts.
AbleClause(AbleAtom theLefthandSide, AbleRuleCondition theCondition, AbleSensorManager theSensorManager, java.lang.String theSensorName, java.lang.Object[] theSensorArgs)
          Create a new clause with the specified parts.
AbleClause(AbleAtom theLefthandSide, AbleRuleCondition theCondition, java.lang.String theRighthandSide)
          Create a new clause with the specified parts.
 
Method Summary
 void addRuleRef(AbleRule aRuleReference)
          Register a rule which refers to this clause.
 java.lang.Boolean check()
          Evaluate this clause and return the truth value.
protected  int compareString(java.lang.String val1, java.lang.String val2)
           
 double getClauseWeight()
           
 AbleRule getRule()
          Retrieve the first rule on the rule reference list.
 java.lang.Boolean getTruth()
          Retrieve the clause's truth value.
 boolean isConsequent()
          Determine whether this clause is a consequent (as opposed to an antecedent) clause.
 java.lang.String rlString()
          Return a formal able rule language string.
 void setClauseWeight(double theClauseWeight)
           
 java.lang.String toString()
          Return the clause in text format for display.
 java.lang.String xmlString()
          Return a formal XML string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ruleRefs

protected java.util.Vector ruleRefs
ruleRefs is a list of rules that reference this clause.

lhs

protected AbleAtom lhs
lhs represents the lefthand side of the clause

cond

protected AbleRuleCondition cond
cond is the relation to be used to evaluate the lhs against the rhs of the clause.

rhs

protected AbleAtom rhs
rhs represents the righthand side of the clause

truth

protected java.lang.Boolean truth
truth contains the current truth value of the clause if it has been evaluated (either true or false, or null if the truth value is unknown or cannot be evaluated (one of the operands has not been set).

sensorManager

protected AbleSensorManager sensorManager
sensorManager is the inference engine that has registered the named sensor.

sensorName

protected java.lang.String sensorName
sensorName is the name of a sensor (encapsulated method) that is registered with the sensorManager.

sensorArgs

protected java.lang.Object[] sensorArgs
args is an array of objects to be passed to the effector or sensor as parameters when the method is invoked by the manager.

clauseWeight

protected double clauseWeight
Constructor Detail

AbleClause

public AbleClause()
Create a new, empty, clause whose truth value is unknown.

AbleClause

public AbleClause(AbleAtom theLefthandSide,
                  AbleRuleCondition theCondition,
                  AbleAtom theRighthandSide)
Create a new clause with the specified parts. The truth value is set to null (unknown).
Parameters:
theLefthandSide - The lefthand-side of the clause.

theCondition - A relation with which to evaluate the two sides of the clause.

theRighthandSide - The righthand-side of the clause.


AbleClause

public AbleClause(AbleAtom theLefthandSide,
                  AbleRuleCondition theCondition,
                  java.lang.String theRighthandSide)
Create a new clause with the specified parts. The truth value is set to null (unknown).
Parameters:
theLefthandSide - The lefthand-side of the clause.

theCondition - A relation with which to evaluate the two sides of the clause.

theRighthandSide - The righthand-side of the clause.


AbleClause

public AbleClause(AbleAtom theLefthandSide,
                  AbleRuleCondition theCondition,
                  AbleSensorManager theSensorManager,
                  java.lang.String theSensorName,
                  java.lang.Object[] theSensorArgs)
Create a new clause with the specified parts. The truth value is set to null (unknown).
Parameters:
theLefthandSide - The lefthand-side of the clause.

theCondition - A relation with which to evaluate the two sides of the clause.

theRighthandSide - The righthand-side of the clause.

Method Detail

addRuleRef

public void addRuleRef(AbleRule aRuleReference)
Register a rule which refers to this clause.
Parameters:
aRuleReference - A rule object which refers to this clause.

Returns:
void.

check

public java.lang.Boolean check()
Evaluate this clause and return the truth value.
Returns:
true if the clause evaluates to true; false if the clause evaluates to false; or null if the truth value is unknown.

isConsequent

public boolean isConsequent()
Determine whether this clause is a consequent (as opposed to an antecedent) clause.
Returns:
true if the clause is a consequent clause; false otherwise.

getTruth

public java.lang.Boolean getTruth()
Retrieve the clause's truth value.
Returns:
true if the clause evaluates to true; false if the clause evaluates to false; or null if the truth value is unknown.

toString

public java.lang.String toString()
Return the clause in text format for display.
Returns:
a String representation of the clause
Overrides:
toString in class java.lang.Object

compareString

protected int compareString(java.lang.String val1,
                            java.lang.String val2)

getRule

public AbleRule getRule()
Retrieve the first rule on the rule reference list.
Returns:
The first rule on the list.

rlString

public java.lang.String rlString()
Return a formal able rule language string.
Returns:
A String describing the object in fuzzy rule language.


xmlString

public java.lang.String xmlString()
Return a formal XML string.
Returns:
A String describing the object in XML.


setClauseWeight

public void setClauseWeight(double theClauseWeight)

getClauseWeight

public double getClauseWeight()

ABLE, Version 1.1b

ABLE: Produced by Joe, Don, and Jeff who say, 'Thanks for your support.'