public class Argument extends PrimitiveElement
Using Argument class you can define two argument types:
When creating an argument you should avoid names reserved as parser keywords, in general words known in mathematical language as function names, operators (for example: sin, cos, +, -, etc...). Please be informed that after associating the argument with the expression, function or dependent/recursive argument its name will be recognized by the parser as reserved key word. It means that it could not be the same as any other key word known by the parser for this particular expression. Parser is case sensitive.
RecursiveArgument,
Expression,
Function,
Constant| Modifier and Type | Field and Description |
|---|---|
static double |
ARGUMENT_INITIAL_VALUE
Double.NaN as initial value of the argument.
|
static int |
DEPENDENT_ARGUMENT
Type indicator for dependent argument.
|
static int |
FREE_ARGUMENT
Type indicator for free argument.
|
protected Argument |
n
Index argument.
|
static boolean |
NO_SYNTAX_ERRORS
No syntax errors in the dependent argument definition.
|
static int |
NOT_FOUND
When argument was not not found
|
static int |
RECURSIVE_ARGUMENT
Type indicator for recursive argument.
|
static boolean |
SYNTAX_ERROR_OR_STATUS_UNKNOWN
Syntax error in the dependent argument definition.
|
static String |
TYPE_DESC |
static int |
TYPE_ID
Argument type id for the definition of key words
known by the parser.
|
| Constructor and Description |
|---|
Argument(String argumentName,
double argumentValue)
Constructor - creates free argument.
|
Argument(String argumentDefinitionString,
PrimitiveElement... elements)
Default constructor - creates argument based on the argument definition string.
|
Argument(String argumentName,
String argumentExpressionString,
PrimitiveElement... elements)
Constructor - creates dependent argument(with hidden
argument expression).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addArguments(Argument... arguments)
Adds arguments (variadic) to the argument expression definition.
|
void |
addConstants(Constant... constants)
Adds constants (variadic parameters) to the argument expression definition.
|
void |
addConstants(List<Constant> constantsList)
Adds constants to the argument expression definition.
|
void |
addDefinitions(PrimitiveElement... elements)
Adds user defined elements (such as: Arguments, Constants, Functions)
to the argument expressions.
|
void |
addFunctions(Function... functions)
Adds functions (variadic parameters) to the argument expression definition.
|
boolean |
checkSyntax()
Checks argument syntax
|
Argument |
clone()
Creates cloned object of the this argument.''
|
void |
defineArgument(String argumentName,
double argumentValue)
Enables to define the argument (associated with the argument expression)
based on the argument name and the argument value.
|
void |
defineArguments(String... argumentsNames)
Enables to define the arguments (associated with
the argument expression) based on the given arguments names.
|
void |
defineConstant(String constantName,
double constantValue)
Enables to define the constant (associated with
the argument expression) based on the constant name and
constant value.
|
void |
defineFunction(String functionName,
String functionExpressionString,
String... argumentsNames)
Enables to define the function (associated with
the argument expression) based on the function name,
function expression string and arguments names (variadic parameters).
|
Argument |
getArgument(int argumentIndex)
Gets argument from the argument expression.
|
Argument |
getArgument(String argumentName)
Gets argument from the argument expression.
|
String |
getArgumentExpressionString()
Gets argument expression string
|
int |
getArgumentIndex(String argumentName)
Gets argument index from the argument expression.
|
String |
getArgumentName()
Gets argument name
|
int |
getArgumentsNumber()
Gets number of arguments associated with the argument expression.
|
int |
getArgumentType()
Gets argument type
|
double |
getArgumentValue()
Gets argument value.
|
double |
getComputingTime()
Gets computing time
|
Constant |
getConstant(int constantIndex)
Gets constant associated with the argument expression.
|
Constant |
getConstant(String constantName)
Gets constant associated with the argument expression.
|
int |
getConstantIndex(String constantName)
Gets constant index associated with the argument expression.
|
int |
getConstantsNumber()
Gets number of constants associated with the argument expression.
|
String |
getDescription()
Gets argument description.
|
String |
getErrorMessage()
Returns error message after checking the syntax
|
Function |
getFunction(int functionIndex)
Gets function associated with the argument expression.
|
Function |
getFunction(String functionName)
Gets function associated with the argument expression.
|
int |
getFunctionIndex(String functionName)
Gets index of function associated with the argument expression.
|
int |
getFunctionsNumber()
Gets number of functions associated with the argument expression.
|
boolean |
getRecursiveMode()
Gets recursive mode status
|
boolean |
getVerboseMode()
Returns verbose mode status
|
void |
removeAllArguments()
Removes all arguments associated with the argument expression.
|
void |
removeAllConstants()
Removes all constants
associated with the argument expression
|
void |
removeAllFunctions()
Removes all functions
associated with the argument expression.
|
void |
removeArguments(Argument... arguments)
Removes first occurrences of the arguments
associated with the argument expression.
|
void |
removeArguments(String... argumentsNames)
Removes first occurrences of the arguments
associated with the argument expression.
|
void |
removeConstants(Constant... constants)
Removes first occurrences of the constants
associated with the argument expression
|
void |
removeConstants(String... constantsNames)
Removes first occurrences of the constants
associated with the argument expression.
|
void |
removeDefinitions(PrimitiveElement... elements)
Removes user defined elements (such as: Arguments, Constants, Functions)
from the argument expressions.
|
void |
removeFunctions(Function... functions)
Removes first occurrences of the functions
associated with the argument expression.
|
void |
removeFunctions(String... functionsNames)
Removes first occurrences of the functions
associated with the argument expression.
|
void |
setArgumentExpressionString(String argumentExpressionString)
Sets argument expression string.
|
void |
setArgumentName(String argumentName)
Sets (modifies) argument name.
|
void |
setArgumentValue(double argumentValue)
Sets argument value
|
void |
setDescription(String description)
Sets argument description.
|
void |
setSilentMode()
Disables argument verbose mode (sets default silent mode)
|
void |
setVerboseMode()
Enables argument verbose mode
|
getMyTypeIdpublic static final boolean NO_SYNTAX_ERRORS
public static final boolean SYNTAX_ERROR_OR_STATUS_UNKNOWN
public static final double ARGUMENT_INITIAL_VALUE
public static final int NOT_FOUND
public static final int FREE_ARGUMENT
public static final int DEPENDENT_ARGUMENT
public static final int RECURSIVE_ARGUMENT
public static final int TYPE_ID
public static final String TYPE_DESC
protected Argument n
RecursiveArgumentpublic Argument(String argumentDefinitionString, PrimitiveElement... elements)
argumentDefinitionString - Argument definition string, i.e.:
elements - Optional parameters (comma separated) such as Arguments, Constants, Functionspublic Argument(String argumentName, double argumentValue)
argumentName - the argument nameargumentValue - the argument valuepublic Argument(String argumentName, String argumentExpressionString, PrimitiveElement... elements)
argumentName - the argument nameargumentExpressionString - the argument expression stringelements - Optional parameters (comma separated)
such as Arguments, Constants, FunctionsExpression,
PrimitiveElementpublic void setDescription(String description)
description - the argument description.public String getDescription()
public void setVerboseMode()
public void setSilentMode()
public boolean getVerboseMode()
public boolean getRecursiveMode()
public double getComputingTime()
public void setArgumentName(String argumentName)
argumentName - the argument namepublic void setArgumentExpressionString(String argumentExpressionString)
argumentExpressionString - the argument expression stringExpressionpublic String getArgumentName()
public String getArgumentExpressionString()
public int getArgumentType()
public void setArgumentValue(double argumentValue)
argumentValue - the value of argumentpublic boolean checkSyntax()
public String getErrorMessage()
public double getArgumentValue()
public void addDefinitions(PrimitiveElement... elements)
elements - Elements list (variadic - comma separated) of types: Argument, Constant, FunctionPrimitiveElementpublic void removeDefinitions(PrimitiveElement... elements)
elements - Elements list (variadic - comma separated) of types: Argument, Constant, FunctionPrimitiveElementpublic void addArguments(Argument... arguments)
arguments - the arguments list
(comma separated list)Argument,
RecursiveArgumentpublic void defineArguments(String... argumentsNames)
argumentsNames - the arguments names (variadic)
comma separated listArgument,
RecursiveArgumentpublic void defineArgument(String argumentName, double argumentValue)
argumentName - the argument nameargumentValue - the the argument valueArgument,
RecursiveArgumentpublic int getArgumentIndex(String argumentName)
argumentName - the argument nameArgument,
RecursiveArgumentpublic Argument getArgument(String argumentName)
argumentName - the argument nameArgument,
RecursiveArgumentpublic Argument getArgument(int argumentIndex)
argumentIndex - the argument indexArgument,
RecursiveArgumentpublic int getArgumentsNumber()
Argument,
RecursiveArgumentpublic void removeArguments(String... argumentsNames)
argumentsNames - the arguments names
(variadic parameters) comma separated
listArgument,
RecursiveArgumentpublic void removeArguments(Argument... arguments)
arguments - the arguments (variadic parameters)
comma separated listArgument,
RecursiveArgumentpublic void removeAllArguments()
Argument,
RecursiveArgumentpublic void addConstants(Constant... constants)
constants - the constants
(comma separated list)Constantpublic void addConstants(List<Constant> constantsList)
constantsList - the list of constantsConstantpublic void defineConstant(String constantName, double constantValue)
constantName - the constant nameconstantValue - the constant valueConstantpublic int getConstantIndex(String constantName)
constantName - the constant nameConstantpublic Constant getConstant(String constantName)
constantName - the constant nameConstantpublic Constant getConstant(int constantIndex)
constantIndex - the constant indexConstantpublic int getConstantsNumber()
Constantpublic void removeConstants(String... constantsNames)
constantsNames - the constants names (variadic parameters)
comma separated listConstantpublic void removeConstants(Constant... constants)
constants - the constants (variadic parameters)
comma separated listConstantpublic void removeAllConstants()
Constantpublic void addFunctions(Function... functions)
functions - the functions
(variadic parameters) comma separated listFunctionpublic void defineFunction(String functionName, String functionExpressionString, String... argumentsNames)
functionName - the function namefunctionExpressionString - the expression stringargumentsNames - the function arguments names
(variadic parameters)
comma separated listFunctionpublic int getFunctionIndex(String functionName)
functionName - the function nameFunctionpublic Function getFunction(String functionName)
functionName - the function nameFunctionpublic Function getFunction(int functionIndex)
functionIndex - the function indexFunctionpublic int getFunctionsNumber()
Functionpublic void removeFunctions(String... functionsNames)
functionsNames - the functions names (variadic parameters)
comma separated listFunctionpublic void removeFunctions(Function... functions)
functions - the functions (variadic parameters)
comma separated list.Functionpublic void removeAllFunctions()
FunctionCopyright © 2017. All rights reserved.