ILIAS
Release_5_0_x_branch Revision 61816
|
Class ilDclExpressionParser. More...
Public Member Functions | |
__construct ($expression, ilDataCollectionRecord $record, ilDataCollectionField $field) | |
parse () | |
Parse expression and return result. |
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. | |
calculateFunctions ($token) | |
Execute any math functions inside a token. | |
getFunctionArgs ($index, array $data) | |
Helper method to return the function and its arguments from a preg_replace_all $result array. | |
substituteFieldValues (array $tokens) | |
Given an array of tokens, replace each token that is a placeholder (e.g. | |
parseMath (array $tokens) | |
Parse a math expression. | |
calculateFunction ($function, array $args=array()) | |
Calculate a function with its arguments. | |
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, | |
ilDataCollectionRecord | $record, | ||
ilDataCollectionField | $field | ||
) |
string | $expression | |
ilDataCollectionRecord | $record | |
ilDataCollectionField | $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 416 of file class.ilDclExpressionParser.php.
References $result.
Referenced by parseMath().
|
protected |
Calculate a function with its arguments.
$function | Function name to calculate | |
array | $args | Arguments of function |
ilException |
Definition at line 390 of file class.ilDclExpressionParser.php.
Referenced by calculateFunctions().
|
protected |
Execute any math functions inside a token.
string | $token |
Definition at line 187 of file class.ilDclExpressionParser.php.
References $result, calculateFunction(), getFunctionArgs(), and substituteFieldValues().
Referenced by parse().
|
protected |
$value |
Definition at line 125 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.
$index | ||
array | $data |
Definition at line 225 of file class.ilDclExpressionParser.php.
Referenced by calculateFunctions().
|
static |
Definition at line 151 of file class.ilDclExpressionParser.php.
References $functions.
Referenced by ilDataCollectionFieldEditGUI\initForm(), and isMathToken().
|
static |
Definition at line 143 of file class.ilDclExpressionParser.php.
References $operators.
Referenced by ilDclTokenizer\getMathTokens(), and ilDataCollectionFieldEditGUI\initForm().
|
protected |
Check if a given token is a math expression.
string | $token |
Definition at line 163 of file class.ilDclExpressionParser.php.
References $functions, $operators, $result, and getFunctions().
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 83 of file class.ilDclExpressionParser.php.
References calculateFunctions(), formatScientific(), ilDclTokenizer\getMathTokens(), ilDclTokenizer\getTokens(), isMathToken(), parseMath(), and substituteFieldValues().
|
protected |
Parse a math expression.
array | $tokens |
Exception |
Definition at line 309 of file class.ilDclExpressionParser.php.
References $operators, $result, 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
array | $tokens |
Definition at line 252 of file class.ilDclExpressionParser.php.
Referenced by calculateFunctions(), and parse().
|
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.