public class FormulaAst extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FormulaAst.Type
The type of a formula AST node.
|
Modifier and Type | Method and Description |
---|---|
static FormulaAst |
channel(String channelName)
A CHANNEL node representing the given channel name.
|
static FormulaAst |
channelFromToken(String token)
A CHANNEL node from a quoted token.
|
boolean |
equals(Object obj) |
static FormulaAst |
floatingPoint(double floatingPoint)
A FLOATING_POINT node from the given value.
|
static FormulaAst |
floatingPointFromToken(String token)
A FLOATING_POINT node from a token.
|
static FormulaAst |
formula(String formula)
The AST corresponding to the parsed formula.
|
List<FormulaAst> |
getChildren()
The children of this node, if IO, null otherwise.
|
FormulaAst.Type |
getType()
The type of the AST node.
|
Object |
getValue()
The value corresponding to the node.
|
int |
hashCode() |
static FormulaAst |
id(String id)
An ID node representing the given id.
|
static FormulaAst |
integer(int integer)
An INTEGER node from the given value.
|
static FormulaAst |
integerFromToken(String token)
An INTEGER node from a token.
|
List<String> |
listChannelNames()
Lists all the channel names used in the AST.
|
static FormulaAst |
op(String opName,
FormulaAst... children)
An OP node representing the given operator/function with the given
arguments.
|
static FormulaAst |
op(String opName,
List<FormulaAst> children)
An OP node representing the given operator/function with the given
arguments.
|
static FormulaAst |
singleChannel(String formula)
The AST corresponding to a single channel, if the formula represents one,
or null, if the formula is not a single channel.
|
static FormulaAst |
string(String unquotedString)
A STRING node representing the given string.
|
static FormulaAst |
stringFromToken(String token)
A STRING node from a quoted token.
|
FormulaAst |
substituteChannels(Map<String,FormulaAst> substitutions)
Returns a new AST where the channel nodes that match the keys of the map
are substituted with the values of the map.
|
DesiredRateExpression<?> |
toExpression()
Converts the AST to a datasource expression.
|
String |
toString() |
public FormulaAst.Type getType()
public Object getValue()
public List<FormulaAst> getChildren()
public List<String> listChannelNames()
public static FormulaAst stringFromToken(String token)
token
- the quoted stringpublic static FormulaAst string(String unquotedString)
unquotedString
- the stringpublic static FormulaAst integerFromToken(String token)
token
- a string parsable to an integerpublic static FormulaAst integer(int integer)
integer
- the integer valuepublic static FormulaAst floatingPointFromToken(String token)
token
- a string parseable to a doublepublic static FormulaAst floatingPoint(double floatingPoint)
floatingPoint
- the double valuepublic static FormulaAst channelFromToken(String token)
token
- the quoted channel namepublic static FormulaAst channel(String channelName)
channelName
- the channel namepublic static FormulaAst id(String id)
id
- the idpublic static FormulaAst op(String opName, FormulaAst... children)
opName
- the name of the operator/functionchildren
- the node childrenpublic static FormulaAst op(String opName, List<FormulaAst> children)
opName
- the name of the operator/functionchildren
- the node childrenpublic static FormulaAst formula(String formula)
formula
- the string to be parsedpublic static FormulaAst singleChannel(String formula)
formula
- the string to be parsedpublic DesiredRateExpression<?> toExpression()
public FormulaAst substituteChannels(Map<String,FormulaAst> substitutions)
substitutions
- from channel name to new ASTCopyright © 2015. All rights reserved.