|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
scphEditor.CloneableObservable
scphEditor.OperandVector
scphEditor.Operand
scphEditor.Expression
scphEditor.ExpressionNary
public class ExpressionNary
This class represents n-ary compound expressions.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class scphEditor.Expression |
---|
Expression.Replacement |
Field Summary |
---|
Fields inherited from class scphEditor.Expression |
---|
children, op, paren, splitted |
Constructor Summary | |
---|---|
ExpressionNary(IOperator opOf)
Constructs an n-ary Expression object with the given operator. |
|
ExpressionNary(IOperator opOf,
int n)
Constructs an n-ary Expression object with the given operator. |
Method Summary | |
---|---|
void |
acceptVisitor(OperandVisitor v)
Calls v.visitExpressionNary(this). |
void |
addChild(Operand newChild,
int atIndex)
This implementation does not do anything. |
Operand |
delChild(int atIndex)
This implementation returns null and does not do anything else. |
void |
group(int atIndex,
int n)
|
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. |
protected int |
ungroup_impl(int atIndex)
The bulk of ungroup(). |
void |
ungroup(int atIndex)
Ungroups at the given index. |
Methods inherited from class scphEditor.Expression |
---|
addParen, clone, countChildren, deParen, getChild, getChildren, getOperator, getParen, getSplit, setSplit |
Methods inherited from class scphEditor.Operand |
---|
ensureParen, needParen, removeParen |
Methods inherited from class scphEditor.CloneableObservable |
---|
addObserver, 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 |
---|
public ExpressionNary(IOperator opOf)
opOf
- the operator object for this Expression object.public ExpressionNary(IOperator opOf, int n)
opOf
- the operator object for this Expression objectn
- number of initial null children to set upMethod Detail |
---|
public void setChild(Operand newChild, int atIndex)
OperandVector
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.
setChild
in class Expression
newChild
- the new childatIndex
- the index to where newChild goespublic void addChild(Operand newChild, int atIndex)
Expression
addChild
in class Expression
public Operand delChild(int atIndex)
Expression
delChild
in class Expression
public void ungroup(int atIndex)
Example: if I am 0 + (x + y) + 2, then ungroup(1) turns me into 0 + x + y + 2.
atIndex
- the given index.public void group(int atIndex, int n)
protected int ungroup_impl(int atIndex)
atIndex
- ungrouping occurs at my child at this index.
addChild(scphEditor.Operand, int)
,
ungroup(int)
public void acceptVisitor(OperandVisitor v)
acceptVisitor
in class Expression
v
- the visitor object that wants to visit this operand.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |