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]}}{{ }} or as an array of integers.
** 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. These are the cell's row, column and block, in that order.
*** Don't forget that the cell is also a member of every ICellSet that it references.
** A cell can be in one of three logical states:
*** _Empty_ \- there are no values contained in the cell. 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. +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
isIterable
which means that it can be used in for-each loops.
...
*** _Unsolved_ \- the cell contains multiple possible values. At most, a cell could contain {{order*order}} values. ** {{Cell}} is 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 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. * {{{*}ICellSet{*}}} \-\- A collection of {{ICells}} that represents a row, column or block. ** 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|http://download.oracle.com/javase/6/docs/api/java/lang/Iterable.html]}} which means that it can be used in for-each loops: {{ for(ICell c : aCellSet) { ... }}} * {{Board}} \-\- A set of 3 Vector<ICellSet>'s where each element of the vector is an {{ICellSet}}. These vectors represent the entire set of rows, columns or blocks in a game. |
...
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! |