package controller;

import java.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import simulationObjects.Cell;
import simulationObjects.PredatorCell;


public class GridManager {
    private Cell[][] grid;

    public GridManager (int size)
    {

    }

    /*
     * public void fillGrid(int CellType)
     * {
     * for(Cell[] row : grid){
     * Arrays.fill(row, new PredatorCell());
     * }
     * }
     */

    public void update ()
    {
        for (Cell[] row : grid) {
            for (Cell unit : row) {
                unit.update();
            }
        }
    }

    public void addCellAtPoint (Cell c, Point pt)
    {

    }

    public ArrayList<Cell> getEmptyCellsAroundPoint (Point p)
    {
        return null;
    }

    public ArrayList<Cell> getCellsAroundPoint (Point p)
    {
        return null;
    }

}

@@ -189,16 +189,26 @@
 nager %7B%0A
+    %0A    %0A
     priv
@@ -230,49 +230,465 @@
 id;%0A
-%0A    public GridManager (int size)%0A    %7B%0A
+    private int%5B%5D xDelta = %7B-1,-1,-1, 0, 0, 1, 1, 1%7D; %0A    private int%5B%5D yDelta = %7B-1, 0, 1,-1, 1,-1, 0, 1%7D; %0A    private int gWidth;%0A    private int gHeight;%0A    %0A    /**%0A     * Constructs the GridManager, initiates private variables%0A     * @param width     of the grid%0A     * @param height    of the grid%0A     */%0A    public GridManager (int width, int height)%0A    %7B%0A        grid = new Cell%5Bwidth%5D%5Bheight%5D;%0A        gWidth = width;%0A        gHeight = height;
 %0A   
@@ -852,16 +852,69 @@
     */%0A%0A
+    /**%0A     * Updates all Cells in the grid%0A     */%0A
     publ
@@ -1072,72 +1072,427 @@
   %7D%0A
-%0A    public void addCellAtPoint (Cell c, Point pt)%0A    %7B%0A%0A    %7D%0A
+    %0A%0A    /**%0A     * Adds cell in specific location in the Grid%0A     * @param cell      to be added%0A     * @param xCoord    in grid%0A     * @param yCoord    in grid%0A     */%0A    public void addCellAtPoint (Cell cell, int xCoord, int yCoord)%0A    %7B%0A        grid%5BxCoord%5D%5ByCoord%5D = cell;%0A    %7D%0A%0A    /**%0A     * Retrieves all neighboring cells around a point%0A     * @param xCoord    %0A     * @param yCoord%0A     * @return%0A     */
 %0A   
@@ -1522,13 +1522,8 @@
  get
-Empty
 Cell
@@ -1540,106 +1540,663 @@
 nt (
-Point p)%0A    %7B%0A        return null;%0A    %7D%0A%0A    public ArrayList%3CCell%3E getCellsAr
+int xCoord ,int yCoord)%0A    %7B%0A        ArrayList%3CCell%3E neighbors = new ArrayList%3C%3E();%0A        for(int i = 0; i %3C xDelta.length; i++)%0A        %7B%0A            int nextX = xCoord + xDelta%5Bi%5D;%0A            int nextY = yCoord + yDelta%5Bi%5D;%0A            %0A            if(!isOutOfBounds(nextX,nextY))%0A            %7B%0A                neighbors.add(grid%5BnextX%5D%5BnextY%5D);%0A            %7D%0A        %7D%0A        return neighbors;%0A    %7D%0A    %0A    %0A    /**%0A     * Checks if a location is not in the grid%0A     * @param xCoord    in grid%0A     * @param yCoord    in grid%0A     * @return  true if out of bounds, false otherwise%0A     */%0A    private boolean isOutOfB
 ound
-Po
+s(
 int 
-(Point p
+xCoord,int yCoord
 )%0A  
@@ -2218,12 +2218,112 @@
 urn 
-null
+xCoord%3EgWidth-1%0A                %7C%7CxCoord%3C0%0A                %7C%7CyCoord%3EgHeight-1%0A                %7C%7CyCoord%3C0
 ;%0A  

Update GridManager.