Package me.zpath
Class Term
java.lang.Object
me.zpath.Term
A term is a basic unit of the parsed ZPath, which may be a token like "+",
a string or number constant, a path like "parent/child", a function, or
an expression like "(name=="test" || age+3 < 5)".
This class is only of interest to people implementing their own Function
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TermThe "&&" Tokenstatic final intA value that can be passed intoaxisKey(java.lang.Object, int)to mean "applies to any index"static final TermThe "!"static final TermThe "&" Tokenstatic final TermThe "|" Tokenstatic final TermThe "^" Tokenstatic final TermThe ":" Tokenstatic final TermThe "," Tokenstatic final TermThe "."static final TermThe ".."static final TermThe "..*" Tokenstatic final TermThe "===" Tokenstatic final TermThe "==" Tokenstatic final TermThe ">=" Tokenstatic final TermThe ">" Tokenstatic final TermThe "[" Tokenstatic final TermThe "<=" Tokenstatic final TermThe "(" Tokenstatic final TermThe "<" Tokenstatic final TermThe "-" Tokenstatic final TermThe "!static final TermThe "!static final TermThe "||;" Tokenstatic final TermThe "%" Tokenstatic final TermThe "+" Tokenstatic final TermThe "?"static final TermThe "]" Tokenstatic final TermThe ")" Tokenstatic final TermThe "/" Tokenstatic final TermThe "*" Tokenstatic final TermThe "**" Tokenstatic final TermThe "~" Tokenstatic final TermThe whitespace Token -
Method Summary
Modifier and TypeMethodDescriptionEvaluate this Term.booleanReturn true if this Term is a booleanbooleanisDelim()Return true if this Term is a known delimiterbooleanisExpr()Return true if this Term is an expressionbooleanReturn true if this Term is a functionbooleanisIndex()Return true if this Term is an indexbooleanReturn true if this Term is an integerbooleanisName()Return true if this Term is a name (an unquoted string)booleanisNumber()Return true if this Term is an integer or a real numberbooleanisPath()Return true if this Term is a pathbooleanisReal()Return true if this Term is an real numberbooleanisString()Return true if this Term is a stringdefault voidlog(Configuration.Logger logger) Write this object to the specified LoggerIf this term is a number, return the value as a doubleIf this term is a string, return the value as a stringtoString()
-
Field Details
-
WS
The whitespace Token -
DOT
The "." Token -
DOTDOT
The ".." Token -
DOTDOTSTAR
The "..*" Token -
LBRACE
The "[" Token -
RBRACE
The "]" Token -
LPAREN
The "(" Token -
RPAREN
The ")" Token -
BANG
The "!" Token -
TILDE
The "~" Token -
STAR
The "*" Token -
STARSTAR
The "**" Token -
SLASH
The "/" Token -
PERCENT
The "%" Token -
PLUS
The "+" Token -
MINUS
The "-" Token -
GT
The ">" Token -
LT
The "<" Token -
GE
The ">=" Token -
LE
The "<=" Token -
EQ
The "==" Token -
NE
The "!=" Token -
EEQ
The "===" Token -
NEE
The "!-=" Token -
BITAND
The "&" Token -
CARET
The "^" Token -
BITOR
The "|" Token -
AND
The "&&" Token -
OR
The "||;" Token -
QUESTION
The "?" Token -
COLON
The ":" Token -
COMMA
The "," Token -
ANYINDEX
static final int ANYINDEXA value that can be passed intoaxisKey(java.lang.Object, int)to mean "applies to any index"- See Also:
-
-
Method Details
-
toString
-
isDelim
public boolean isDelim()Return true if this Term is a known delimiter- Returns:
- true if it's a delimiter
-
isString
public boolean isString()Return true if this Term is a string- Returns:
- true if it's a string
-
isInteger
public boolean isInteger()Return true if this Term is an integer- Returns:
- true if it's an integer
-
isReal
public boolean isReal()Return true if this Term is an real number- Returns:
- true if it's a real
-
isIndex
public boolean isIndex()Return true if this Term is an index- Returns:
- true if it's an index
-
isNumber
public boolean isNumber()Return true if this Term is an integer or a real number- Returns:
- true if it's a number
-
isBoolean
public boolean isBoolean()Return true if this Term is a boolean- Returns:
- true if it's a boolean
-
isName
public boolean isName()Return true if this Term is a name (an unquoted string)- Returns:
- true if it's a name
-
isFunction
public boolean isFunction()Return true if this Term is a function- Returns:
- true if it's a function
-
isPath
public boolean isPath()Return true if this Term is a path- Returns:
- true if it's a function
-
isExpr
public boolean isExpr()Return true if this Term is an expression- Returns:
- true if it's a function
-
numberValue
If this term is a number, return the value as a double- Returns:
- the value of the term as a double
- Throws:
IllegalStateException- if its not a double
-
stringValue
If this term is a string, return the value as a string- Returns:
- the value of the term as a string
- Throws:
IllegalStateException- if its not a string
-
eval
Evaluate this Term.- Parameters:
in- the set of Objects that are the current context - will never be emptyout- if this Term evaluates to one or more Objects, they should be added to this collectioncontext- the context
-
log
Write this object to the specified Logger- Parameters:
logger- the logger
-