public class Card extends java.lang.Object implements java.lang.Comparable<Card>
| Modifier and Type | Class and Description |
|---|---|
static class |
Card.Ranks |
static class |
Card.Suits |
| Modifier and Type | Field and Description |
|---|---|
private Card.Ranks |
rank |
private Card.Suits |
suit |
| Constructor and Description |
|---|
Card(Card.Ranks rank,
Card.Suits suit)
Constructor of Card.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Card card)
Provides a comparable method for type card.
|
boolean |
equals(java.lang.Object obj) |
Card.Ranks |
getRank()
Returns the rank of the present card
|
Card.Suits |
getSuit()
Returns the suit of the present card
|
int |
hashCode() |
boolean |
isHighCard()
Evaluates whether the card being evaluated is an high card
|
int |
minus(Card card)
Provides the true comparable between ranks.
|
java.lang.String |
toString()
Computes a valid representation of a card that can be printed.
|
private Card.Suits suit
private Card.Ranks rank
public Card(Card.Ranks rank, Card.Suits suit)
rank - Rank of card to be createdsuit - Suit of card to be createdpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Card card)
compareTo in interface java.lang.Comparable<Card>card - Card to be compared with the present onepublic int minus(Card card)
card - Card to be compared with the present onepublic Card.Suits getSuit()
public Card.Ranks getRank()
public boolean isHighCard()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object