Class CompositeBuilder.
More...
|
| $operators = array('<=','<','=','>=','>','<>','&','|') |
|
|
| getExpression (array $node, $index) |
| Manufacure an expression from the delivered node and the index. More...
|
|
Class CompositeBuilder.
Date: 27.03.13 Time: 12:18
- Author
- Thomas Joußen tjous.nosp@m.sen@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Definition at line 10 of file ilAssLacCompositeBuilder.php.
◆ __construct()
ilAssLacCompositeBuilder::__construct |
( |
| ) |
|
Construct requirements.
Definition at line 23 of file ilAssLacCompositeBuilder.php.
25 include_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Factory/ilAssLacOperationManufacturer.php';
26 include_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Factory/ilAssLacExpressionManufacturer.php';
◆ create()
ilAssLacCompositeBuilder::create |
( |
|
$nodes | ) |
|
- Parameters
-
- Returns
- array
Definition at line 34 of file ilAssLacCompositeBuilder.php.
References ilAssLacOperationManufacturer\_getInstance(), and getExpression().
36 if($nodes[
'type'] ==
'group')
38 foreach($nodes[
'nodes'] as $key => $child)
40 $nodes[
'nodes'][$key] = $this->
create($child);
43 foreach($this->operators as $next_operator)
47 for($i = 0; $i < count($nodes[
'nodes']); $i++)
49 if(!is_object($nodes[
'nodes'][$i]) && $nodes[
'nodes'][$i][
'type'] ==
'operator' && $nodes[
'nodes'][$i][
'value'] == $next_operator)
58 $operator = $operation_manufacture->manufacture($nodes[
'nodes'][$index][
'value']);
60 $operator->setNegated($nodes[
"negated"]);
64 $new_nodes = array_slice($nodes[
'nodes'], 0, $index - 1);
65 $new_nodes[] = $operator;
66 $nodes[
'nodes'] = array_merge($new_nodes, array_slice($nodes[
'nodes'], $index + 2));
70 return $nodes[
'nodes'][0];
static _getInstance()
Get an Instance of OperationManufacturer.
getExpression(array $node, $index)
Manufacure an expression from the delivered node and the index.
◆ getExpression()
ilAssLacCompositeBuilder::getExpression |
( |
array |
$node, |
|
|
|
$index |
|
) |
| |
|
private |
Manufacure an expression from the delivered node and the index.
If an expression already exist in the node for
for the delivered index, this function will return the existing expression
- Parameters
-
- Returns
- ilAssLacCompositeInterface
Definition at line 84 of file ilAssLacCompositeBuilder.php.
References ilAssLacExpressionManufacturer\_getInstance().
Referenced by create().
88 $expression = $node[
'nodes'][$index];
91 $expression = $manufacturer->manufacture($node[
'nodes'][$index][
'value']);
static _getInstance()
Get an Instance of ExpressionManufacturer.
◆ $operators
ilAssLacCompositeBuilder::$operators = array('<=','<','=','>=','>','<>','&','|') |
|
protected |
The documentation for this class was generated from the following file: