You are here

private function Matrix::putElementInPosition in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Util/Flowchart/Matrix.php \Drupal\business_rules\Util\Flowchart\Matrix::putElementInPosition()

Put an element at one position in the matrix.

Parameters

\Drupal\business_rules\Util\Flowchart\Element $element: The element.

int $x: The X position.

int $y: The Y position.

Throws

\Exception

4 calls to Matrix::putElementInPosition()
Matrix::putElement in src/Util/Flowchart/Matrix.php
Put an element inside the matrix.
Matrix::putRootElement in src/Util/Flowchart/Matrix.php
Put the root element at the matrix.
Matrix::shift in src/Util/Flowchart/Matrix.php
Shift cells that contains one element to bottom, left or right.
Matrix::shitAlToRight in src/Util/Flowchart/Matrix.php
Shift all elements to right.

File

src/Util/Flowchart/Matrix.php, line 292

Class

Matrix
The matrix to handle the Business Rule flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

private function putElementInPosition(Element $element, $x, $y) {
  if ($x < 0) {
    $this
      ->shitAlToRight(-$x);
    $x = 0;
  }
  if (is_null($this->matrix[$x][$y]['element'])) {
    $this->matrix[$x][$y]['element'] = $element;
  }
  else {
    throw new \Exception("The position {$x}, {$y} is not empty.");
  }
}