Class ExpressionFactory
-
- All Implemented Interfaces:
public final class ExpressionFactory
This utility class provides methods to ease the building and usage of IExpression without parsing.
-
-
Method Summary
Modifier and Type Method Description static IExpression
buildComplexGroundExpression(String s)
Given a single literal (either variable or constant), builds the corresponding expression. static IExpression
buildExpression(double n)
Given a number, builds a numeric expression. static IExpression
buildExpression(HashString s)
Given a single literal (either variable or constant), builds the corresponding expression. static IExpression
buildExpression(String s)
Given a single literal (either variable or constant), builds the corresponding expression. static ITreeNode<out Object>
buildLiteralNode(HashString s)
Given a single literal (either variable or constant), builds the corresponding ITreeNode. static IExpression
wrap(double n)
Given a double, creates a NumTreeNode and wraps it into a ListTreeNode. static IExpression
wrap(HashString s)
Given a HashString, creates the corresponding ITreeNode and wraps it into a ListTreeNode. static IExpression
wrap(Iterable<ITreeNode<out Object>> nodes)
Wraps a collection of ITreeNode into a new List IExpression. static IExpression
wrap(ITreeNode<out Object> node)
Given a node, wraps it into a ListTreeNode. -
-
Method Detail
-
buildComplexGroundExpression
static IExpression buildComplexGroundExpression(String s)
Given a single literal (either variable or constant), builds the corresponding expression.
- Parameters:
s
- MUST BE A SINGLE LITERAL- Returns:
a new expression
-
buildExpression
static IExpression buildExpression(double n)
Given a number, builds a numeric expression.
- Parameters:
n
- a numeric value- Returns:
a new expression
-
buildExpression
static IExpression buildExpression(HashString s)
Given a single literal (either variable or constant), builds the corresponding expression.
- Parameters:
s
- MUST BE A SINGLE LITERAL- Returns:
a new expression
-
buildExpression
static IExpression buildExpression(String s)
Given a single literal (either variable or constant), builds the corresponding expression.
- Parameters:
s
- MUST BE A SINGLE LITERAL- Returns:
a new expression
-
buildLiteralNode
static ITreeNode<out Object> buildLiteralNode(HashString s)
Given a single literal (either variable or constant), builds the corresponding ITreeNode.
- Parameters:
s
- MUST BE A SINGLE LITERAL- Returns:
a new ITreeNode
-
wrap
static IExpression wrap(double n)
Given a double, creates a NumTreeNode and wraps it into a ListTreeNode.
- Parameters:
n
- the node to wrap- Returns:
an IExpression containing the passed element in a set
-
wrap
static IExpression wrap(HashString s)
Given a HashString, creates the corresponding ITreeNode and wraps it into a ListTreeNode.
- Parameters:
s
- the node to wrap- Returns:
an IExpression containing the passed element in a set
-
wrap
static IExpression wrap(Iterable<ITreeNode<out Object>> nodes)
Wraps a collection of ITreeNode into a new List IExpression.
- Parameters:
nodes
- the nodes to wrap- Returns:
an IExpression containing all the elements in a set
-
wrap
static IExpression wrap(ITreeNode<out Object> node)
Given a node, wraps it into a ListTreeNode.
- Parameters:
node
- the node to wrap- Returns:
an IExpression containing the passed element in a set
-
-
-
-