|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectchrriis.uihierarchy.util.HStringTokenizer
A tokenizer with a hierarchy of tokens, used to parse a String with groups
and operations.
The format of the string to parse is: "expression" or "expression1,
expression2, ...".
An expression is composed of operations between expressions, groups and/or
functions. It can use the '=' sign as a group separator.
An operation is defined by the use of one of these operators: '+', '-', '*'
and '/'.
A group is defined by the use of surrounding '(' and ')', '[' and ']', or '{'
and '}'.
A function is the same as a group, but is prefixed by a function name.
The tokenization priorities , from highest to lowest, are: ',', '=', '*' and
'/', '+' and '-'. Groups and functions are processed as single expressions,
which are themselves tokenized.
The tokens that are generated reflect the groups and operations. The root
token contains the full text as a token, and no operator (with value 0 that
is). Its subtokens (from 0 to n) reflect the expressions.
The getOperator() indicates the operation, group or function
that links subtokens. The operator is one of '=', '+', '-', '*', '/', '(',
'[' or '{'. For functions, the getToken() returns the name of
the function.
For example "x=5+3*max(2, min(1, 3)), -5*-3" is decomposed into the
following tree of tokens (notation is "operator, text"):
0, "x=5+3*max(2, min(1, 3)), -5*-3"
'=', null
0, "x"
'+', null
0, "5"
'*', null
0, "3"
'(', "max"
0, "2"
'(', "min"
0, "1"
0, "3"
'*', null
'-', null
(null token)
0, "5"
'-', null
(null token)
0, "-3"
| Constructor Summary | |
HStringTokenizer(String text)
Construct a tokenizer for the particular text. |
|
| Method Summary | |
char |
getOperator()
Get the operator. |
HStringTokenizer[] |
getSubTokenizers()
Get the sub tokenizers. |
String |
getToken()
Get the token. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HStringTokenizer(String text)
text - The text to break into grouped tokens.| Method Detail |
public char getOperator()
public String getToken()
public HStringTokenizer[] getSubTokenizers()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||