public class Card extends Object implements Comparable<Card>
Constructor and Description |
---|
Card(CardValue aValue,
CardSuit aSuit)
Creates a new playing card.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Card c)
Compares this card with the specified card for order.
|
boolean |
equals(Object otherCardObject)
Returns true if this card is equal to the other card.
|
CardSuit |
getSuit() |
CardValue |
getValue() |
int |
hashCode()
Returns a hashcode for this object.
|
String |
toString() |
public int compareTo(Card c)
Cards are ranked primarily by number, secondarily by suit. That means that this card is ranked lower than another card if one of these conditions is met:
compareTo
in interface Comparable<Card>
c
- the Card to be comparedClassCastException
- if the specified object's type is not CardNullPointerException
- if the specified object is nullo
is not an instance of Card, throws a
ClassCastException
o
is null, throws a
NullPointerException
Card
is less than, equal to, or greater than the specified
Card
, respectivelypublic boolean equals(Object otherCardObject)
public int hashCode()