JTP
Class StartableTile

java.lang.Object
  extended by JTP.Tile
      extended by JTP.StartableTile
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ArwTile, NrmTile

public class StartableTile
extends Tile

Serves as a parent for all startable tiles. Most methods described here are overloaded.

Author:
V.Termanis
See Also:
Serialized Form

Field Summary
protected  boolean levelStart
          Indicates whether this is a start or not
 
Fields inherited from class JTP.Tile
ARROW, GRAVITY, height, ICE, NORMAL, TELEPORT, type
 
Constructor Summary
StartableTile()
           
 
Method Summary
 boolean decHeight()
          Reduces height of pile by one.
 boolean isStart()
          Sepcifies whether this is a start tile.
 boolean isStartable()
          Specifies whether this can be a start tile.
 void setHeight(int height)
          Sets height of tile.
 void setStart(boolean isStart)
          Set whether this tile is a start or not.
protected  void tileCheck()
          Used to check for tile attribute validity upon creation.
protected  void transferAttributesFrom(StartableTile tile)
          Used to apply all attributes to this tile from another one.
protected  void transferAttributesFrom(Tile tile)
          Used to apply all attributes to this tile from another one.
 
Methods inherited from class JTP.Tile
copy, equalsApartFromHeight, getHeight, getType, incHeight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

levelStart

protected boolean levelStart
Indicates whether this is a start or not

Constructor Detail

StartableTile

public StartableTile()
Method Detail

tileCheck

protected void tileCheck()
                  throws TileException
Used to check for tile attribute validity upon creation.

Overrides:
tileCheck in class Tile
Throws:
TileException - if one or more attributes are invalid for a particular tile type.

transferAttributesFrom

protected void transferAttributesFrom(Tile tile)
Used to apply all attributes to this tile from another one.

Overrides:
transferAttributesFrom in class Tile
Parameters:
tile - the Tile instance from which to get attributes.

transferAttributesFrom

protected void transferAttributesFrom(StartableTile tile)
Used to apply all attributes to this tile from another one.

Parameters:
tile - the Tile instance from which to get attributes.

isStart

public boolean isStart()
Sepcifies whether this is a start tile.

Returns:
true if this is a start.

isStartable

public boolean isStartable()
Specifies whether this can be a start tile. Not all types of tile can be a start (e.g. ICE).

Overrides:
isStartable in class Tile
Returns:
true if this can be a start tile.

setStart

public void setStart(boolean isStart)
              throws TileException
Set whether this tile is a start or not.

Parameters:
isStart - used to toggle start status of this tile.
Throws:
TileException - if the height of this tile (zero) does not permit it to be changed from a start to a non-start tile.

decHeight

public boolean decHeight()
Reduces height of pile by one. Height will be reduced to at most 0 if it is a start, 1 otherwise.

Overrides:
decHeight in class Tile
Returns:
true if the height was reduced.

setHeight

public void setHeight(int height)
Sets height of tile.

Overrides:
setHeight in class Tile
Parameters:
height - to which to set this pile to. Note: If a height below 0 is specified the height will still be set to 0. If the tile is not a start then the height will be set to at least 1.