|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--nl.bluering.Expression
Expressions are simple trees. It can be used for anything. An expression consists of an object o and zero or more subexpressions (children). It is common that the object is a string, but depending on your needs it can be something different. (it better be printable if you intend to print it. I can also disrecommend null pointers, but it is not forbidden:-) the problems are yours though).
| Constructor Summary | |
Expression(java.lang.Object s,
int ch)
create an Expression with the object s and room for the given number of children. |
|
| Method Summary | |
Expression |
add(Expression exp)
Adds an Expression to this class as a child. |
int |
getc()
Returns the number of children. |
java.lang.String |
getfunctionstring()
return the primary object if it is a string. |
java.lang.Object |
getobject()
|
java.lang.String |
getprototype()
returns the primary string concatenated with the number of children. this is used to look up functions in hashtables. |
boolean |
isbasic()
Returns if this is a basic function. |
boolean |
isfunction(java.lang.String f)
returns true if the primary object of this Expression is a string that is equal to f. |
boolean |
isfunction(java.lang.String f,
int children)
returns true if the primary object of this Expression is a string that is equal to f,and the number of children is correct. |
void |
setobject(java.lang.Object o)
|
java.lang.String |
toString()
Converts the complete expression to a one-line string, including it's childs. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Expression(java.lang.Object s,
int ch)
s - the object in this expression. Often a stringch - the estimated number of children. You can give any value,
regardless what number of children you will really add, but memory use
is more efficient if it is correct. Note that -1 is allowed: it indicates
that it came in in a notation that does not allow arguments: for instance
"123" and "a" do not allow children, but "f()" does.| Method Detail |
public boolean isfunction(java.lang.String f)
public boolean isfunction(java.lang.String f,
int children)
public java.lang.String getfunctionstring()
public java.lang.String getprototype()
public boolean isbasic()
public Expression add(Expression exp)
public int getc()
public java.lang.Object getobject()
public void setobject(java.lang.Object o)
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||