org.eviline
Enum Shape

java.lang.Object
  extended by java.lang.Enum<Shape>
      extended by 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

Enum Constant Summary
I_DOWN
           
I_LEFT
           
I_RIGHT
           
I_UP
           
J_DOWN
           
J_LEFT
           
J_RIGHT
           
J_UP
           
L_DOWN
           
L_LEFT
           
L_RIGHT
           
L_UP
           
O_DOWN
           
O_LEFT
           
O_RIGHT
           
O_UP
           
S_DOWN
           
S_LEFT
           
S_RIGHT
           
S_UP
           
T_DOWN
           
T_LEFT
           
T_RIGHT
           
T_UP
           
Z_DOWN
           
Z_LEFT
           
Z_RIGHT
           
Z_UP
           
 
Method Summary
 ShapeDirection direction()
           
 int height()
           
 boolean intersects(Block[][] field, int x, int y)
           
 Shape rotateLeft()
           
 Shape rotateRight()
           
 Block[][] shape()
           
 int[] symmetryTranslation(Shape s)
           
 ShapeType type()
           
static Shape valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Shape[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 int width()
           
 int x(int i)
           
 int y(int i)
           
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

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
Method Detail

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.