Class Sample

java.lang.Object
  |
  +--Sample

class Sample
extends java.lang.Object

A Sample maintains a grid size in rows and cols, a list of pairs, and a synthetic title, indicating the size and number of spam. Spam is added by the addSpam method. Spam on certain "sacred" squares (such as the initial positions occupied by the DESC) is not allowed and will be ignored.


Field Summary
(package private)  OpenList blockList
          list of pairs indicating coordinates of blockage in this sample
private  int cols
          the number of columns in the grid for this sample
private  int rows
          the number of rows in the grid for this sample
(package private)  OpenList spamList
          list of pairs indicating coordinates of spam in this sample
 
Constructor Summary
Sample(int rows, int cols)
          Construct a Sample with a given number of rows and columns
 
Method Summary
 void addBlck(int row, int col)
          Add coordinates of a blockage square.
 void addSpam(int row, int col)
          Add coordinates of a spam square.
 java.util.Enumeration blockEnumeration()
          Get an enumeration of the blockList of this Sample.
 int getCols()
          Get the number of columns of this Sample.
 int getRows()
          Get the number of rows of this Sample.
 java.lang.String getTitle()
          Get the synthetic title for this Sample.
static Sample[] makeSamples()
          Generate a specific set of Samples.
protected  boolean sacred(int row, int col)
          Indicates coordinates of sacred squares, on which spam cannot be placed.
 java.util.Enumeration spamEnumeration()
          Get an enumeration of the SpamList of this Sample.
 java.lang.String toString()
          Return a string representation of this Sample, which is defined to be the same as the title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rows

private int rows
the number of rows in the grid for this sample


cols

private int cols
the number of columns in the grid for this sample


spamList

OpenList spamList
list of pairs indicating coordinates of spam in this sample


blockList

OpenList blockList
list of pairs indicating coordinates of blockage in this sample

Constructor Detail

Sample

public Sample(int rows,
              int cols)
Construct a Sample with a given number of rows and columns

Method Detail

sacred

protected boolean sacred(int row,
                         int col)
Indicates coordinates of sacred squares, on which spam cannot be placed.


addSpam

public void addSpam(int row,
                    int col)
Add coordinates of a spam square. If the square is sacred, nothing is changed.


addBlck

public void addBlck(int row,
                    int col)
Add coordinates of a blockage square. If the square is sacred, nothing is changed.


getTitle

public java.lang.String getTitle()
Get the synthetic title for this Sample.


getRows

public int getRows()
Get the number of rows of this Sample.


getCols

public int getCols()
Get the number of columns of this Sample.


spamEnumeration

public java.util.Enumeration spamEnumeration()
Get an enumeration of the SpamList of this Sample.


blockEnumeration

public java.util.Enumeration blockEnumeration()
Get an enumeration of the blockList of this Sample.


toString

public java.lang.String toString()
Return a string representation of this Sample, which is defined to be the same as the title.

Overrides:
toString in class java.lang.Object

makeSamples

public static Sample[] makeSamples()
Generate a specific set of Samples.