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 GeneralFunctionparseInfix(String infix)static GeneralFunctionparsePostfix(List<String> postfix)Parses an array of postfix tokens into aGeneralFunctionstatic GeneralFunctionparseSimplified(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
GeneralFunctioncorresponding to the infix string
-
parseSimplified
Parses infix usingparseInfix(String), then minimally simplifies the output- Parameters:
infix- infix string- Returns:
- a
GeneralFunctioncorresponding to the infix string, minimally simplified
-
parsePostfix
Parses an array of postfix tokens into aGeneralFunction- Parameters:
postfix- array of tokens in postfix- Returns:
- a
GeneralFunctioncorresponding 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
-