34 protected $operators = [
'<=',
'<',
'=',
'>=',
'>',
'<>',
'&',
'|'];
55 if ($nodes[
'type'] ==
'group') {
56 foreach ($nodes[
'nodes'] as $key => $child) {
57 if ($child[
'type'] ==
'group') {
58 $nodes[
'nodes'][$key] = $this->
create($child);
62 foreach ($this->operators as $next_operator) {
65 for ($i = 0; $i < count($nodes[
'nodes']); $i++) {
66 if (!is_object($nodes[
'nodes'][$i]) && $nodes[
'nodes'][$i][
'type'] ==
'operator' && $nodes[
'nodes'][$i][
'value'] == $next_operator) {
73 $operator = $operation_manufacture->manufacture($nodes[
'nodes'][$index][
'value']);
75 $operator->setNegated($nodes[
"negated"]);
79 $new_nodes = array_slice($nodes[
'nodes'], 0, $index - 1);
80 $new_nodes[] = $operator;
81 $nodes[
'nodes'] = array_merge($new_nodes, array_slice($nodes[
'nodes'], $index + 2));
83 }
while ($index >= 0);
85 return $nodes[
'nodes'][0];
88 'need node structure with type group as input' 105 $expression = $node[
'nodes'][$index];
107 $expression = $manufacturer->manufacture($node[
'nodes'][$index][
'value']);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
create(array $nodes)
Creates a composite tree structure from a nodes tree.
static _getInstance()
Get an Instance of ExpressionManufacturer.
static _getInstance()
Get an Instance of OperationManufacturer.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getExpression(array $node, $index)
Manufacure an expression from the delivered node and the index.