public class Card extends Object implements com.threerings.presents.dobj.DSet.Entry, Comparable<Card>, CardCodes
| Constructor and Description |
|---|
Card()
No-arg constructor for deserialization.
|
Card(int number,
int suit)
Creates a new card.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
public Card()
public Card(int number,
int suit)
number - the number of the cardsuit - the suit of the cardpublic 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 com.threerings.presents.dobj.DSet.Entrypublic int compareTo(Card other)
compareTo in interface Comparable<Card>other - the other card to compare this toCopyright © 2015. All rights reserved.