Release Planner v1.0

rp.expn
Class OperatorExpn

java.lang.Object
  |
  +--java.util.Observable
        |
        +--rp.expn.Expn
              |
              +--rp.expn.OperatorExpn
All Implemented Interfaces:
java.util.Observer
Direct Known Subclasses:
BinaryOperatorExpn, NaryOperatorExpn, UnaryOperatorExpn

public abstract class OperatorExpn
extends Expn
implements java.util.Observer

A generic node in an expression tree.

Version:
$Revision: 1.2 $, $Date: 2001/05/23 19:26:22 $

Field Summary
protected  java.util.Vector operands
           
 
Constructor Summary
OperatorExpn()
           
 
Method Summary
 int getNumOperands()
          Gets the number of operands for this operator.
 Expn[] getOperand()
          Gets all the operands at once.
 Expn getOperand(int i)
          Gets the i'th operand (0-based) of this operator.
protected  void setNumOperands(int n)
          Sets the number of operands for this operator.
protected  void setOperand(Expn[] newOperands)
          Sets all the operands at once Either this method or setNumOperands must be called before any other
protected  void setOperand(int i, Expn newOperand)
          Sets the i'th operand (0-based) to the given expression.
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class rp.expn.Expn
getScalarMean
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operands

protected java.util.Vector operands
Constructor Detail

OperatorExpn

public OperatorExpn()
Method Detail

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

setNumOperands

protected void setNumOperands(int n)
Sets the number of operands for this operator. Either this method or setOperand(Expn[]) must be called before any other.

Parameters:
n - the number of operands

getNumOperands

public int getNumOperands()
Gets the number of operands for this operator.

Returns:
the number of operands

setOperand

protected void setOperand(int i,
                          Expn newOperand)
Sets the i'th operand (0-based) to the given expression. If the expression is null, cleanly removes the previous i'th operand.

Parameters:
i - the index (0-based) of the operand to set

setOperand

protected void setOperand(Expn[] newOperands)
Sets all the operands at once Either this method or setNumOperands must be called before any other


getOperand

public Expn getOperand(int i)
Gets the i'th operand (0-based) of this operator.

Parameters:
i - the index (0-based) of the operand to get
Returns:
the i'th operand

getOperand

public Expn[] getOperand()
Gets all the operands at once.

Returns:
an aray containing all the operands

Release Planner v1.0