Exemplo n.º 1
0
  public Trans findTrans(Set<Trans> s, UniverseCell c) {
    double a = c.getAvg();
    Trans last = null;

    for (Trans t : s) {
      if (a < t.getLimit()) {
        return t;
      }
      last = t;
    }

    return last;
  }
Exemplo n.º 2
0
  public void processCell(int row, int col) {
    Movement[] movements = getMovements();

    UniverseCell acc = this.sourceUniverse.getCellFactory().factor();
    UniverseCell thisCell = this.sourceUniverse.get(row, col);
    UniverseCell targetCell = this.targetUniverse.get(row, col);
    Trans trans = findTrans(stepTrans, thisCell);

    for (Movement movement : movements) {
      int otherRow = row + movement.getRowMovement();
      int otherCol = col + movement.getColumnmMovement();
      if (this.sourceUniverse.isValid(otherRow, otherCol)) {
        UniverseCell otherCell = this.sourceUniverse.get(otherRow, otherCol);
        UniverseCell tp = trans.calculate(otherCell);
        ((ContinuousCell) acc).add(tp);
      }
    }

    Trans trans2 = findTrans(finalTrans, acc);
    acc = trans2.calculate(acc);
    ((ContinuousCell) acc).clamp(0, 1);
    targetCell.copy(acc);
  }