|
Venice 0.7beta | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mov.parser.expression.AbstractExpression
public abstract class AbstractExpression
The abstract base class for all expressions in the Gondola language. This
class implements the Expression interface and provides functions for
managing an expression's child nodes. E.g. the expression 4+5 would
consist of three nodes. The plus being the root node, which would have two
child nodes of 4 and 5.
Expression| Field Summary |
|---|
| Fields inherited from interface org.mov.parser.Expression |
|---|
BOOLEAN_TYPE, FALSE, FLOAT_QUOTE_TYPE, FLOAT_TYPE, INTEGER_QUOTE_TYPE, INTEGER_TYPE, STRING_TYPE, TRUE, TRUE_LEVEL |
| Constructor Summary | |
|---|---|
AbstractExpression()
Create a new expression. |
|
AbstractExpression(int childCount)
Create a new expression with the given number of children. |
|
| Method Summary | |
|---|---|
abstract java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object object)
Returns whether this expression tree and the given expression tree are equivalent. |
Expression |
getChild(int index)
Return the child of this node at the given index. |
int |
getIndex(Expression child)
Return the index of the given argument in the expression. |
static java.text.NumberFormat |
getNumberFormat()
|
Expression |
getParent()
Get the parent of this node. |
int |
hashCode()
If you override the equals(java.lang.Object) method then you should override
this method. |
boolean |
isRoot()
Return whether this node is the root node. |
java.util.Iterator |
iterator()
Return an iterator over the node's children. |
static double |
parseDouble(java.lang.String doubleText)
Parses doubleText from a string to produce a double. |
static int |
parseInt(java.lang.String intText)
Parses intText from a string to produce an integer. |
void |
setChild(Expression child,
int index)
Set this expression's child to the given child. |
void |
setParent(Expression parent)
Set the parent of this node. |
Expression |
simplify()
Perform simplifications and optimisations on the expression tree. |
int |
size()
Count the number of nodes in the tree. |
int |
size(int type)
Count the number of nodes in the tree with the given type. |
static java.lang.Double |
valueOfDouble(java.lang.String doubleText)
Parses doubleText from a string to produce a Double Object. |
static java.lang.Integer |
valueOfInt(java.lang.String intText)
Parses intText from a string to produce an Integer Object. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mov.parser.Expression |
|---|
checkType, evaluate, getChildCount, getType, toString |
| Constructor Detail |
|---|
public AbstractExpression()
public AbstractExpression(int childCount)
childCount - the number of children in the expression.| Method Detail |
|---|
public Expression getParent()
getParent in interface Expressionpublic void setParent(Expression parent)
setParent in interface Expressionparent - the new parent.public Expression getChild(int index)
getChild in interface Expressionindex - the argument index
public boolean isRoot()
isRoot in interface ExpressionTRUE iff this node is the root node.
public void setChild(Expression child,
int index)
setChild in interface Expressionchild - the new child.index - the index of the new child.public Expression simplify()
a and true then the
expression tree would be simplified to a.
simplify in interface Expressionpublic int getIndex(Expression child)
getIndex in interface Expressionchild - the child expression to locate
-1 if it could
not be found
public static double parseDouble(java.lang.String doubleText)
throws java.lang.NumberFormatException
doubleText - the string to be parsed
java.lang.NumberFormatException
public static int parseInt(java.lang.String intText)
throws java.lang.NumberFormatException
intText - the string to be parsed
java.lang.NumberFormatException
public static java.lang.Double valueOfDouble(java.lang.String doubleText)
throws java.lang.NumberFormatException
doubleText - the string to be parsed
java.lang.NumberFormatException
public static java.lang.Integer valueOfInt(java.lang.String intText)
throws java.lang.NumberFormatException
intText - the string to be parsed
java.lang.NumberFormatExceptionpublic static java.text.NumberFormat getNumberFormat()
public boolean equals(java.lang.Object object)
equals in interface Expressionequals in class java.lang.Objectobject - the other expressionpublic int hashCode()
equals(java.lang.Object) method then you should override
this method. It provides a very basic hash code function.
hashCode in interface ExpressionhashCode in class java.lang.Objectpublic int size()
size in interface Expressionpublic int size(int type)
size in interface Expressionpublic java.util.Iterator iterator()
iterator in interface Expressionpublic abstract java.lang.Object clone()
clone in interface Expressionclone in class java.lang.Object
|
Venice 0.7beta | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||