Class Rules

java.lang.Object
  extended by Rules
All Implemented Interfaces:
java.io.Serializable

public class Rules
extends java.lang.Object
implements java.io.Serializable

The rules class stores the values related to a set such as name, instructions, tile size, etc., which uniquely identify what a set can do, some information about the set, and the tiles that a set contains. This is a serializable class that the CLIP system outputs as '.set' files.

See Also:
Serialized Form

Field Summary
(package private)  boolean allowBlanks
          true if blank tiles are allowed
(package private)  boolean allowPrintArrangement
          true if printing is allowed
(package private)  boolean allowUnused
          true if unused tiles are allowed
(package private)  byte[] blankImage
          Byte array of blank tile image.
(package private)  int blankIndex
          Index of the blank tile image in the tile list
(package private)  java.lang.String instructions
          TileSet instructions and/or description
(package private)  boolean missingTiles
          true if the set should randomly remove some tiles when it loads.
(package private)  java.lang.String name
          TileSet name
(package private)  int numBlankTiles
          Maximum number of blank tiles allowed
(package private)  int numMissingTiles
          Number of tiles to randomly remove on set load
(package private)  int numTilesHigh
          Number of tiles the grid can fit from top to bottom
(package private)  int numTilesWide
          Number of tiles the grid can fit from side to side
(package private)  int numUnusedTiles
          Maximum number of unused tiles allowed
(package private)  boolean reqArrangementComment
          true if arrangement comments are required
(package private)  boolean reqBlankDesc
          true if blank tiles require a description
(package private)  boolean reqBlankName
          true if blank tiles require a name
(package private)  boolean reqUnusedDesc
          true if unused tiles require a description
(package private) static long serialVersionUID
           
(package private)  int tileHeight
          Height of the set's tiles in pixels
(package private)  java.util.ArrayList tileNames
          Names of tiles in the tiles ArrayList.
(package private)  java.util.ArrayList tiles
          Holds the tiles for a set as byte arrays.
(package private)  int tileWidth
          Width of the set's tiles in pixels
(package private)  boolean unlimitedBlanks
          true if unlimited blank tiles are allowed
(package private)  boolean unlimitedUnused
          true if unlimited unused tiles are allowed
 
Constructor Summary
Rules()
          The constructor initializes all fields to default values
 
