|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IGuiCard
This interface must be implemented by cards that will be used in the Solitaire package. There are only two methods required for a card class to be used in the GUI Solitaire package: one that provides a card's ID, and one that indicates whether a card is face up.
The interface method getCardID
must be implemented to return a
lower-case string such as "as", "ah", "ac", "ad", ... "4h", "5h", and so on
where the rank is the first character and it's one of "shcd"
.
To facilitate returning appropriate IDs, implementers are urged to use this
interface's constant String arrays for accessing appropriate strings, e.g.,
IGuiCard.rankPrefixes[0]
returns the appropriate string for an
ace -- "a" and IGuiCard.rankPrefixes[12]
returns the
appropriate string for a king -- "k".
Note that for accessing these constants, "ace" is 0, "two" is 1, and "king"
is 12. However, the actual rank of a card representing an ace can be 14 or 1
or any number, e.g., when returned by a card's getRank
method
if there is such a method. The two methods in this interface are used in the
GUI, but not as part of any game (though they could be so used).
Field Summary | |
---|---|
static int |
CLUBS
The int value for the suit CLUBS, useful in accessing suitPrefixes or for other purposes. |
static int |
DIAMONDS
The int value for the suit DIAMONDS, useful in accessing suitPrefixes or for other purposes. |
static int |
HEARTS
The int value for the suit HEARTS, useful in accessing suitPrefixes or for other purposes. |
static java.lang.String[] |
rankPrefixes
String values useful in constructing return values for getCardId . |
static int |
SPADES
The int value for the suit SPADES, useful in accessing suitPrefixes or for other purposes. |
static java.lang.String[] |
suitPrefixes
String values useful in constructing return values for getCardId . |
Method Summary | |
---|---|
java.lang.String |
getCardId()
Return a value used in the gui Solitaire package, the returned value must obey a contract: it's a two character lowercase string with first character the rank, the second the suit. |
boolean |
isFaceUp()
Return true when the card is face up, and false otherwise. |
Field Detail |
---|
static final int SPADES
suitPrefixes
or for other purposes.
static final int HEARTS
suitPrefixes
or for other purposes.
static final int CLUBS
suitPrefixes
or for other purposes.
static final int DIAMONDS
suitPrefixes
or for other purposes.
static final java.lang.String[] rankPrefixes
getCardId
.
static final java.lang.String[] suitPrefixes
getCardId
.
Method Detail |
---|
java.lang.String getCardId()
boolean isFaceUp()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |