Skip to content
Snippets Groups Projects
GrayCell.java 1.43 KiB
Newer Older
  • Learn to ignore specific revisions
  • TRAVERS Corentin's avatar
    TRAVERS Corentin committed
    package model;
    
    import javafx.beans.property.Property;
    import javafx.scene.paint.Color;
    
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
    import java.util.ArrayList;
    import java.util.Iterator;
    
    TRAVERS Corentin's avatar
    TRAVERS Corentin committed
    import java.util.List;
    
    public class GrayCell extends AbstractCell{
    
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
        Cell[][] cells;
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
        int nberOfRows;
        int nberOfColums;
        List<Cell> neighbours;
    
        public GrayCell(Cell[][] cells, int rows, int colums){
            this.cells=new Cell[rows][colums];
            this.nberOfRows=rows;
            this.nberOfColums=colums;
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
    
    
        }
        public GrayCell(){}
    
    TRAVERS Corentin's avatar
    TRAVERS Corentin committed
        public static final Cell GRAY_CELL = new GrayCell();
    
        /**
         * A cell is placed somewhere on a grid. Its neighbours thus depend on the underlying grid.
         *
         * @return the list of cell that are neighbours of this{@code Cell}.
         */
        @Override
        public List<Cell> getNeighbours() {
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
            List<Cell> neighbours= new ArrayList<Cell>();
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
            for(int i=0; i< nberOfRows;i++){
                for(int j=0; j< nberOfColums;j++){
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
    
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
                }
            }
    
            return neighbours;
    
    TRAVERS Corentin's avatar
    TRAVERS Corentin committed
        }
    
        /**
         * Update the list of neighbours of this {@code Cell}.
         *
         * @param cells a list of cells that are the neighbours of this {@code cell}
         *              int the underlying grid.
         */
        @Override
        public void setNeighbours(List<Cell> cells) {
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
            this.neighbours=cells;
    
    NGUYEN Thi hang's avatar
    NGUYEN Thi hang committed
        @Override
        public Iterator<Cell> iterator() {
            return null;
        }
    
    
    TRAVERS Corentin's avatar
    TRAVERS Corentin committed
        @Override
        public void setColor(Color color){
    
        }
    }