Package org.openhab.core.voice.text
Class ASTNode
java.lang.Object
org.openhab.core.voice.text.ASTNode
Abstract syntax tree node. Result of parsing an expression.
- Author:
- Tilman Kamp - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionBreadth searching this (sub-) tree/node for a node with the given name.Breadth searches this (sub-) tree/node for a node with the given name and returning its value.Breadth searches this (sub-) tree/node for a node with the given name and type and returning its value.findValueAsString
(String name) Breadth searches this (sub-) tree/node for a node with the given name and returning its value as aString
.String[]
findValueAsStringArray
(String name) Breadth searches this (sub-) tree/node for a node with the given name and returning its value as aString[]
.ASTNode[]
getName()
getTag()
getValue()
String[]
boolean
void
setChildren
(ASTNode[] children) void
void
setRemainingTokens
(TokenList remainingTokens) void
setSuccess
(boolean success) void
void
-
Constructor Details
-
ASTNode
public ASTNode() -
ASTNode
Constructs a new AST node.- Parameters:
children
- the node's childrenremainingTokens
- remaining token list starting with the first token that was not covered/consumed
-
-
Method Details
-
findNode
Breadth searching this (sub-) tree/node for a node with the given name.- Parameters:
name
- the name that's used for looking up the tree- Returns:
- first node with the given name or null, if none was found
-
getValueAsStringArray
- Returns:
- the value of this node as
String[]
-
getValueAsString
- Returns:
- the value of this node as
String
.
-
findValueAsStringArray
Breadth searches this (sub-) tree/node for a node with the given name and returning its value as aString[]
.- Parameters:
name
- the name of the named node to be found- Returns:
- the value of the resulting node as
String[]
or null if not found
-
findValueAsString
Breadth searches this (sub-) tree/node for a node with the given name and returning its value as aString
.- Parameters:
name
- the name of the named node to be found- Returns:
- the value of the resulting node as
String
or null if not found
-
findValue
Breadth searches this (sub-) tree/node for a node with the given name and type and returning its value.- Parameters:
name
- the name of the named node to be foundcls
- the node's value has to be assignable to a reference of this class to match during search- Returns:
- the value of the resulting node. Null, if not found or the value does not match
cls
.
-
findValue
Breadth searches this (sub-) tree/node for a node with the given name and returning its value.- Parameters:
name
- the name of the named node to be found- Returns:
- the value of the resulting node. Null, if not found.
-
isSuccess
public boolean isSuccess()- Returns:
- if the node is a valid one (true) or parsing was not successful (false)
-
setSuccess
public void setSuccess(boolean success) - Parameters:
success
- if the node is a valid one (true) or parsing was not successful (false)
-
getChildren
- Returns:
- the children
-
setChildren
- Parameters:
children
- the children to set
-
getRemainingTokens
- Returns:
- the remainingTokens
-
setRemainingTokens
- Parameters:
remainingTokens
- the remainingTokens to set
-
getName
- Returns:
- the name
-
setName
- Parameters:
name
- the name to set
-
getValue
- Returns:
- the value
-
setValue
- Parameters:
value
- the value to set
-
getTag
- Returns:
- the tag
-
setTag
- Parameters:
tag
- the tag to set
-