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
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LogicBinaryOperator
public LogicBinaryOperator(java.lang.String symbol,
Expression leftChild,
Expression rightChild)
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