com.agentfactory.logic.lang
Class BeliefSentence

java.lang.Object
  extended by com.agentfactory.logic.lang.FOS
      extended by com.agentfactory.logic.lang.BeliefSentence
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class BeliefSentence
extends FOS

Class used to hold composits of beliefs to be used by agents. Such a structure makes it easy to check whether the agent believe X & (Y | Z) and so forth. This structure is based around a prefix notiation i.e. we deal with AND(BELIEF(X),BELIEF(Y)) rather than BELIEF(X) & BELIEF(Y). If in time we wish to give the user the option to write in infix notation, a filter could be wrote to convert the infix input into a prefix format for this class.

See Also:
Serialized Form

Field Summary
static int CLASS_LOG_LEVEL
          Set the logging level of this class
 
Constructor Summary
BeliefSentence(FOS inFOS)
          Construct a BeliefSentence out of an FOS.
BeliefSentence(java.lang.String inString)
          Construct a BeliefSentence out of a raw string.
 
Method Summary
 boolean checkSyntax(FOS inFOS)
          Check that the syntax of this FOS extnesion matches that required for a FOS TODO - RR - make sure this matches the actual syntax of a belief sentence Note: We are allowed to create !BELIEFs but that is not to say that the agent will be allowed to believe in a !BELIEF
 java.lang.Object clone()
          Produce a clone of the current clone method.
 BeliefSentence makeCopy()
          Static method to copy a BeliefSentence
 boolean sameMeaningAs(BeliefSentence inBS)
          Check whether one BeliefSentence has the same meaning as another.
 java.lang.String toString()
          Output a string representation f the BELIEF sentence
 
Methods inherited from class com.agentfactory.logic.lang.FOS
addArgument, apply, argAt, atArgPut, copy, equals, getArguments, getConstants, getFunctor, getVariables, isCompatibleFunction, isComposite, isDifferentTo, isDistinctConstant, isDistinctFunction, isFalse, isNot, isNotFunctional, isRule, isSameAs, isTrue, isVariable, matches, numArguments, privateReplaceConstants, putArguments, putArguments, putFunctor, realCopy, replaceConstants, replaceVariableWith
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_LOG_LEVEL

public static final int CLASS_LOG_LEVEL
Set the logging level of this class

See Also:
Constant Field Values
Constructor Detail

BeliefSentence

public BeliefSentence(java.lang.String inString)
Construct a BeliefSentence out of a raw string. Throws IllegalArguementException if there were any problems with the format.


BeliefSentence

public BeliefSentence(FOS inFOS)
Construct a BeliefSentence out of an FOS. Throws IllegalArguementException if there were any problems with the format.

Method Detail

checkSyntax

public boolean checkSyntax(FOS inFOS)
Check that the syntax of this FOS extnesion matches that required for a FOS TODO - RR - make sure this matches the actual syntax of a belief sentence Note: We are allowed to create !BELIEFs but that is not to say that the agent will be allowed to believe in a !BELIEF


sameMeaningAs

public boolean sameMeaningAs(BeliefSentence inBS)
Check whether one BeliefSentence has the same meaning as another. Using FOS.isSameAs() is not good enough since it would tell us that AND(A,B) != AND(B,A), while this method will tell you that those two operands are matching. Examples : AND(A,B) == AND(B,A) OR(A,B,) == OR(B,A) A == A AND(A,B,C) == AND(A,C,B) but AND(A,B) != AND(A,C) OR(A,C) != OR(A,B) basically eah of the BS operators (and or or) need to have the smae children but it doesn't matter what order these children appear in. This method uses itself recursivly to work its way through the tree TODO - RR - improve this to take negation and De Morgens equations into account.


makeCopy

public BeliefSentence makeCopy()
Static method to copy a BeliefSentence


clone

public java.lang.Object clone()
Produce a clone of the current clone method.

Overrides:
clone in class FOS

toString

public java.lang.String toString()
Output a string representation f the BELIEF sentence

Overrides:
toString in class FOS
Returns:
this as a String