wugle.expression
Class AbstractUnaryOperator

java.lang.Object
  |
  +--wugle.expression.AbstractExpression
        |
        +--wugle.expression.AbstractUnaryOperator
All Implemented Interfaces:
java.lang.Cloneable, Expression, Operator, UnaryOperator
Direct Known Subclasses:
Not

public abstract class AbstractUnaryOperator
extends AbstractExpression
implements UnaryOperator

An abstract implementation of UnaryOperator.

AbstractUnaryOperator provides a basic implementation of UnaryOperator, but is not meant to be a full class. Subclasses should implement the appropriate operation interfaces.

Version:
0.1.3
Author:
Jacob Perkins

Field Summary
 
Fields inherited from class wugle.expression.AbstractExpression
log, operation
 
Constructor Summary
AbstractUnaryOperator(java.lang.String symbol, ExpressionOperation operation, Expression child)
          Initializes the Expression and sets the initial child Expression.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this Expression.
 Expression getChild()
          Gets the child Expression.
 boolean isEqual(Expression expression)
          Tests if this Expression is equal to the given Expression.
 void setChild(Expression child)
          Sets the child Expression.
 void setChild(Expression oldChild, Expression newChild)
          Replaces a current child Expression with a new child Expression
 java.lang.String toString()
          Gets the String representation of the Expression.
 
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.Expression
getParent, getSymbol, setParent
 

Constructor Detail

AbstractUnaryOperator

public AbstractUnaryOperator(java.lang.String symbol,
                             ExpressionOperation operation,
                             Expression child)
Initializes the Expression and sets the initial child Expression.

Parameters:
symbol - Symbol representing this Operator
operation - Object for delegating operations to
child - Child Expression
Method Detail

toString

public java.lang.String toString()
Description copied from class: AbstractExpression
Gets the String representation of the Expression.

Overrides:
toString in class AbstractExpression
Returns:
The symbol representing the Expression
See Also:
AbstractExpression.getSymbol()

clone

public java.lang.Object clone()
Description copied from interface: Expression
Returns a copy of this Expression.

Specified by:
clone in interface Expression
Overrides:
clone in class AbstractExpression
Returns:
Copy of the Expression

isEqual

public boolean isEqual(Expression expression)
Description copied from interface: Expression
Tests if this Expression is equal to the given Expression.

Specified by:
isEqual in interface Expression
Parameters:
expression - Expression to compare to
Returns:
true if they are equal

setChild

public void setChild(Expression oldChild,
                     Expression newChild)
Description copied from interface: Operator
Replaces a current child Expression with a new child Expression

Specified by:
setChild in interface Operator
Parameters:
oldChild - Child Expression to replace
newChild - Replacement child Expression
See Also:
setChild(Expression)

getChild

public Expression getChild()
Description copied from interface: UnaryOperator
Gets the child Expression.

Specified by:
getChild in interface UnaryOperator
Returns:
The child Expression, or null if none
See Also:
UnaryOperator.setChild(Expression)

setChild

public void setChild(Expression child)
Description copied from interface: UnaryOperator
Sets the child Expression.

Specified by:
setChild in interface UnaryOperator
Parameters:
child - The new child Expression, or null for no child
See Also:
UnaryOperator.getChild()