|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.Node<E>
public abstract class Node<E>
A node in a parser scheme. The implementation is very basic and does only define principle methods. The concrete parsing of some object into the operator of the node and it sub-nodes must be implemnted by concrete subclasses.
| Field Summary | |
|---|---|
private boolean |
isParsed
True if the node has been successfully parsed. |
private int |
level
The level of the node. |
private Node<E> |
parent
The parent of the node. |
private E |
parse
The object this node can be parsed out. |
private Node<E>[] |
sub
The sub-nodes. |
private Operator<E> |
tie
The operator of this node. |
private E |
value
The value of the node. |
| Constructor Summary | |
|---|---|
protected |
Node(E description)
A basic constructor for a root node. |
protected |
Node(Node<E> superior,
E description,
int layer)
A basic constructor for sub nodes. |
| Method Summary | |
|---|---|
boolean |
equals(Node that)
Compares to nodes for equality. |
int |
getLevel()
Returns the level of this node. |
Node<E> |
getParent()
Returns the parent of this node. |
E |
getParseSource()
Returns the object this node should be parsed from. |
Node<E>[] |
getSub()
Returns the sub nodes. |
Node<E> |
getSubAt(int index)
Returns a single sub node. |
int |
getSubNodeNumber()
Returns the number of sub nodes. |
Operator<E> |
getTie()
Returns the node operator. |
E |
getValue()
Returns the value of this node. |
Set<E> |
getVariables()
Uses the parsed node to dive recursively into all subnodes and piles up a variable list. |
boolean |
isFinal()
Returns true if this node is a final node. |
boolean |
isParsed()
Returns true if this node has already been parsed. |
boolean |
isRoot()
Returns true if this node is the root node. |
protected boolean |
isVariable(E arg)
Return true if the value object is a variable. |
void |
parse()
Parses this node. |
void |
parse(E source)
Parses the object to derive sub nodes and node operator if any. |
protected abstract Operator<E> |
parseOperator(E src)
Parses the source for this nodes operator. |
protected abstract Node<E>[] |
parseSub(E src)
Parses the source for this nodes sub-nodes. |
protected void |
setParse(boolean value)
Sets the parsed flag. |
protected void |
setParseSource(E source)
Sets the object this node should be parsed from. |
protected void |
setSub(Node<E>[] subnodes)
Sets the sub nodes. |
protected void |
setTie(Operator<E> op)
Sets the node operator. |
void |
setValue(E result)
Sets the value of this node. |
String |
toString()
A String representation of this Node. |
protected void |
traceVariable(Set<E> accu,
Node<E> node)
Stores the value of this node in the argument set if final. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private Node<E> parent
private Operator<E> tie
private Node<E>[] sub
private int level
private E parse
private E value
private boolean isParsed
| Constructor Detail |
|---|
protected Node(E description)
parse.
protected Node(Node<E> superior,
E description,
int layer)
parse.
| Method Detail |
|---|
public Operator<E> getTie()
protected void setTie(Operator<E> op)
protected void setSub(Node<E>[] subnodes)
public Node<E>[] getSub()
throws ParseException
ParseException
public Node<E> getSubAt(int index)
throws ParseException
ParseException
public int getSubNodeNumber()
throws ParseException
ParseExceptionpublic boolean isRoot()
public boolean isFinal()
public int getLevel()
public Node<E> getParent()
public E getParseSource()
protected void setParseSource(E source)
public E getValue()
public void setValue(E result)
public void parse()
throws ParseException
ParseExceptionpublic boolean isParsed()
protected void setParse(boolean value)
public void parse(E source)
throws ParseException
setParse(boolean) to indicate successful parsing.
ParseExceptionpublic Set<E> getVariables()
protected void traceVariable(Set<E> accu,
Node<E> node)
protected boolean isVariable(E arg)
public boolean equals(Node that)
public String toString()
toString in class Object
protected abstract Operator<E> parseOperator(E src)
throws ParseException
ParseException
protected abstract Node<E>[] parseSub(E src)
throws ParseException
ParseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||