wugle.expression.logic
Class LogicBinaryOperator

java.lang.Object
  |
  +--wugle.expression.AbstractExpression
        |
        +--wugle.expression.AbstractBinaryOperator
              |
              +--wugle.expression.logic.LogicBinaryOperator
All Implemented Interfaces:
Associative, BinaryOperator, java.lang.Cloneable, Commutative, DeMorgans, Distributive, Dominatable, DoubleNegatable, Expression, Idempotent, Identity, Operator, Tautology
Direct Known Subclasses:
And, Or

public abstract class LogicBinaryOperator
extends AbstractBinaryOperator
implements Associative, Commutative, DeMorgans, Distributive, Dominatable, DoubleNegatable, Idempotent, Identity, Tautology

Version:
0.1.3
Author:
Jacob Perkins

Field Summary
 
Fields inherited from class wugle.expression.AbstractExpression
log, operation
 
Constructor Summary
LogicBinaryOperator(java.lang.String symbol, Expression leftChild, Expression rightChild)
           
 
Method Summary
 Associative associateLeft()
          Tries to perform the Associative Law to the right.
 Associative associateRight()
          Tries to perform the Associative Law to the right.
 boolean canAssociateLeft()
          Tests if can perform the Associative Law to the left.
 boolean canAssociateRight()
          Tests if can perform the Associative Law to the right.
 boolean canDeMorgans()
           
 boolean canDistributeExpand()
           
 boolean canDistributeReduce()
           
 boolean canIdempotent()
           
 boolean canIdentity()
           
 boolean canTautology()
           
 void commute()
          Performs the Commutative Law.
abstract  DeMorgans deMorgans()
           
 Distributive distributeExpand()
           
 Distributive distributeReduce()
           
 Dominator dominate()
           
 DoubleNegatable doubleNegate()
           
 Expression idempotent()
           
 void idempotent(Expression child)
           
 Expression identity()
           
 void identity(Expression child)
           
abstract  TruthValue tautology()
           
 
Methods inherited from class wugle.expression.AbstractBinaryOperator
clone, getLeftChild, getRightChild, isEqual, setChild, setLeftChild, setRightChild, toString
 
Methods inherited from class wugle.expression.AbstractExpression
getParent, getSymbol, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wugle.expression.BinaryOperator
getLeftChild, getRightChild, setLeftChild, setRightChild
 
Methods inherited from interface wugle.expression.Operator
setChild
 
Methods inherited from interface wugle.expression.Expression
clone, getParent, getSymbol, isEqual, setParent
 
Methods inherited from interface wugle.expression.Dominatable
canDominate
 
Methods inherited from interface wugle.expression.Identity
identityElement
 

Constructor Detail

LogicBinaryOperator

public LogicBinaryOperator(java.lang.String symbol,
                           Expression leftChild,
                           Expression rightChild)
Method Detail

canAssociateLeft

public boolean canAssociateLeft()
Description copied from interface: Associative
Tests if can perform the Associative Law to the left.

Specified by:
canAssociateLeft in interface Associative
Returns:
true if the left child is the same class as this
See Also:
Associative.associateLeft(), ExpressionOperation.canAssociateLeft(Associative)

associateLeft

public Associative associateLeft()
                          throws java.lang.Exception
Description copied from interface: Associative
Tries to perform the Associative Law to the right. This will transform (p v q) v r to p v (q v r), which is the inverse of the associate right operation.

Specified by:
associateLeft in interface Associative
Returns:
The transformed expression
Throws:
java.lang.Exception - if the operation cannot be performed
See Also:
Associative.associateRight(), Associative.canAssociateLeft(), ExpressionOperation.associateLeft(Associative)

canAssociateRight

public boolean canAssociateRight()
Description copied from interface: Associative
Tests if can perform the Associative Law to the right.

Specified by:
canAssociateRight in interface Associative
Returns:
true if the right child is the same class as this
See Also:
Associative.associateRight(), ExpressionOperation.canAssociateRight(Associative)

associateRight

public Associative associateRight()
                           throws java.lang.Exception
Description copied from interface: Associative
Tries to perform the Associative Law to the right. This will transform p v (q v r) to (p v q) v r, which is the inverse of the associate left operation.

Specified by:
associateRight in interface Associative
Returns:
The transformed expression
Throws:
java.lang.Exception - if the operation cannot be performed
See Also:
Associative.associateLeft(), Associative.canAssociateRight(), ExpressionOperation.associateRight(Associative)

commute

public void commute()
Description copied from interface: Commutative
Performs the Commutative Law. This will transform p v q to q v p.

Specified by:
commute in interface Commutative
See Also:
ExpressionOperation.commute(Commutative)

canDeMorgans

public boolean canDeMorgans()
Specified by:
canDeMorgans in interface DeMorgans

deMorgans

public abstract DeMorgans deMorgans()
                             throws java.lang.Exception
Specified by:
deMorgans in interface DeMorgans
java.lang.Exception

canDistributeExpand

public boolean canDistributeExpand()
Specified by:
canDistributeExpand in interface Distributive

distributeExpand

public Distributive distributeExpand()
                              throws java.lang.Exception
Specified by:
distributeExpand in interface Distributive
java.lang.Exception

canDistributeReduce

public boolean canDistributeReduce()
Specified by:
canDistributeReduce in interface Distributive

distributeReduce

public Distributive distributeReduce()
                              throws java.lang.Exception
Specified by:
distributeReduce in interface Distributive
java.lang.Exception

dominate

public Dominator dominate()
                   throws java.lang.Exception
Specified by:
dominate in interface Dominatable
java.lang.Exception

doubleNegate

public DoubleNegatable doubleNegate()
Specified by:
doubleNegate in interface DoubleNegatable

canIdempotent

public boolean canIdempotent()
Specified by:
canIdempotent in interface Idempotent

idempotent

public Expression idempotent()
                      throws java.lang.Exception
Specified by:
idempotent in interface Idempotent
java.lang.Exception

idempotent

public void idempotent(Expression child)
Specified by:
idempotent in interface Idempotent

canIdentity

public boolean canIdentity()
Specified by:
canIdentity in interface Identity

identity

public Expression identity()
                    throws java.lang.Exception
Specified by:
identity in interface Identity
java.lang.Exception

identity

public void identity(Expression child)
Specified by:
identity in interface Identity

canTautology

public boolean canTautology()
Specified by:
canTautology in interface Tautology

tautology

public abstract TruthValue tautology()
                              throws java.lang.Exception
Specified by:
tautology in interface Tautology
java.lang.Exception