/**
 * 
 */
package pg1;

import java.lang.reflect.Array;

/**
 * @author miguel
 *
 */
public class Grid<T> {
	
	public static char Seperator = ' ';
	
	@SuppressWarnings("unchecked")
	public Grid(int width, int height, T obj_init)
	{
		_cells = (Cell<T>[][])Array.newInstance( Cell[].class, width);
		
		for (int i = 0; i < _cells.length; i++)
			_cells[i] = (Cell<T>[])Array.newInstance(Cell.class, height);
		
		for (int i = 0; i < _cells.length; i++)
			for (int j = 0; j < _cells[i].length; j++)
				_cells[i][j] = new Cell<T>(obj_init);
	}
	
	@Override
	public String toString()
	{
		StringBuilder s = new StringBuilder();
		
		for (int i = 0; i < _cells.length; i++)
		{
			for (int j = 0; j < _cells[i].length; j++)
			{
				s.append(_cells[i][j].toString());
				if (j != _cells[i].length - 1) s.append(Seperator);
			}
			if (i != _cells.length - 1) s.append("\n");
		}
		
		return s.toString();
	}
	
	
	private Cell<T> [][]_cells;
	
	public static void main (String [] args)
	{
		Grid<Character> g = new Grid<Character>(10, 10, 'a');
		
		
		System.out.print(g);
	}
}

@@ -50,16 +50,41 @@
 t.Array;
+%0Aimport java.util.Random;
 %0A%0A/**%0A *
@@ -133,29 +133,30 @@
 %3E %7B%0A%09%0A%09p
-ublic
+rivate
  static 
 char Sep
@@ -151,28 +151,141 @@
 tic 
-char Seperator = ' '
+final char DEFAULT_SEPARATOR = ' ';%0A%09%0A%09public char Seperator = DEFAULT_SEPARATOR;%0A%09%0A%09public final int Width;%0A%09public final int Height
 ;%0A%09%0A
@@ -424,21 +424,22 @@
 .class, 
-width
+height
 );%0A%09%09%0A%09%09
@@ -526,38 +526,37 @@
 nce(Cell.class, 
-height
+width
 );%0A%09%09%0A%09%09for (int
@@ -675,16 +675,55 @@
 _init);%0A
+%09%09%0A%09%09Width = width;%0A%09%09Height = height;%0A
 %09%7D%0A%09%0A%09@O
@@ -1087,143 +1087,793 @@
 %0A%09%0A%09
-%0A%09private Cell%3CT%3E %5B%5D%5B%5D_cells;%0A%09%0A%09public static void main (String %5B%5D args)%0A%09%7B%0A%09%09Grid%3CCharacter%3E g = new Grid%3CCharacter%3E(10, 10, 'a
+public T GetCell(int i, int j)%0A%09%7B%0A%09%09if (i %3E= 0 && i %3C _cells.length && j %3E= 0 && j %3C _cells%5Bi%5D.length)%0A%09%09%09return _cells%5Bi%5D%5Bj%5D.GetValue();%0A%09%09%0A%09%09return null;%0A%09%7D%0A%0A%09public void SetCell(int i, int j, T val)%0A%09%7B%0A%09%09if (i %3E= 0 && i %3C _cells.length && j %3E= 0 && j %3C _cells%5Bi%5D.length)%0A%09%09%09_cells%5Bi%5D%5Bj%5D.SetValue(val);%09%0A%09%7D%0A%09%0A%09private Cell%3CT%3E %5B%5D%5B%5D_cells;%0A%09%0A%09public static void main (String %5B%5D args)%0A%09%7B%0A%09%09Grid%3CCharacter%3E g = new Grid%3CCharacter%3E(20, 10, ' ');%0A%09%09%0A%09%09for (int i = 0; i %3C g.Width; i++)%0A%09%09%7B%0A%09%09%09g.SetCell(i, 0, 'X');%0A%09%09%09g.SetCell(i, g.Width-1, 'X');%0A%09%09%09g.SetCell(0, i, 'X');%0A%09%09%09g.SetCell(g.Height - 1, i, 'X');%0A%09%09%7D%0A%09%09%0A%09%09Random r = new Random();%0A%09%09%0A%09%09for (int i = 1; i %3C g.Height - 1; i++)%0A%09%09%09for (int j = 1; j %3C g.Width - 1; j++)%0A%09%09%09%7B%0A%09%09%09%09if (r.nextBoolean())%0A%09%09%09%09%09g.SetCell(i, j, 'X
 ');%0A%09%09
+%09%7D
 %0A%09%09%0A

Create DEFAULT_SEPARATOR and getter and setter to Cell in the grid class.