|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Piece
A Piece represents an instance of a puzzle piece, with a location.
| Field Summary | |
static InputSpec |
spec
the input specifications |
| Constructor Summary | |
Piece(int whichShape,
java.awt.Point w)
Make a new piece of a given shape, in a given place. |
|
Piece(Piece piece)
Make a copy of a piece. |
|
| Method Summary | |
boolean |
canSlide(int dir,
Configuration config)
Can this piece slide in the specified direction, in the given configuration? We must make sure that the squares the piece would slide into are vacant. |
boolean |
equals(Piece piece)
Is this piece the same shape as and in the same location as another piece? |
boolean |
isGoal()
Is this the goal piece? |
boolean |
occupies(int x,
int y)
Does this piece occupy the spot (x, y)? |
void |
print()
Print out the piece info. |
Shape |
shape()
What is this piece's shape? |
void |
shift(int dir)
Shift the piece. |
boolean |
solved()
Is this the goal piece, in the goal position? |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static InputSpec spec
| Constructor Detail |
public Piece(int whichShape,
java.awt.Point w)
public Piece(Piece piece)
| Method Detail |
public boolean solved()
public boolean isGoal()
public boolean occupies(int x,
int y)
public Shape shape()
public boolean canSlide(int dir,
Configuration config)
public void shift(int dir)
public void print()
public boolean equals(Piece piece)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||