org.eviline
Enum Shape
java.lang.Object
java.lang.Enum<Shape>
org.eviline.Shape
- All Implemented Interfaces:
- Serializable, Comparable<Shape>
public enum Shape
- extends Enum<Shape>
A tetrimino. Stored as both an array of blocks and as arrays of (x,y) pairs for speed efficiency.
- Author:
- robin
O_UP
public static final Shape O_UP
O_RIGHT
public static final Shape O_RIGHT
O_DOWN
public static final Shape O_DOWN
O_LEFT
public static final Shape O_LEFT
I_UP
public static final Shape I_UP
I_RIGHT
public static final Shape I_RIGHT
I_DOWN
public static final Shape I_DOWN
I_LEFT
public static final Shape I_LEFT
S_LEFT
public static final Shape S_LEFT
S_UP
public static final Shape S_UP
S_RIGHT
public static final Shape S_RIGHT
S_DOWN
public static final Shape S_DOWN
Z_RIGHT
public static final Shape Z_RIGHT
Z_DOWN
public static final Shape Z_DOWN
Z_LEFT
public static final Shape Z_LEFT
Z_UP
public static final Shape Z_UP
T_UP
public static final Shape T_UP
T_RIGHT
public static final Shape T_RIGHT
T_DOWN
public static final Shape T_DOWN
T_LEFT
public static final Shape T_LEFT
J_LEFT
public static final Shape J_LEFT
J_UP
public static final Shape J_UP
J_RIGHT
public static final Shape J_RIGHT
J_DOWN
public static final Shape J_DOWN
L_RIGHT
public static final Shape L_RIGHT
L_DOWN
public static final Shape L_DOWN
L_LEFT
public static final Shape L_LEFT
L_UP
public static final Shape L_UP
values
public static Shape[] values()
- Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
for (Shape c : Shape.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static Shape valueOf(String name)
- Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name
- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is null
shape
public Block[][] shape()
width
public int width()
height
public int height()
type
public ShapeType type()
rotateRight
public Shape rotateRight()
rotateLeft
public Shape rotateLeft()
intersects
public boolean intersects(Block[][] field,
int x,
int y)
x
public int x(int i)
y
public int y(int i)
direction
public ShapeDirection direction()
symmetryTranslation
public int[] symmetryTranslation(Shape s)
Copyright © 2013. All Rights Reserved.