|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectp2Util.Card
public class Card
The Card class models a single card identified by Rank and Suit
Class Invariant
Suit and Rank are not null
Card objects are immutable
| Constructor Summary | |
|---|---|
Card(p2Util.Suit suit,
p2Util.Rank rank)
Precondition: Suit and Rank are not null Postcondition: A new Card object is initialized |
|
| Method Summary | |
|---|---|
int |
compareTo(Card card)
This method compares the calling Card with the Card parameter base on Rank |
java.lang.String |
getFileName()
Preconditions: none Postconditions: returns the name of this Card's image file for GUI base applications |
java.lang.String |
getName()
Preconditions: none Postconditions: returns the name of this Card for text base applications |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Card(p2Util.Suit suit,
p2Util.Rank rank)
| Method Detail |
|---|
public java.lang.String getName()
public java.lang.String getFileName()
public int compareTo(Card card)
Precondition: parameter card is not null
Postcondition:
returns negative if the calling Card's Rank is less than the parameter's Rank
returns positive if the calling Card's Rank is greater than the parameter's Rank
returns 0 if the Card Ranks are the same
compareTo in interface java.lang.Comparable<Card>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||