package de.gymnew.sudoku.model;

import java.io.File;

public class Sudoku {

	private Field[][] fields;
	private Row[] rows;
	private Column[] columns;
	private Block[][] blocks;

	public Sudoku() {
		fields = new Field[9][9];
		
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				fields[i][j] = new Field();
			}
		}
		// TODO Create Rows, Columns and Blocks
	}

	public Field getField(int column, int row) {
		return fields[column][row];
	}
	
	@Override
	public Sudoku clone() {
		Sudoku sudoku = new Sudoku();
		for(int i = 0; i<9; i++) {
			for(int j = 0; j<9; j++) {
				Field src = fields[i][j];
				Field dst = sudoku.getField(i, j);
				dst.setValue(src.getValue());
				dst.addNotes(src.getNotes());
			}
		}
		return null;
	}
	
	@Override
	public String toString() {
		String s = "";
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				s += fields[i][j].getValue();
			}
			s += "|";
		}
		return s;
	}

	private void load(String string) {
		// TODO Auto-generated method stub
		for(int i = 0;i<9;i++){
			for(int j=0;j<9;j++){
				string.charAt();
			}
		}
	}
	
	public static Sudoku load(File file) {
		// TODO Auto-generated method stub
		return null;
	}

}

@@ -43,20 +43,181 @@
 java.io.
-File
+BufferedReader;%0D%0Aimport java.io.File;%0D%0Aimport java.io.FileInputStream;%0D%0Aimport java.io.FileNotFoundException;%0D%0Aimport java.io.FileReader;%0D%0Aimport java.io.IOException
 ;%0D%0A%0D%0Apub
@@ -399,34 +399,40 @@
 %5D;%0D%0A
-%09%09
 %0D%0A%09%09for
+ 
 (int i
-=0;i%3C
+ = 0; i %3C 
 9;
+ 
 i++)
+ 
 %7B%0D%0A%09
@@ -436,33 +436,41 @@
 %0D%0A%09%09%09for
+ 
 (int j
-=0;j%3C
+ = 0; j %3C 
 9;
+ 
 j++)
+ 
 %7B%0D%0A%09%09%09%09f
@@ -635,25 +635,24 @@
 %5Brow%5D;%0D%0A%09%7D%0D%0A
-%09
 %0D%0A%09@Override
@@ -713,24 +713,25 @@
 ku();%0D%0A%09%09for
+ 
 (int i = 0; 
@@ -731,17 +731,19 @@
 i = 0; i
-%3C
+ %3C 
 9; i++) 
@@ -747,24 +747,25 @@
 +) %7B%0D%0A%09%09%09for
+ 
 (int j = 0; 
@@ -765,17 +765,19 @@
 j = 0; j
-%3C
+ %3C 
 9; j++) 
@@ -951,17 +951,16 @@
 l;%0D%0A%09%7D%0D%0A
-%09
 %0D%0A%09@Over
@@ -1021,25 +1021,33 @@
 %09for
+ 
 (int i
-=0;i%3C
+ = 0; i %3C 
 9;
+ 
 i++)
+ 
 %7B%0D%0A%09
@@ -1051,33 +1051,41 @@
 %0D%0A%09%09%09for
+ 
 (int j
-=0;j%3C
+ = 0; j %3C 
 9;
+ 
 j++)
+ 
 %7B%0D%0A%09%09%09%09s
@@ -1234,24 +1234,25 @@
  stub%0D%0A%09%09for
+ 
 (int i = 0;i
@@ -1254,16 +1254,21 @@
 = 0;
-i%3C
+ i %3C 
 9;
+ 
 i++)
+ 
 %7B%0D%0A%09
@@ -1276,25 +1276,33 @@
 %09for
+ 
 (int j
-=0;j%3C
+ = 0; j %3C 
 9;
+ 
 j++)
+ 
 %7B%0D%0A%09
@@ -1337,17 +1337,16 @@
 %09%7D%0D%0A%09%7D%0D%0A
-%09
 %0D%0A%09publi
@@ -1381,47 +1381,200 @@
 le) 
-%7B%0D%0A%09%09// TODO Auto-generated method stub
+throws IOException %7B%0D%0A%09%09FileReader fr = new FileReader(file);%0D%0A%09%09BufferedReader br = new BufferedReader(fr);%0D%0A%09%09Sudoku s = new Sudoku();%0D%0A%09%09s.load(br.readLine());%0D%0A%09%09br.close();%0D%0A%09%09fr.close();
 %0D%0A%09%09
@@ -1572,32 +1572,29 @@
 se();%0D%0A%09%09return 
-null
+s
 ;%0D%0A%09%7D%0D%0A%0D%0A%7D%0D%0A

complete loading a sudoku from file