Sets the lattice from which the iterates are given. Dimension
of lattice must be the same as that specified to constructor. Also,
size of lattice must be compatible with range of neighbor interactions.
Sets the range used to define the neighboring sites. Each of the values
in newRange is used to determine the size of the neighbor box in the
corresponding dimension: (edge length) = 2*value + 1, as the value describes
the neighbor distance in each direction (e.g., left and right) from the
Non-negative values (including zero) are acceptable, to a maximum of
(lattice dimension - 1)/2, beyond which the neighbor distances extend beyond
the size of the lattice. An IllegalArgumentException is thrown if any index
is outside its acceptable range.
A copy of the newRange array is made, so it may be re-used elsewhere after
calling this method.
public int getRange()
Returns (a copy of) the array specifying the neighbor range.
public static void main(java.lang.String args)
Method to test the neighbor iterator. Constructs a lattice
with sites defined to hold a color. Configures iterator,
loops over neighbor sites and defines up/down neighbors to
have colors yellow and blue, respectively. Then puts up a window
with the lattice drawn as an array of squares, with central site colored
red and with neighbor sites identified by their colors. 3-D lattice is shown
with a set of slices through the planes in the 3rd dimension.