Java Reference
In-Depth Information
Ta b l e 1 3 . 3
Range of Internal Values a number Instance Variable Can Be Assigned and How
They Are Ultimately Displayed Externally ( Continued )
'number'
value
Description
Appearance
11-19
Indicates that the space contains a num-
ber that cannot be modified because it
was provided by the puzzle generator as a
hint.
The space will be filled in with a black
emboldened number that is computed by
performing a 'mod 10' on the value.
21-29
Indicates that the space is editable, and
that during play the user has entered a
number into the space. In addition, the
space's number value currently has the
same value as (conflicts with) one or
more spaces in its row/column/box.
The space will be filled in with a red
number that is computed by performing a
'mod 10' on the value.
31-39
Indicates that the space contains a number
that cannot be modified because it was
provided by the puzzle generator as a hint.
Furthermore, the space's number value
currently has the same value as (conflicts
with) one or more spaces in its row/col-
umn/box, because the user has entered at
least one conflicting number elsewhere.
The space will be filled in with a red
emboldened number that is computed by
performing a 'mod10' on the value.
<0, 10, 20,
30, >39
Undefined. A space should never be
assigned any of these values.
n/a
The Interface
The Board and Space classes have interface counterparts, named BoardNode and
SpaceNode respectively, which handle the task of presenting the Sudoku game to
the user. The BoardNode class is responsible for the overall layout of the applica-
tion; for each Space , there is a corresponding SpaceNode , which manages the
input and display of that space on the puzzle. When the BoardNode instance is
initialized, it includes an instance variable called board , which is a reference to
the Board instance. Likewise, each SpaceNode instance contains an instance
variable called space , which points to its Space counterpart. Figure 13.2 shows
the relationship between Board / Space and BoardNode / SpaceNode .
With these classes in place, you might be asking the question, how is the internal
state of the Space s picked up by the corresponding SpaceNode s and displayed on
the interface? The short answer is through binding . Let's run through how this
takes place.
 
 
Search WWH ::




Custom Search