Method Summary
 boolean blankOption()
          Returns true if blank tiles are allowed for this set.
 boolean getAllowBlanks()
          Returns true if blank tiles are allowed.
 boolean getAllowPrintArrangement()
          Returns true if printing is allowed.
 boolean getAllowUnused()
          Returns true if unused tiles are allowed.
 byte[] getBlank()
          Returns a byte array that is used to create an ImageIcon used as the blank tile image.
 java.lang.String getInstructions()
          Returns the set instructions.
 boolean getMissingTiles()
          Returns true if the set randomly removes some tiles when it loads.
 java.lang.String getName()
          Returns the set name.
 int getNumberBlankTiles()
          Returns the maximum number of blank tiles allowed.
 int getNumberUnusedTiles()
          Returns the maximum number of unused tiles allowed.
 int getNumMissingTiles()
          Returns the number of randomly removed tiles on set load.
 int getNumTilesHigh()
          Returns the number of tiles the grid can hold from top to bottom.
 int getNumTilesWide()
          Returns the number of tiles the grid can hold from side to side.
 boolean getReqBlankDesc()
          Returns true if blank tiles require a description.
 boolean getReqBlankName()
          Returns true if blank tiles require a name.
 boolean getRequireArrangementComment()
          Returns true if tile arrangements require comments.
 boolean getReqUnusedDesc()
          Returns true if unused tiles require a description.
 int getTileHeight()
          Returns the height of the tiles in pixels.
 int getTileWidth()
          Returns the width of the tiles in pixels.
 boolean getUnlimitedBlanks()
          Returns true if unlimited blank tiles are allowed.
 boolean getUnlimitedUnused()
          Returns true if unlimited unused tiles are allowed.
 boolean missingOption()
          Returns true if the set randomly removes some tiles on loading.
 void resetValues()
          Resets all fields to default values.
 void setBlank(byte[] newBlank, int index)
          Sets the blank tile by passing in a byte array and index number to use as the blank tile.
 void setBlankOptions(boolean allow, boolean blankName, boolean blankDesc, boolean unlimited, int blankNumber)
          Sets the variables related to blank tiles to the passed in parameter values.
 void setGridSize(int numWide, int numHigh)
          Sets the grid size (# of tiles wide and tall)
 void setInstructions(java.lang.String newInstructions)
          Sets the set instructions to the passed in value.
 void setMissingTilesOptions(boolean missing, int missingNumber)
          Sets the variables related to missing tiles to the passed in parameter values.
 void setName(java.lang.String newName)
          Sets the set name to the passed in value.
 void setSessionOptions(boolean allowPrint, boolean arrangementComment)
          Sets the variables related to session options to the values of the passed in parameters.
 void setTileSize(int tileW, int tileH)
          Sets the size of the tiles (in pixels)
 void setUnusedOptions(boolean allow, boolean unusedDesc, boolean unlimited, int unusedNumber)
          Set the variables related to unused tiles to the values of the passed in parameters.
 boolean unusedOption()
          Returns true if unused tiles are allowed for this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

tiles

java.util.ArrayList tiles
Holds the tiles for a set as byte arrays. ImageIcons can be constructed from the byte arrays


tileNames

java.util.ArrayList tileNames
Names of tiles in the tiles ArrayList. Stored as Strings.


name

java.lang.String name
TileSet name


instructions

java.lang.String instructions
TileSet instructions and/or description


numTilesWide

int numTilesWide
Number of tiles the grid can fit from side to side


numTilesHigh

int numTilesHigh
Number of tiles the grid can fit from top to bottom


tileWidth

int tileWidth
Width of the set's tiles in pixels


tileHeight

int tileHeight
Height of the set's tiles in pixels


allowBlanks

boolean allowBlanks
true if blank tiles are allowed


reqBlankDesc

boolean reqBlankDesc
true if blank tiles require a description


reqBlankName

boolean reqBlankName
true if blank tiles require a name


unlimitedBlanks

boolean unlimitedBlanks
true if unlimited blank tiles are allowed


numBlankTiles

int numBlankTiles
Maximum number of blank tiles allowed


blankIndex

int blankIndex
Index of the blank tile image in the tile list


blankImage

byte[] blankImage
Byte array of blank tile image. This can be used to construct an ImageIcon


allowUnused

boolean allowUnused
true if unused tiles are allowed


reqUnusedDesc

boolean reqUnusedDesc
true if unused tiles require a description


unlimitedUnused

boolean unlimitedUnused
true if unlimited unused tiles are allowed


numUnusedTiles

int numUnusedTiles
Maximum number of unused tiles allowed


missingTiles

boolean missingTiles
true if the set should randomly remove some tiles when it loads.


numMissingTiles

int numMissingTiles
Number of tiles to randomly remove on set load


allowPrintArrangement

boolean allowPrintArrangement
true if printing is allowed


reqArrangementComment

boolean reqArrangementComment
true if arrangement comments are required

Constructor Detail

Rules

public Rules()
The constructor initializes all fields to default values

Method Detail

resetValues

public void resetValues()
Resets all fields to default values.


blankOption

public boolean blankOption()
Returns true if blank tiles are allowed for this set.

Returns:
true if blank tiles are allowed for this set; false otherwise.

missingOption

public boolean missingOption()
Returns true if the set randomly removes some tiles on loading.

Returns:
true if the set randomly removes some tiles on loading. false otherwise.

setBlank

public void setBlank(byte[] newBlank,
                     int index)
Sets the blank tile by passing in a byte array and index number to use as the blank tile.

Parameters:
newBlank - Byte array to create the ImageIcon from
index - Index of the blank image in the tile list

getBlank

public byte[] getBlank()
Returns a byte array that is used to create an ImageIcon used as the blank tile image.

Returns:
Byte array that is used to create an ImageIcon used as the blank tile image.

unusedOption

public boolean unusedOption()
Returns true if unused tiles are allowed for this set.

Returns:
true if unused tiles are allowed for this set; false otherwise.

setName

public void setName(java.lang.String newName)
Sets the set name to the passed in value.

Parameters:
newName - The new set name

getName

public java.lang.String getName()
Returns the set name.

Returns:
The set name

setInstructions

public void setInstructions(java.lang.String newInstructions)
Sets the set instructions to the passed in value.

Parameters:
newInstructions - The new set instructions

getInstructions

public java.lang.String getInstructions()
Returns the set instructions.

Returns:
The set instructions.

setGridSize

public void setGridSize(int numWide,
                        int numHigh)
Sets the grid size (# of tiles wide and tall)

Parameters:
numWide - Number of tiles the grid can hold from side to side
numHigh - Number of tiles the grid can hold from top to bottom

getNumTilesWide

public int getNumTilesWide()
Returns the number of tiles the grid can hold from side to side.

Returns:
The number of tiles the grid can hold from side to side

getNumTilesHigh

public int getNumTilesHigh()
Returns the number of tiles the grid can hold from top to bottom.

Returns:
The number of tiles the grid can hold from top to bottom

setTileSize

public void setTileSize(int tileW,
                        int tileH)
Sets the size of the tiles (in pixels)

Parameters:
tileW - Width of the tiles in pixels
tileH - Height of the tiles in pixels

getTileWidth

public int getTileWidth()
Returns the width of the tiles in pixels.

Returns:
The width of the tiles in pixels.

getTileHeight

public int getTileHeight()
Returns the height of the tiles in pixels.

Returns:
The height of the tiles in pixels

setBlankOptions

public void setBlankOptions(boolean allow,
                            boolean blankName,
                            boolean blankDesc,
                            boolean unlimited,
                            int blankNumber)
Sets the variables related to blank tiles to the passed in parameter values.

Parameters:
allow - true to allow blank tiles to be used
blankName - true to require names for blank tiles
blankDesc - true to require descriptions for blank tiles
unlimited - true to allow unlimited blank tiles
blankNumber - Maximum number of blank tiles allowed

setMissingTilesOptions

public void setMissingTilesOptions(boolean missing,
                                   int missingNumber)
Sets the variables related to missing tiles to the passed in parameter values.

Parameters:
missing - true to allow missing tiles
missingNumber - Number of missing tiles (randomly removed)

getMissingTiles

public boolean getMissingTiles()
Returns true if the set randomly removes some tiles when it loads.

Returns:
true if the set randomly removes some tiles when it loads

getNumMissingTiles

public int getNumMissingTiles()
Returns the number of randomly removed tiles on set load.

Returns:
The number of randomly removed tiles on set load.

getAllowBlanks

public boolean getAllowBlanks()
Returns true if blank tiles are allowed.

Returns:
true if blank tiles are allowed.

getReqBlankName

public boolean getReqBlankName()
Returns true if blank tiles require a name.

Returns:
true if blank tiles require a name.

getReqBlankDesc

public boolean getReqBlankDesc()
Returns true if blank tiles require a description.

Returns:
true if blank tiles require a description

getUnlimitedBlanks

public boolean getUnlimitedBlanks()
Returns true if unlimited blank tiles are allowed.

Returns:
true if unlimited blank tiles are allowed

getNumberBlankTiles

public int getNumberBlankTiles()
Returns the maximum number of blank tiles allowed.

Returns:
The maximum number of blank tiles allowed

setUnusedOptions

public void setUnusedOptions(boolean allow,
                             boolean unusedDesc,
                             boolean unlimited,
                             int unusedNumber)
Set the variables related to unused tiles to the values of the passed in parameters.

Parameters:
allow - true if unused tiles are allowed
unusedDesc - true if unused tiles require a description
unlimited - true if unlimited unused tiles are allowed
unusedNumber - Maximum number of unused tiles allowed

getAllowUnused

public boolean getAllowUnused()
Returns true if unused tiles are allowed.

Returns:
true if unused tiles are allowed

getReqUnusedDesc

public boolean getReqUnusedDesc()
Returns true if unused tiles require a description.

Returns:
true if unused tiles require a description

getUnlimitedUnused

public boolean getUnlimitedUnused()
Returns true if unlimited unused tiles are allowed.

Returns:
true if unlimited unused tiles are allowed

getNumberUnusedTiles

public int getNumberUnusedTiles()
Returns the maximum number of unused tiles allowed.

Returns:
The maximum number of unused tiles allowed

setSessionOptions

public void setSessionOptions(boolean allowPrint,
                              boolean arrangementComment)
Sets the variables related to session options to the values of the passed in parameters.

Parameters:
allowPrint - true if printing is allowed
arrangementComment - true if arrangement comments are required

getAllowPrintArrangement

public boolean getAllowPrintArrangement()
Returns true if printing is allowed.

Returns:
true if printing is allowed

getRequireArrangementComment

public boolean getRequireArrangementComment()
Returns true if tile arrangements require comments.

Returns:
true if tile arrangements require comments