Package edu.cmu.tetrad.calculator.parser
Class ExpressionParser
java.lang.Object
edu.cmu.tetrad.calculator.parser.ExpressionParser
Parses a string into a tree-like expression.
- Version:
- $Id: $Id
- Author:
- Tyler Gibson
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The type of restriction on parameters. -
Constructor Summary
ConstructorsConstructorDescriptionConstructrs a parser that has no allowable parameters.ExpressionParser
(Collection<String> parameters, ExpressionParser.RestrictionType type) Constructs the parser given a collection of allowable parameters. -
Method Summary
Modifier and TypeMethodDescriptionint
getNextOffset.Getter for the fieldparameters
.parseEquation
(String equation) Parses an equation of the form Variable = Expression.parseExpression
(String expression) Parses the given expression, or throws an exception if its not possible.
-
Constructor Details
-
ExpressionParser
public ExpressionParser()Constructrs a parser that has no allowable parameters. -
ExpressionParser
Constructs the parser given a collection of allowable parameters.- Parameters:
parameters
- aCollection
objecttype
- aExpressionParser.RestrictionType
object
-
-
Method Details
-
parseExpression
Parses the given expression, or throws an exception if its not possible.- Parameters:
expression
- aString
object- Returns:
- a
Expression
object - Throws:
ParseException
- if any.
-
parseEquation
Parses an equation of the form Variable = Expression.- Parameters:
equation
- aString
object- Returns:
- a
Equation
object - Throws:
ParseException
- if any.
-
getNextOffset
public int getNextOffset()getNextOffset.
- Returns:
- a int
-
getParameters
-