|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.parlor.card.data.Card
public class Card
Instances of this class represent individual playing cards.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
Streamable.Closure |
| Field Summary | |
|---|---|
protected Byte |
_key
The comparison key. |
protected byte |
_value
The number of the card. |
| Fields inherited from interface com.threerings.parlor.card.data.CardCodes |
|---|
ACE, BLACK_JOKER, CLUBS, DIAMONDS, HEARTS, JACK, KING, QUEEN, RED_JOKER, SPADES |
| Fields inherited from interface com.threerings.presents.data.InvocationCodes |
|---|
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR |
| Constructor Summary | |
|---|---|
Card()
No-arg constructor for deserialization. |
|
Card(int number,
int suit)
Creates a new card. |
|
| Method Summary | |
|---|---|
int |
compareTo(Card other)
Compares this card to another. |
boolean |
equals(Object other)
|
Comparable<?> |
getKey()
|
int |
getNumber()
Returns the value of the card, either from 2 to 11 or KING, QUEEN, JACK, ACE, RED_JOKER, or BLACK_JOKER. |
int |
getSuit()
Returns the suit of the card: SPADES, HEARTS, DIAMONDS, or CLUBS. |
int |
hashCode()
|
boolean |
isAce()
Checks whether the card is an ace. |
boolean |
isFace()
Checks whether the card is a face card (KING, QUEEN, or JACK). |
boolean |
isJoker()
Checks whether the card is a joker. |
boolean |
isNumber()
Checks whether the card is a number card (2 to 10). |
boolean |
isValid()
Checks whether or not this card is valid. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected byte _value
protected transient Byte _key
| Constructor Detail |
|---|
public Card()
public Card(int number,
int suit)
number - the number of the cardsuit - the suit of the card| Method Detail |
|---|
public int getNumber()
public int getSuit()
public boolean isNumber()
public boolean isFace()
public boolean isAce()
public boolean isJoker()
public boolean isValid()
public Comparable<?> getKey()
getKey in interface DSet.Entrypublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Objectpublic int compareTo(Card other)
compareTo in interface Comparable<Card>other - the other card to compare this to
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||