You are here

private function Matrix::getRightCells 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::getRightCells()

Get all not empty cells at right of one element.

Parameters

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

Return value

array Array of cells

1 call to Matrix::getRightCells()
Matrix::shift in src/Util/Flowchart/Matrix.php
Shift cells that contains one element to bottom, left or right.

File

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

Class

Matrix
The matrix to handle the Business Rule flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

private function getRightCells(Element $element) {
  $cell = $this
    ->getCellByElementUuid($element
    ->getUuid());
  $index_x = $cell['index_x'];
  $index_y = $cell['index_y'];
  $elements[] = $cell;
  for ($x = $index_x; $x < 100; $x++) {
    if (!is_null($this->matrix[$x + 1])) {
      $elements[] = $this->matrix[$x + 1][$index_y];
    }
    else {
      return $elements;
    }
  }
  return $elements;
}