JTP
Class ArwTile

java.lang.Object
  extended by JTP.Tile
      extended by JTP.StartableTile
          extended by JTP.ArwTile
All Implemented Interfaces:
Serializable

public class ArwTile
extends StartableTile

Direction restricted tile (startable). Note: At least 1 and at most 3 directions can be restricted.

Author:
V.Termanis
See Also:
Serialized Form

Field Summary
static int DOWN
          Indicates downward/south direction.
static int LEFT
          Indicates left/west direction.
static int RIGHT
          Indicates right/east direction.
static int UP
          Indicates upward/north direction.
 
Fields inherited from class JTP.StartableTile
levelStart
 
Fields inherited from class JTP.Tile
ARROW, GRAVITY, height, ICE, NORMAL, TELEPORT, type
 
Constructor Summary
ArwTile(int height, boolean levelStart, boolean[] directions)
          Constructs a new ArwTile instance with the given attributes.
 
Method Summary
 boolean allowsDirection(int dir)
          Check whether a particular direction is not restricted.
 Tile copy()
          Creates an exact (non-shallow) copy of the current tile
 boolean equalsApartFromHeight(Tile t)
          Used to compare two tiles, ignoring their respective heights.
 
Methods inherited from class JTP.StartableTile
decHeight, isStart, isStartable, setHeight, setStart, tileCheck, transferAttributesFrom, transferAttributesFrom
 
Methods inherited from class JTP.Tile
getHeight, getType, incHeight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UP

public static final int UP
Indicates upward/north direction.

See Also:
Constant Field Values

DOWN

public static final int DOWN
Indicates downward/south direction.

See Also:
Constant Field Values

LEFT

public static final int LEFT
Indicates left/west direction.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Indicates right/east direction.

See Also:
Constant Field Values
Constructor Detail

ArwTile

public ArwTile(int height,
               boolean levelStart,
               boolean[] directions)
        throws NullPointerException,
               TileException
Constructs a new ArwTile instance with the given attributes.

Parameters:
height - of the pile
levelStart - indicates whether this is a start
directions - details which directions are restricted
Throws:
NullPointerException - if directions is null.
TileException - if either height or the combination of of restricted directions is invalid.
Method Detail

allowsDirection

public boolean allowsDirection(int dir)
Check whether a particular direction is not restricted.

Parameters:
dir - one of UP, DOWN, LEFT or RIGHT
Returns:
true if the direction is allowed.

equalsApartFromHeight

public boolean equalsApartFromHeight(Tile t)
Used to compare two tiles, ignoring their respective heights.

Overrides:
equalsApartFromHeight in class Tile
Parameters:
t - the Tile instance to compare the current tile with.
Returns:
true if the two Tile instances are equal disregarding their heights.

copy

public Tile copy()
Creates an exact (non-shallow) copy of the current tile

Overrides:
copy in class Tile
Returns:
a copy of the Tile instance.