ILIAS
release_8 Revision v8.19-1-g4e8f2f9140c
|
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...
Public Member Functions | |
__construct (string $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 (string $token) | |
Check if a given token is a math expression. More... | |
calculateFunctions (string $token) | |
Execute any math functions inside a token. More... | |
getFunctionArgs (int $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 (string $function, array $args=array()) | |
Calculate a function with its arguments. More... | |
calculate (string $operator, $left, $right) | |
Protected Attributes | |
ilDclBaseRecordModel | $record |
ilDclBaseFieldModel | $field |
string | $expression |
Static Protected Attributes | |
static array | $operators |
static array | $cache_tokens = array() |
static array | $cache_fields = array() |
static array | $cache_math_tokens = array() |
static array | $cache_math_function_tokens = array() |
static array | $functions |
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning
Definition at line 19 of file class.ilDclExpressionParser.php.
ilDclExpressionParser::__construct | ( | string | $expression, |
ilDclBaseRecordModel | $record, | ||
ilDclBaseFieldModel | $field | ||
) |
Definition at line 48 of file class.ilDclExpressionParser.php.
References $expression, $field, and $record.
|
protected |
string | $operator | |
float | int | $left | |
float | int | $right |
ilException |
Definition at line 355 of file class.ilDclExpressionParser.php.
Referenced by parseMath().
|
protected |
Calculate a function with its arguments.
ilException |
Definition at line 330 of file class.ilDclExpressionParser.php.
Referenced by calculateFunctions().
|
protected |
Execute any math functions inside a token.
Definition at line 148 of file class.ilDclExpressionParser.php.
References $token, calculateFunction(), getFunctionArgs(), and substituteFieldValues().
Referenced by parse().
|
protected |
float | int | $value |
Definition at line 101 of file class.ilDclExpressionParser.php.
Referenced by parse().
|
protected |
Helper method to return the function and its arguments from a preg_replace_all $result array.
Definition at line 181 of file class.ilDclExpressionParser.php.
Referenced by calculateFunctions().
|
static |
Definition at line 117 of file class.ilDclExpressionParser.php.
Referenced by ilDclFormulaFieldRepresentation\buildFieldCreationInput(), and ilDclTable\getFieldsForFormula().
|
static |
Definition at line 112 of file class.ilDclExpressionParser.php.
Referenced by ilDclFormulaFieldRepresentation\buildFieldCreationInput(), ilDclTable\getFieldsForFormula(), and ilDclTokenizer\getMathTokens().
|
protected |
Check if a given token is a math expression.
Definition at line 125 of file class.ilDclExpressionParser.php.
References $functions, $operators, and $token.
Referenced by parse().
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 61 of file class.ilDclExpressionParser.php.
References $token, calculateFunctions(), formatScientific(), ilDclTokenizer\getMathTokens(), ilDclTokenizer\getTokens(), isMathToken(), parseMath(), and substituteFieldValues().
|
protected |
Parse a math expression.
Exception |
Definition at line 254 of file class.ilDclExpressionParser.php.
References $operators, $token, and calculate().
Referenced by parse().
|
protected |
Given an array of tokens, replace each token that is a placeholder (e.g.
[[Field name]]) with it's value
Definition at line 204 of file class.ilDclExpressionParser.php.
References $DIC, $field, $lng, $token, ilDclBaseFieldModel\getId(), and ilDclCache\getTableCache().
Referenced by calculateFunctions(), and parse().
|
staticprotected |
Definition at line 37 of file class.ilDclExpressionParser.php.
|
staticprotected |
Definition at line 39 of file class.ilDclExpressionParser.php.
|
staticprotected |
Definition at line 38 of file class.ilDclExpressionParser.php.
|
staticprotected |
Definition at line 36 of file class.ilDclExpressionParser.php.
|
protected |
Definition at line 27 of file class.ilDclExpressionParser.php.
Referenced by __construct().
|
protected |
Definition at line 26 of file class.ilDclExpressionParser.php.
Referenced by __construct(), and substituteFieldValues().
|
staticprotected |
Definition at line 41 of file class.ilDclExpressionParser.php.
Referenced by isMathToken().
|
staticprotected |
Definition at line 29 of file class.ilDclExpressionParser.php.
Referenced by isMathToken(), and parseMath().
|
protected |
Definition at line 25 of file class.ilDclExpressionParser.php.
Referenced by __construct().
const ilDclExpressionParser::N_DECIMALS = 1 |
Definition at line 21 of file class.ilDclExpressionParser.php.
const ilDclExpressionParser::SCIENTIFIC_NOTATION_LOWER = 0.000000001 |
Definition at line 23 of file class.ilDclExpressionParser.php.
const ilDclExpressionParser::SCIENTIFIC_NOTATION_UPPER = 1000000000000 |
Definition at line 22 of file class.ilDclExpressionParser.php.