org.vizzini.ai.logic
Class AbstractComplexSentence

java.lang.Object
  extended by org.vizzini.util.AbstractBean
      extended by org.vizzini.ai.logic.AbstractSentence
          extended by org.vizzini.ai.logic.AbstractComplexSentence
All Implemented Interfaces:
Cloneable, IComplexSentence, ISentence
Direct Known Subclasses:
ComplexSentenceAND, ComplexSentenceIFF, ComplexSentenceIMPLIES, ComplexSentenceNOT, ComplexSentenceOR

public abstract class AbstractComplexSentence
extends AbstractSentence
implements IComplexSentence

Provides base functionality for complex sentences in the logic system. A complex sentence consists of a left argument, a connective, and a right argument. The sentence evaluates to true or false in the context of a given item.

Since:
v0.2
Version:
v0.2
Author:
Jeffrey M. Thompson

Field Summary
 
Fields inherited from class org.vizzini.util.AbstractBean
IGNORE_PROPERTIES
 
Constructor Summary
AbstractComplexSentence(ISentence left, ISentence right)
          Construct this object using the given parameters.
 
Method Summary
 Object clone()
          Return a clone of this instance.
 ISentence getLeft()
          Return the left sentence.
 ISentence getRight()
          Return the right sentence.
 boolean isChild(ISentence child)
          Return true if the given sentence is a child of this.
protected  boolean isLeftRequired()
          Return true if the left sentence is required.
 void replaceChild(ISentence oldChild, ISentence newChild)
          Replace the given old child sentence with the given new child sentence if there is a match.
protected  void setLeft(ISentence left)
           
protected  void setRight(ISentence right)
           
 
Methods inherited from class org.vizzini.ai.logic.AbstractSentence
getDescription, setDescription
 
Methods inherited from class org.vizzini.util.AbstractBean
appendArray, appendCollection, appendList, appendMap, compareBooleans, compareObjects, equals, getIgnoreProperties, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.ai.logic.IComplexSentence
getConnective
 
Methods inherited from interface org.vizzini.ai.logic.ISentence
evaluate, getDescription, setDescription
 

Constructor Detail

AbstractComplexSentence

public AbstractComplexSentence(ISentence left,
                               ISentence right)
Construct this object using the given parameters.

Parameters:
left -
right -
Since:
v0.2
Method Detail

clone

public Object clone()
Return a clone of this instance.

Specified by:
clone in interface ISentence
Overrides:
clone in class AbstractSentence
Since:
v0.2

getLeft

public ISentence getLeft()
Description copied from interface: IComplexSentence
Return the left sentence.

Specified by:
getLeft in interface IComplexSentence
Returns:
Return left.
Since:
v0.2

getRight

public ISentence getRight()
Description copied from interface: IComplexSentence
Return the right sentence.

Specified by:
getRight in interface IComplexSentence
Returns:
Return right.
Since:
v0.2

isChild

public boolean isChild(ISentence child)
Return true if the given sentence is a child of this.

Specified by:
isChild in interface IComplexSentence
Parameters:
child - Candidate child sentence. (required)
Since:
v0.2

replaceChild

public void replaceChild(ISentence oldChild,
                         ISentence newChild)
Replace the given old child sentence with the given new child sentence if there is a match.

Specified by:
replaceChild in interface IComplexSentence
Parameters:
oldChild - Old child sentence. (required)
newChild - New child sentence. (required)
Since:
v0.2

isLeftRequired

protected boolean isLeftRequired()
Return true if the left sentence is required.

Since:
v0.2

setLeft

protected void setLeft(ISentence left)
Parameters:
left - The left to set.
Since:
v0.2

setRight

protected void setRight(ISentence right)
Parameters:
right - The right to set. (required)
Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02