Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h2. Comp211 HW11  Supporting Code Details\\ \\ Core Data Structures

\\ !uml_data.png!

 The main data structures are represented by only a few interfaces:
* {{{*}ICell{*}}} \--  a single square on the Sudoku board.  
** A cell has a set of integer values, which are accessible either as a {{[HashSet<Integer>|http://download.oracle.com/javase/6/docs/api/java/util/HashSet.html]}}{{&nbsp;}} or as an array of integers.&nbsp;
** A cell also has a collection ([Vector<ICell>|http://download.oracle.com/javase/6/docs/api/java/util/Vector.html]) of {{ICellSets}} to which it belongs.&nbsp;&nbsp; These are the cell's row, column and block, in that order.
*** Don't forget that the cell is also a member of every&nbsp;ICellSet&nbsp;that it references.&nbsp;&nbsp;
** A cell can be in one of three logical states:
*** _Empty_ \- there are no values contained in the cell.&nbsp;&nbsp; This corresponds to the situation where the board is unsolvable because a cell has no possible value.
*** 

...

 The main data structures are represented by only a few interfaces:

...

  • Don't forget that the cell is also a member of every ICellSet that it references.  

...

_Solved_ \- the cell contains exactly one value.&nbsp;&nbsp; +If and only if you know for sure that the cell is in this state+, then the single value can be accessed as {{aCell.getValueArray()\[0\]}}.

...

  • The ACellVisitor class is an abstract convenience class that provide a default return value for any cases that the developer does not which to override.   There is no requirement to use this class, though it may simplify certain code. 

...

  •  For convenience sake, the cells are in a distinct order (i.e. left-to right for a row) and thus each cell is addressable by an index value.
  •  An ICellSet is Iterable which means that it can be used in for-each loops.

...


*** _Unsolved_ \- the cell contains multiple possible values.&nbsp;&nbsp; At most, a cell could contain {{order*order}} values.
** {{Cell}} is&nbsp;a concrete implementation of {{ICell}}.
** An {{ICell}} accepts an {{{*}ICellVisitor{*}}} which has cases for each of the 3 logical states, described above.
*** The {{ACellVisitor}} class is an abstract&nbsp;convenience class that provide a default return value for any cases that the developer does not which to override.&nbsp;&nbsp; There is no requirement to use this class, though it may simplify certain code.&nbsp;
* {{{*}ICellSet{*}}} \-\- A collection of {{ICells}} that represents a row, column or block.&nbsp;
** &nbsp;For convenience sake, the cells are in a distinct order (i.e. left-to right for a row) and thus each cell is addressable by an index value.
** &nbsp;An {{ICellSet}} is {{[Iterable|http://download.oracle.com/javase/6/docs/api/java/lang/Iterable.html]}} which means that it can be used in for-each loops:
{{&nbsp;for(ICell c : aCellSet) { ... }}}
* {{Board}} \-\- A set of 3 Vector<ICellSet>'s where each element of the vector is an&nbsp;{{ICellSet}}.&nbsp;&nbsp; These vectors represent the entire set of&nbsp;rows, columns or blocks&nbsp;in a game.&nbsp;&nbsp;&nbsp;&nbsp;

...

Utility Data Structures

...







h2. Utility Data Structures


\\ !uml_util.png!


\\


h2. Model-View-Controller

...

Puzzle Generation Utilities

...

 Architecture


\\ !uml_MVC.png!


\\


h2. Puzzle Generation Utilities


\\ !uml_generate.png!