Skip to content
Snippets Groups Projects
Commit 68c45383 authored by dragapsy's avatar dragapsy
Browse files

MAJ

parent c1e580c0
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@ package model;
import javafx.scene.paint.Color;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
......@@ -9,6 +11,21 @@ public class SquareCell extends AbstractCell{
List<Cell> neighbours;
public SquareCell(){
setColor(AbstractCell.DEFAULT_CELL_COLOR);
setNeighbours(null);
}
public SquareCell( Color color){
setColor(color);
setNeighbours(null);
}
public SquareCell(Color color,List<Cell>neighbours){
SquareCell Cell=new SquareCell(color);
setNeighbours( neighbours);
}
/**
* A cell is placed somewhere on a grid. Its neighbours thus depend on the underlying grid.
......@@ -17,7 +34,7 @@ public class SquareCell extends AbstractCell{
*/
@Override
public List<Cell> getNeighbours() {
return null;
return neighbours;
}
/**
......@@ -28,6 +45,17 @@ public class SquareCell extends AbstractCell{
*/
@Override
public void setNeighbours(List<Cell> cells) {
if (cells==null){
neighbours=new ArrayList<>();
}
else {
neighbours=new ArrayList<>();
for (Cell value:cells)
{
neighbours.add(value);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment