You are here

private function Matrix::shitAlToRight in Business Rules 8

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

Shift all elements to right.

Parameters

int $distance: The distance to shift.

1 call to Matrix::shitAlToRight()
Matrix::putElementInPosition in src/Util/Flowchart/Matrix.php
Put an element at one position in the matrix.

File

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

Class

Matrix
The matrix to handle the Business Rule flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

private function shitAlToRight($distance = 1) {
  for ($y = 0; $y <= 100; $y++) {
    for ($x = 100; $x >= 0; $x--) {
      $cell = $this->matrix[$x][$y];
      if (!is_null($cell['element'])) {
        $this
          ->putElementInPosition($cell['element'], $x + $distance, $y);
        $this->matrix[$x][$y]['element'] = NULL;
      }
    }
  }
}