public class Item
extends java.lang.Object
Item
represents a single item. An item is really
a collection of contiguous Cell
's. Each item has
an ID
and a list of Cell
's.Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<Cell> |
cells
The list of
Cell 's that comprise the item. |
int |
ID
The ID of this item.
|
int |
orient |
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<Cell> |
getCells()
Call this to get the list of cells in a particular item.
|
Item |
rotate()
Call this to return a new
Item instance that
rotates the current item anti-clockwise by 90 degrees. |
Item |
rotate(int orientation)
Call this to return a new
Item instance that
rotates the current item to the desired orientation. |
java.lang.String |
toString()
Prints the item's cells.
|
Item |
translate(int px,
int py)
Call this to return a new
Item instance that
is translated by the given amount. |
public int ID
public java.util.ArrayList<Cell> cells
Cell
's that comprise the item.public int orient
public java.util.ArrayList<Cell> getCells()
public java.lang.String toString()
toString
in class java.lang.Object
public Item rotate()
Item
instance that
rotates the current item anti-clockwise by 90 degrees.public Item rotate(int orientation)
Item
instance that
rotates the current item to the desired orientation.public Item translate(int px, int py)
Item
instance that
is translated by the given amount. This method does NOT
check to see if the result is legal (will result in an
item placed inside the box).