scphEditor
Class Work

java.lang.Object
  extended by java.util.Observable
      extended by scphEditor.CloneableObservable
          extended by scphEditor.OperandVector
              extended by scphEditor.Work
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Work
extends OperandVector

This class models an scphEditor document, a list of operands and stuff.

When a Work object changes, it will call notifyOberservers() with an Integer object as a parameter:

See Also:
Serialized Form

Constructor Summary
Work()
          Constructor.
 
Method Summary
 void addChild(Operand newChild, int atIndex)
           
 int countChildren()
          Gives the actual, present number of my children.
 Operand delChild(int atIndex)
           
 Operand getChild(int atIndex)
          Gives my child at the given index.
 java.util.Enumeration getChildren()
          Enumerates all of my children, in ascending order of indexes.
 void setChild(Operand newChild, int atIndex)
          Adopts the given new child as my child at the given index, replacing the previous child at the same index.
 
Methods inherited from class scphEditor.CloneableObservable
addObserver, clone, cloneObserverList, cloneObserverList, countObservers, deleteObserver, deleteObservers, notifyObservers, notifyObservers
 
Methods inherited from class java.util.Observable
clearChanged, hasChanged, setChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Work

public Work()
Constructor.

Method Detail

setChild

public void setChild(Operand newChild,
                     int atIndex)
Description copied from class: OperandVector
Adopts the given new child as my child at the given index, replacing the previous child at the same index.

This default implementation is for a leaf node in which there must be no child, so it always throws an exception. A compound expression must re-implement this method sensibly.

Overrides:
setChild in class OperandVector
Parameters:
newChild - the new child
atIndex - the index to where newChild goes

addChild

public void addChild(Operand newChild,
                     int atIndex)
Overrides:
addChild in class OperandVector

delChild

public Operand delChild(int atIndex)
Overrides:
delChild in class OperandVector

getChild

public Operand getChild(int atIndex)
Description copied from class: OperandVector
Gives my child at the given index.

This default implementation is for a leaf node in which there is no child, so it always throws an exception. A compound expression must re-implement this method sensibly.

Overrides:
getChild in class OperandVector
Parameters:
atIndex - the index at where a child will be sought.
Returns:
the child at the index. (For leaf nodes, this does not make sense.)

getChildren

public java.util.Enumeration getChildren()
Description copied from class: OperandVector
Enumerates all of my children, in ascending order of indexes.

This default implementation returns an ``empty'' Enumeration, i.e., one that has no element at all, which makes sense for leaf nodes. A compound expression must override this behaviour sensibly.

Overrides:
getChildren in class OperandVector
Returns:
an Enumeration that iterates over my children in ascending order of indexes. (For leaf nodes, returns an ``empty'' Enumeration.)

countChildren

public int countChildren()
Description copied from class: OperandVector
Gives the actual, present number of my children.

This default implementation returns zero, as a leaf node has no child.

Overrides:
countChildren in class OperandVector
Returns:
the present number of my children. (Zero for leaf nodes.)