Package parsing
Class FunctionParser
Object
FunctionParser
public class FunctionParser
extends Object
FunctionParser
provides the central methods to execute the conversion of a function from a user-inputted string to an instance of GeneralFunction
.-
Method Summary
Modifier and Type Method Description static GeneralFunction
parseInfix(String infix)
static GeneralFunction
parsePostfix(List<String> postfix)
Parses an array of postfix tokens into aGeneralFunction
static GeneralFunction
parseSimplified(String infix)
Parses infix usingparseInfix(String)
, then minimally simplifies the outputstatic List<String>
toPostfix(String infix)
Turns an infix string into a postfix array of tokens
-
Method Details
-
parseInfix
- Parameters:
infix
- infix string- Returns:
- a
GeneralFunction
corresponding to the infix string
-
parseSimplified
Parses infix usingparseInfix(String)
, then minimally simplifies the output- Parameters:
infix
- infix string- Returns:
- a
GeneralFunction
corresponding to the infix string, minimally simplified
-
parsePostfix
Parses an array of postfix tokens into aGeneralFunction
- Parameters:
postfix
- array of tokens in postfix- Returns:
- a
GeneralFunction
corresponding to the postfix string
-
toPostfix
public static List<String> toPostfix(String infix)Turns an infix string into a postfix array of tokens- Parameters:
infix
- input string in infix- Returns:
- an array of postfix tokens
-