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 enumThe 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 TypeMethodDescriptionintgetNextOffset.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- aCollectionobjecttype- aExpressionParser.RestrictionTypeobject
-
-
Method Details
-
parseExpression
Parses the given expression, or throws an exception if its not possible.- Parameters:
expression- aStringobject- Returns:
- a
Expressionobject - Throws:
ParseException- if any.
-
parseEquation
Parses an equation of the form Variable = Expression.- Parameters:
equation- aStringobject- Returns:
- a
Equationobject - Throws:
ParseException- if any.
-
getNextOffset
public int getNextOffset()getNextOffset.
- Returns:
- a int
-
getParameters
Getter for the field
parameters.- Returns:
- a
Listobject
-