|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Card
This class represents a playing card. Cards have a suit and a value
Field Summary | |
static int |
ACE
|
static int |
CLUBS
|
static int |
DIAMONDS
|
static int |
EIGHT
|
static int |
FIVE
|
static int |
FOUR
|
static int |
HEARTS
|
static int |
JACK
|
static int |
KING
|
static int |
NINE
|
static int |
QUEEN
|
static int |
SEVEN
|
static int |
SIX
|
static int |
SPADES
|
static int |
TEN
|
static int |
THREE
|
static int |
TWO
|
Constructor Summary | |
Card()
Default constructor pre: none post: getValue() = TWO getSuit() = CLUBS |
|
Card(int value,
int suit)
pre: TWO <= value <= ACE, CLUBS <= suit <= SPADES post: getValue() = value getSuit() = suit |
Method Summary | |
int |
compareTo(Object other)
|
boolean |
equals(Object otherCard)
pre: otherCard != null post: true iff two cards have same suit and value |
int |
getSuit()
pre: none post: returns cards Suit |
int |
getValue()
*pre: none post: returns cards Value |
String |
toString()
pre: none post: returns String with cards value and suit |
boolean |
validSuit(int suit)
|
boolean |
validValue(int value)
pre: none post: returns true iff value between TWO and ACE inclusive |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int ACE
public static final int CLUBS
public static final int DIAMONDS
public static final int EIGHT
public static final int FIVE
public static final int FOUR
public static final int HEARTS
public static final int JACK
public static final int KING
public static final int NINE
public static final int QUEEN
public static final int SEVEN
public static final int SIX
public static final int SPADES
public static final int TEN
public static final int THREE
public static final int TWO
Constructor Detail |
public Card()
public Card(int value, int suit)
Method Detail |
public int compareTo(Object other)
compareTo
in interface Comparable
public boolean equals(Object otherCard)
equals
in class Object
public int getSuit()
public int getValue()
public String toString()
toString
in class Object
public boolean validSuit(int suit)
public boolean validValue(int value)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |