/**
  * Get an Instance of ExpressionManufacturer
  *
  * @return ilAssLacExpressionManufacturer
  */
 public static function _getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new ilAssLacExpressionManufacturer();
     }
     return self::$instance;
 }
 /**
  * Manufacure an expression from the delivered node and the index. If an expression already exist in the node for<br />
  * for the delivered index, this function will return the existing expression
  *
  * @param array $node
  * @param int $index
  *
  * @return ilAssLacCompositeInterface
  */
 private function getExpression(array $node, $index)
 {
     $manufacturer = ilAssLacExpressionManufacturer::_getInstance();
     $expression = $node['nodes'][$index];
     if (!$expression instanceof ilAssLacAbstractComposite) {
         $expression = $manufacturer->manufacture($node['nodes'][$index]['value']);
     }
     return $expression;
 }
 /**
  * Cannonicalize the condition into a more general form. <br />
  * It replaces all expression with "n" and all orperators with "o" <br />
  * so that the result of an condition after cannonicalization could be:<br />
  * <br />
  * (n o n) o (n o n) o n
  */
 protected function cannonicalizeCondition()
 {
     $manufacturer = ilAssLacExpressionManufacturer::_getInstance();
     $this->condition = preg_replace($manufacturer->getPattern(), 'n', $this->condition);
     $manufacturer = ilAssLacOperationManufacturer::_getInstance();
     $this->condition = preg_replace($manufacturer->getPattern(), 'o', $this->condition);
     $this->condition = preg_replace("/no/", "n o", $this->condition);
     $this->condition = preg_replace("/on/", "o n", $this->condition);
     for ($i = 0; $i < strlen($this->condition); $i++) {
         if ($this->condition[$i] == "!" && !$this->isNegationSurroundedByBrackets($i)) {
             $this->surroundNegationExpression($i);
         }
     }
 }