public class ASTNodeFactory extends Object implements IParserFactory
| Modifier and Type | Field and Description |
|---|---|
static String[] |
HEADER_STRINGS |
static ASTNodeFactory |
MMA_STYLE_FACTORY |
static String[] |
OPERATOR_STRINGS |
static Operator[] |
OPERATORS |
static int |
PLUS_PRECEDENCE |
static int |
TIMES_PRECEDENCE |
DEFAULT_OPERATOR_CHARACTERS| Constructor and Description |
|---|
ASTNodeFactory()
Create a default ASTNode factory
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addOperator(HashMap<String,Operator> operatorMap,
HashMap<String,ArrayList<Operator>> operatorTokenStartSet,
String operatorStr,
String headStr,
Operator oper) |
FunctionNode |
createAST(ASTNode headExpr)
Creates a new list with no arguments from the given header object .
|
ASTNode |
createDouble(String doubleString)
Create an double node from the given double value string
|
FractionNode |
createFraction(IntegerNode numerator,
IntegerNode denominator)
Create a "fractional" number
|
FunctionNode |
createFunction(SymbolNode head)
Creates a new function with head
head and 0 arguments. |
FunctionNode |
createFunction(SymbolNode head,
ASTNode arg0)
Creates a new function with head
head and 1 argument. |
FunctionNode |
createFunction(SymbolNode head,
ASTNode arg0,
ASTNode arg1)
Creates a new function with head
head and 2 arguments. |
static InfixOperator |
createInfixOperator(String operatorStr,
String headStr,
int precedence,
int grouping) |
IntegerNode |
createInteger(int intValue)
Create an integer node from the given value
|
IntegerNode |
createInteger(String integerString,
int numberFormat)
Create an integer node from the given string
|
static PostfixOperator |
createPostfixOperator(String operatorStr,
String headStr,
int precedence) |
static PrefixOperator |
createPrefixOperator(String operatorStr,
String headStr,
int precedence) |
SymbolNode |
createSymbol(String symbolName)
Create a symbol from the scanned identifier string
|
Operator |
get(String identifier)
Get the operator for a given identifier string like Times, Plus, Sin,...
|
String |
getConstantSymbol(String key) |
Map<String,Operator> |
getIdentifier2OperatorMap()
public Map
|
Map<String,ArrayList<Operator>> |
getOperator2ListMap()
public Map
|
String |
getOperatorCharacters()
The set of characters, which could form an operator
|
List<Operator> |
getOperatorList(String key)
public List
|
public static final int PLUS_PRECEDENCE
public static final int TIMES_PRECEDENCE
public static final String[] HEADER_STRINGS
public static final String[] OPERATOR_STRINGS
public static final Operator[] OPERATORS
public static final ASTNodeFactory MMA_STYLE_FACTORY
public static void addOperator(HashMap<String,Operator> operatorMap, HashMap<String,ArrayList<Operator>> operatorTokenStartSet, String operatorStr, String headStr, Operator oper)
public String getOperatorCharacters()
IParserFactorygetOperatorCharacters in interface IParserFactorypublic Map<String,Operator> getIdentifier2OperatorMap()
getIdentifier2OperatorMap in interface IParserFactorypublic Operator get(String identifier)
IParserFactoryget in interface IParserFactorypublic Map<String,ArrayList<Operator>> getOperator2ListMap()
getOperator2ListMap in interface IParserFactorypublic List<Operator> getOperatorList(String key)
getOperatorList in interface IParserFactorypublic String getConstantSymbol(String key)
getConstantSymbol in interface IParserFactorypublic static InfixOperator createInfixOperator(String operatorStr, String headStr, int precedence, int grouping)
public static PrefixOperator createPrefixOperator(String operatorStr, String headStr, int precedence)
public static PostfixOperator createPostfixOperator(String operatorStr, String headStr, int precedence)
public ASTNode createDouble(String doubleString)
IParserFactorycreateDouble in interface IParserFactorypublic FunctionNode createFunction(SymbolNode head)
IParserFactoryhead and 0 arguments.createFunction in interface IParserFactorypublic FunctionNode createFunction(SymbolNode head, ASTNode arg0)
IParserFactoryhead and 1 argument.createFunction in interface IParserFactorypublic FunctionNode createFunction(SymbolNode head, ASTNode arg0, ASTNode arg1)
IParserFactoryhead and 2 arguments.createFunction in interface IParserFactorypublic FunctionNode createAST(ASTNode headExpr)
createAST in interface IParserFactorypublic IntegerNode createInteger(String integerString, int numberFormat)
IParserFactorycreateInteger in interface IParserFactoryintegerString - the integer number represented as a StringnumberFormat - the format of the number (usually 10)public IntegerNode createInteger(int intValue)
IParserFactorycreateInteger in interface IParserFactoryintValue - the integer number's valuepublic FractionNode createFraction(IntegerNode numerator, IntegerNode denominator)
IParserFactorycreateFraction in interface IParserFactorynumerator - numerator of the fractional numberdenominator - denominator of the fractional numberpublic SymbolNode createSymbol(String symbolName)
IParserFactorycreateSymbol in interface IParserFactoryCopyright © 2017 Java Wikipedia API (Bliki engine). All rights reserved.