|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcs1705.tetris.Piece
An immutable representation of a tetris piece in a particular rotation. Each piece is defined by the blocks that make up its body.
| Field Summary | |
static int |
LEFT_DOG
|
static int |
LEFT_L
|
static int |
RIGHT_DOG
|
static int |
RIGHT_L
|
static int |
SQUARE
|
static int |
STICK
|
static int |
T
|
| Method Summary | |
boolean |
equals(Object other)
Returns true if two pieces are the same, that is, if their bodies contain the same points. |
Point[] |
getBody()
Returns a pointer to the piece's body. |
int |
getHeight()
Returns the height of the piece measured in blocks. |
static Piece |
getPiece(int style,
int rotations)
Returns the requested piece style, rotated from its starting position by the specified number of counter-clockwise rotations. |
static Piece[] |
getPieces()
Returns an array containing the first rotation of each of the 7 standard tetris pieces. |
int[] |
getSkirt()
Returns a pointer to the piece's skirt. |
int |
getWidth()
Returns the width of the piece measured in blocks. |
Piece |
nextRotation()
Returns a piece that is 90 degrees counter-clockwise rotated from the receiver. |
Piece |
nthRotation(int n)
Returns a piece that is rotated counter-clockwise from the receiver by n 90-degree rotations. |
int |
numRotations()
Determine the number of distinct rotations for this piece. |
int |
style()
Check the "style" of piece this object represents. |
String |
toString()
Returns a human-readable string representation of this piece. |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int LEFT_DOG
public static final int LEFT_L
public static final int RIGHT_DOG
public static final int RIGHT_L
public static final int SQUARE
public static final int STICK
public static final int T
| Method Detail |
public boolean equals(Object other)
public Point[] getBody()
public int getHeight()
public static Piece getPiece(int style,
int rotations)
style - the style of piece to look uprotations - the number of times to rotate itpublic static Piece[] getPieces()
nextRotation() message.
In this way, the client can iterate through all the rotations
until eventually getting back to the first rotation.
public int[] getSkirt()
public int getWidth()
public Piece nextRotation()
public Piece nthRotation(int n)
n - the number of rotations to applypublic int numRotations()
public int style()
public String toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||