Package edu.wisc.game.sql
Class Piece
java.lang.Object
edu.wisc.game.sql.Piece
- All Implemented Interfaces:
Serializable
Represents a piece of a specified type at a specified location. Used
in board description.
"boardObjectsArrays":{ "Cvu0lwRnl":{ "id":"Cvu0lwRnl", "value": [{"color":"yellow","shape":"square","id":"1","x":1,"y":1}, {"color":"black","shape":"square","id":"6","x":6,"y":1}, {"color":"red","shape":"square","id":"31","x":1,"y":6}, {"color":"blue","shape":"square","id":"36","x":6,"y":6}], "name":"Four squares in corners"} } }
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
A flexible replacement for an Enumstatic class
-
Constructor Summary
ConstructorsConstructorDescriptionPiece()
Piece
(Piece.Shape _shape, Piece.Color _color, int _x, int _y) Creates a traditional (shape+color) game piece placed at a specified location.Creates an IPB game piece placed at a specified location. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int[]
getColor()
This method is used just for Jersey/REST, to simplify JSON output structure, making it similar to that used in Game Engine 1.0This method is discovered by Reflect, and is then used when converting IPB objects to JSON (via Reflect), to add "name:value" pairs for all non-legacy properties.long
getId()
getImage()
getProperty
(String name) getShape()
For JSONint
getX()
int
getY()
int
hashCode()
pos()
void
void
setBuckets
(int[] _buckets) void
This is how it used by our JsonToJava, when reading board filesvoid
setDropped
(Integer _dropped) void
setId
(long _id) void
void
This is how it used by our JsonToJavavoid
setX
(int _x) void
setY
(int _y) toString()
For use in our application
-
Constructor Details
-
Piece
public Piece() -
Piece
Creates a traditional (shape+color) game piece placed at a specified location. -
Piece
Creates an IPB game piece placed at a specified location.- Parameters:
image
- the image identifier
-
-
Method Details
-
setBoard
-
getId
public long getId() -
setId
public void setId(long _id) -
getImage
-
setImage
-
getProperty
- Returns:
- null for a S+C object; the value of the specified property for an IPB object
-
getImageObject
- Returns:
- If this is an IPB or Composite object, return the corresponding ImageObject; otherwise null.
-
xgetColor
-
getColor
This method is used just for Jersey/REST, to simplify JSON output structure, making it similar to that used in Game Engine 1.0 -
setColor
This is how it used by our JsonToJava, when reading board files -
getShape
For JSON -
setShape
This is how it used by our JsonToJava -
xgetShape
For use in our application -
objectType
-
getX
public int getX() -
setX
public void setX(int _x) -
getY
public int getY() -
setY
public void setY(int _y) -
getDropped
-
setDropped
-
equals
-
hashCode
public int hashCode() -
pos
-
getBuckets
public int[] getBuckets() -
setBuckets
public void setBuckets(int[] _buckets) -
toString
-
getExtraFields
This method is discovered by Reflect, and is then used when converting IPB objects to JSON (via Reflect), to add "name:value" pairs for all non-legacy properties. Since toPropMap is used,
-