Class Tile

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

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

Each instance of this class represents one tile. The class stores information related to the tile and provides functions to modify or retrieve the information.

See Also:
Serialized Form

Field Summary
(package private)  int addedAtMoveNum
          Move number that the tile was added at if it is a blank tile.
(package private)  boolean blankTile
          true if the tile is a blank tile.
(package private)  java.lang.String blankTileDesc
          The description for the tile if it is a blank tile.
(package private)  java.lang.String blankTileName
          The name for the tile if it is a blank tile.
(package private)  int CurXPos
          Current X position of the tile.
(package private)  int CurYPos
          Current Y position of the tile.
(package private)  boolean Grid
          true if the tile is in the Grid.
(package private)  javax.swing.ImageIcon img
          The image used to represent the tile.
private static long serialVersionUID
           
(package private)  boolean TileBin
          true if the tile is in the TileBin.
(package private)  int TileID
          A unique tile ID that defines the tile.
 
Constructor Summary
Tile()
          Default constructor.
 
Method Summary
 int getAddedAtMoveNum()
          Returns the move number at which the tile was added.
 java.lang.String getBlankTileDesc()
          Returns the tile description.
 java.lang.String getBlankTileName()
          Returns the tile name.
 javax.swing.ImageIcon getImage()
          Returns the ImageIcon of the tile.
 int getTileID()
          Returns the TileID of the tile.
 int getXPos()
          Returns the X position of the tile.
 int getYPos()
          Returns the Y position of the tile.
 void InitTile(javax.swing.ImageIcon newImage, int x, int y, int id)
          This function initializes a tile with an image, location, and id.
 boolean isBlankTile()
          Returns true if the tile is a blank tile.
 boolean isInGrid()
          Returns true if the tile is in the grid.
 boolean isInTileBin()
          Returns true if the tile is in the tile bin.
 void setAddedAtMoveNum(int newNum)
          Sets the move number at which the tile was added.
 void setBlankTileDesc(java.lang.String newDesc)
          Sets the description of a blank tile.
 void setBlankTileName(java.lang.String newName)
          Sets the name of a blank tile.
 void setCurPos(int x, int y)
          Sets the current position of the tile.
 void setImage(javax.swing.ImageIcon newImage)
          Sets the image of the tile.
 void setToBlank()
          Sets the tile to be a blank tile.
 void setToGrid()
          Sets the tile to be in the Grid.
 void setToTileBin()
          Sets the tile to be in the TileBin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

TileID

int TileID
A unique tile ID that defines the tile.


CurXPos

int CurXPos
Current X position of the tile.


CurYPos

int CurYPos
Current Y position of the tile.


TileBin

boolean TileBin
true if the tile is in the TileBin.


Grid

boolean Grid
true if the tile is in the Grid.


img

javax.swing.ImageIcon img
The image used to represent the tile.


blankTileName

java.lang.String blankTileName
The name for the tile if it is a blank tile.


blankTileDesc

java.lang.String blankTileDesc
The description for the tile if it is a blank tile.


blankTile

boolean blankTile
true if the tile is a blank tile.


addedAtMoveNum

int addedAtMoveNum
Move number that the tile was added at if it is a blank tile.

Constructor Detail

Tile

public Tile()
Default constructor. This constructor initializes all fields of the tile to default values.

Method Detail

InitTile

public void InitTile(javax.swing.ImageIcon newImage,
                     int x,
                     int y,
                     int id)
This function initializes a tile with an image, location, and id. It assumes the tile will be starting in the TileBin and not the Grid.

Parameters:
newImage - ImageIcon to use as the tile's image
x - The X location of the tile
y - The Y location of the tile
id - The tile ID of the tile

setCurPos

public void setCurPos(int x,
                      int y)
Sets the current position of the tile.

Parameters:
x - New X position of the tile
y - New Y position of the tile

setImage

public void setImage(javax.swing.ImageIcon newImage)
Sets the image of the tile.

Parameters:
newImage - The ImageIcon to use as the tile's image.

getXPos

public int getXPos()
Returns the X position of the tile.

Returns:
The X position of the tile.

getYPos

public int getYPos()
Returns the Y position of the tile.

Returns:
The Y position of the tile.

isInTileBin

public boolean isInTileBin()
Returns true if the tile is in the tile bin.

Returns:
true if the tile is in the TileBin; false otherwise.

isInGrid

public boolean isInGrid()
Returns true if the tile is in the grid.

Returns:
true if the tile is in the Grid; false otherwise.

setToTileBin

public void setToTileBin()
Sets the tile to be in the TileBin.


setToGrid

public void setToGrid()
Sets the tile to be in the Grid.


getTileID

public int getTileID()
Returns the TileID of the tile.

Returns:
The TileID of the tile.

getImage

public javax.swing.ImageIcon getImage()
Returns the ImageIcon of the tile.

Returns:
The ImageIcon of the tile.

isBlankTile

public boolean isBlankTile()
Returns true if the tile is a blank tile.

Returns:
true if the tile is a blank tile; false otherwise.

getBlankTileName

public java.lang.String getBlankTileName()
Returns the tile name.

Returns:
Name of the blank tile.

getBlankTileDesc

public java.lang.String getBlankTileDesc()
Returns the tile description.

Returns:
Description of the blank tile.

setBlankTileName

public void setBlankTileName(java.lang.String newName)
Sets the name of a blank tile.

Parameters:
newName - Name to be used for the blank tile.

setBlankTileDesc

public void setBlankTileDesc(java.lang.String newDesc)
Sets the description of a blank tile.

Parameters:
newDesc - Description to be used for the blank tile.

setToBlank

public void setToBlank()
Sets the tile to be a blank tile.


setAddedAtMoveNum

public void setAddedAtMoveNum(int newNum)
Sets the move number at which the tile was added.

Parameters:
newNum - Move number at which the tile was added.

getAddedAtMoveNum

public int getAddedAtMoveNum()
Returns the move number at which the tile was added.

Returns:
The move number at which the tile was added.