|
ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Class ilDclExpressionParser. More...
Collaboration diagram for ilDclExpressionParser:Public Member Functions | |
| __construct ($expression, ilDclBaseRecordModel $record, ilDclBaseFieldModel $field) | |
| parse () | |
| Parse expression and return result. More... | |
Static Public Member Functions | |
| static | getOperators () |
| static | getFunctions () |
Data Fields | |
| const | N_DECIMALS = 1 |
| const | SCIENTIFIC_NOTATION_UPPER = 1000000000000 |
| const | SCIENTIFIC_NOTATION_LOWER = 0.000000001 |
Protected Member Functions | |
| formatScientific ($value) | |
| isMathToken ($token) | |
| Check if a given token is a math expression. More... | |
| calculateFunctions ($token) | |
| Execute any math functions inside a token. More... | |
| getFunctionArgs ($index, array $data) | |
| Helper method to return the function and its arguments from a preg_replace_all $result array. More... | |
| substituteFieldValues (array $tokens) | |
| Given an array of tokens, replace each token that is a placeholder (e.g. More... | |
| parseMath (array $tokens) | |
| Parse a math expression. More... | |
| calculateFunction ($function, array $args=array()) | |
| Calculate a function with its arguments. More... | |
| calculate ($operator, $left, $right) | |
Protected Attributes | |
| $record | |
| $field | |
| $expression | |
Static Protected Attributes | |
| static | $operators |
| static | $cache_tokens = array() |
| static | $cache_fields = array() |
| static | $cache_math_tokens = array() |
| static | $cache_math_function_tokens = array() |
| static | $functions |
Class ilDclExpressionParser.
Definition at line 9 of file class.ilDclExpressionParser.php.
| ilDclExpressionParser::__construct | ( | $expression, | |
| ilDclBaseRecordModel | $record, | ||
| ilDclBaseFieldModel | $field | ||
| ) |
| string | $expression | |
| ilDclBaseRecordModel | $record | |
| ilDclBaseFieldModel | $field |
Definition at line 68 of file class.ilDclExpressionParser.php.
References $expression, $field, and $record.
|
protected |
| string | $operator | |
| float | $left | |
| float | $right |
| ilException |
Definition at line 428 of file class.ilDclExpressionParser.php.
References $result.
Referenced by parseMath().
Here is the caller graph for this function:
|
protected |
Calculate a function with its arguments.
| $function | Function name to calculate | |
| array | $args | Arguments of function |
| ilException |
Definition at line 401 of file class.ilDclExpressionParser.php.
References $function.
Referenced by calculateFunctions().
Here is the caller graph for this function:
|
protected |
Execute any math functions inside a token.
| string | $token |
Definition at line 193 of file class.ilDclExpressionParser.php.
References $function, $result, calculateFunction(), getFunctionArgs(), and substituteFieldValues().
Referenced by parse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
| $value |
Definition at line 127 of file class.ilDclExpressionParser.php.
References sprintf.
Referenced by parse().
Here is the caller graph for this function:
|
protected |
Helper method to return the function and its arguments from a preg_replace_all $result array.
| $index | ||
| array | $data |
Definition at line 232 of file class.ilDclExpressionParser.php.
References $data, $function, $i, and $index.
Referenced by calculateFunctions().
Here is the caller graph for this function:
|
static |
Definition at line 155 of file class.ilDclExpressionParser.php.
References $functions.
Referenced by ilDclFormulaFieldRepresentation\buildFieldCreationInput(), and isMathToken().
Here is the caller graph for this function:
|
static |
Definition at line 146 of file class.ilDclExpressionParser.php.
References $operators.
Referenced by ilDclFormulaFieldRepresentation\buildFieldCreationInput(), and ilDclTokenizer\getMathTokens().
Here is the caller graph for this function:
|
protected |
Check if a given token is a math expression.
| string | $token |
Definition at line 168 of file class.ilDclExpressionParser.php.
References $functions, $operators, $result, and getFunctions().
Referenced by parse().
Here is the call graph for this function:
Here is the caller graph for this function:| ilDclExpressionParser::parse | ( | ) |
Parse expression and return result.
This method loops the tokens and checks if Token is of type string or math. Concatenates results to produce resulting string of parsed expression.
| ilException |
Definition at line 84 of file class.ilDclExpressionParser.php.
References calculateFunctions(), formatScientific(), ilDclTokenizer\getMathTokens(), ilDclTokenizer\getTokens(), isMathToken(), parseMath(), and substituteFieldValues().
Here is the call graph for this function:
|
protected |
Parse a math expression.
| array | $tokens |
| Exception |
Definition at line 320 of file class.ilDclExpressionParser.php.
References $operators, $result, calculate(), and parseMath().
Referenced by parse(), and parseMath().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
Given an array of tokens, replace each token that is a placeholder (e.g.
[[Field name]]) with it's value
| array | $tokens |
Definition at line 260 of file class.ilDclExpressionParser.php.
Referenced by calculateFunctions(), and parse().
Here is the caller graph for this function:
|
staticprotected |
Definition at line 43 of file class.ilDclExpressionParser.php.
|
staticprotected |
Definition at line 51 of file class.ilDclExpressionParser.php.
|
staticprotected |
Definition at line 47 of file class.ilDclExpressionParser.php.
|
staticprotected |
Definition at line 39 of file class.ilDclExpressionParser.php.
|
protected |
Definition at line 25 of file class.ilDclExpressionParser.php.
Referenced by __construct().
|
protected |
Definition at line 21 of file class.ilDclExpressionParser.php.
Referenced by __construct().
|
staticprotected |
Definition at line 55 of file class.ilDclExpressionParser.php.
Referenced by getFunctions(), and isMathToken().
|
staticprotected |
Definition at line 29 of file class.ilDclExpressionParser.php.
Referenced by getOperators(), isMathToken(), and parseMath().
|
protected |
Definition at line 17 of file class.ilDclExpressionParser.php.
Referenced by __construct().
| const ilDclExpressionParser::N_DECIMALS = 1 |
Definition at line 11 of file class.ilDclExpressionParser.php.
| const ilDclExpressionParser::SCIENTIFIC_NOTATION_LOWER = 0.000000001 |
Definition at line 13 of file class.ilDclExpressionParser.php.
| const ilDclExpressionParser::SCIENTIFIC_NOTATION_UPPER = 1000000000000 |
Definition at line 12 of file class.ilDclExpressionParser.php.