|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectoop2.setGame.Card
A Card from the game Set. Each card can have a count, a shading, a color, and a shape.
| Field Summary | |
int |
color
The color of this card (0-2) |
static int |
DIAMOND
The shape Diamond |
static int |
GREEN
The color Green |
int |
number
the number of symbols on this card (1-3) |
static int |
OPEN
The shading Open |
static int |
OVAL
The shape Oval |
static int |
PURPLE
The color Purple |
static int |
RED
The color Red |
int |
shading
The shading of this card (0-2) |
int |
shape
the shape on this card (0-2) |
static int |
SOLID
The shading Solid |
static int |
SQUIGGLE
The shape Squiggle |
static int |
STRIPED
The shading Striped |
| Constructor Summary | |
Card(int number,
int color,
int shading,
int shape)
Creates a new card with the specified attributes. |
|
Card(String name)
Constructed a card based on a String representation The String representation is the same 4 character string returned by the toString method, in the order Number, Shading, Color, Shape. |
|
| Method Summary | |
boolean |
equals(Object o)
|
String |
getImage()
Returns the name of the gif file containing the graphical representation of this playing card. |
int |
hashCode()
|
String |
toString()
Returns a string representing the attributes of the card. |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final int number
public final int shading
public final int color
public final int shape
public static final int RED
public static final int PURPLE
public static final int GREEN
public static final int SOLID
public static final int STRIPED
public static final int OPEN
public static final int SQUIGGLE
public static final int DIAMOND
public static final int OVAL
| Constructor Detail |
public Card(int number,
int color,
int shading,
int shape)
number - The number for the card, which must be in the range [1,3].color - The color of the card. Possible colors are Card.RED (0),
Card.PURPLE (1), Card.GREEN (2).shading - The shading of the card. Possible shadings are Card.SOLID (0),
Card.STRIPED (1), Card.OPEN (2).shape - The shape for the card. Possible shapes are Card.SQUIGGLE( 0),
Card.DIAMOND (1), Card.OVAL (2).public Card(String name)
name - -
String representation of the card| Method Detail |
public int hashCode()
public boolean equals(Object o)
public String getImage()
The file is expected to be in the "images/" folder. The name can be
calculated as:
int c = (number + 3*color + 9*shape + 27 * shading)
c+".gif" if c>=10
"0"+c+".gif" if c< 10
public String toString()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||