|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmahjong.Tile
public class Tile
A single tile within the game. Tiles are unique only by their group value and subindex within that group---there should never two tiles with the same group and subindex.
Field Summary | |
---|---|
private int |
subindex
Index within the group (0-3). |
private int |
value
Group value. |
private int |
x
Position in tile array. |
private int |
y
Position in tile array. |
private int |
z
Position in tile array. |
Constructor Summary | |
---|---|
Tile(int val,
int index)
Tile constructor. |
Method Summary | |
---|---|
int |
compareTo(Tile t)
Interface method. |
boolean |
equals(java.lang.Object obj)
|
int |
getSubindex()
|
int |
getValue()
|
int |
getX()
|
int |
getY()
|
int |
getZ()
|
int |
hashCode()
|
boolean |
matches(Tile t)
Checks if this tile is a matching tile for the given one. |
void |
setCoord(int z1,
int y1,
int x1)
Set location in the board. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int value
private int subindex
private int z
private int y
private int x
Constructor Detail |
---|
public Tile(int val, int index)
val
- group value.index
- sub-index within the group.Method Detail |
---|
public void setCoord(int z1, int y1, int x1)
z1
- z-coord.y1
- y-coord.x1
- x-coord.public int getZ()
public int getY()
public int getX()
public int getValue()
public int getSubindex()
public int compareTo(Tile t)
compareTo
in interface java.lang.Comparable<Tile>
t
- The Tile to compare to.
Comparable.compareTo(java.lang.Object)
public boolean matches(Tile t)
t
- Tile to check.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |