Examples of CACell


Examples of org.jamesii.model.carules.CACell

    return result;
  }

  @Override
  public ICACell getCell(int... coord) {
    return new CACell(coords[coord[0]][coord[1]], data[(coord[0])
        + (coord[1] * size[0])]);
  }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

  @Override
  public List<ICACell> getCellList() {
    List<ICACell> res = new ArrayList<>();
    for (int i = 0; i < size[0]; i++) {
      for (int j = 0; j < size[1]; j++) {
        res.add(new CACell(coords[i][j], data[i + (j * size[0])]));
      }
    }

    return res;
  }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

    return result;
  }

  @Override
  public ICACell getCell(int... coord) {
    return new CACell(coords[coord[0]], data[coord[0]]);
  }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

  @Override
  public List<ICACell> getCellList() {
    List<ICACell> res = new ArrayList<>();
    for (int i = 0; i < width; i++) {
      res.add(new CACell(coords[i], data[i]));
    }
    return res;
  }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

    return result;
  }

  @Override
  public ICACell getCell(int... coord) {
    return new CACell(coord, getState(coord));
  }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

    int[] currentCellCoords = new int[size.length];
    for (int i = 0; i < size.length; i++) {
      currentCellCoords[i] = 0;
    }
    CACell currentCell = new CACell(currentCellCoords, 0);
    int cellNumber = 1; // Max number of cells
    for (int element : size) {
      cellNumber = cellNumber * element;
    }

    for (int i = 0; i < cellNumber; i++) {
      result.add(currentCell.clone());
    }

    int[] temp;
    currentCell = null;
    int currentCellPosition = 0;
    int last = 1;
    for (int i = 0; i < size.length; i++) {
      while (currentCellPosition < cellNumber) {
        for (int j = 0; j < size[i]; j++) {
          for (int k = 0; k < last; k++) {
            currentCell = (CACell) result.get(currentCellPosition);
            temp = currentCell.getPosition();
            temp[i] = j;
            currentCell.setPosition(temp);
            if (i == size.length - 1) {
              currentCell.setState(getState(temp));
            }
            result.set(currentCellPosition, currentCell);
            currentCellPosition++;
          }
        }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

   */
  public void initGrid() {
    this.cells = new CACell[this.width];

    for (int i = 0; i < this.width; i++) {
      this.cells[i] = new CACell(new int[] { i }, this.defaultState);
    }

    this.isInit = true;
    calculateHashCode();
  }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

      System.arraycopy(cells, 0, c, 0, newWidth);
    }
    if (newWidth > width) {
      System.arraycopy(cells, 0, c, 0, width);
      for (int i = width; i < newWidth; i++) {
        c[i] = new CACell(new int[] { i }, this.defaultState);
      }

    }
    cells = c;
    this.width = newWidth;
View Full Code Here

Examples of org.jamesii.model.carules.CACell

    int[] currentCellCoords = new int[2];
    for (int i = 0; i < 2; i++) {
      currentCellCoords[i] = 0;
    }
    CACell currentCell = new CACell(currentCellCoords, 0);
    int cellNumber = 1; // Max number of cells
    for (int i = 0; i < 2; i++) {
      cellNumber = cellNumber * getSize()[i];
    }

    for (int i = 0; i < cellNumber; i++) {
      result.add(currentCell.clone());
    }

    int[] temp;
    currentCell = null;
    int currentCellPosition = 0;
    int last = 1;
    for (int i = 0; i < 2; i++) {
      while (currentCellPosition < cellNumber) {
        for (int j = 0; j < getSize()[i]; j++) {
          for (int k = 0; k < last; k++) {
            currentCell = (CACell) result.get(currentCellPosition);
            temp = currentCell.getPosition();
            temp[i] = j;
            currentCell.setPosition(temp);
            if (i == 1) {
              currentCell.setState(getState(temp));
            }
            result.set(currentCellPosition, currentCell);
            currentCellPosition++;
          }
        }
View Full Code Here

Examples of org.jamesii.model.carules.CACell

  public void initGrid() {
    cells = new CACell[width][height];

    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        cells[x][y] = new CACell(new int[] { x, y }, getDefaultState());
      }
    }
    this.isInit = true;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.