|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglassfrog.model.Card
public class Card
The Card class is used to represent cards in the deck. The cards have a suit and a rank and are initialized as such
Field Summary | |
---|---|
private java.lang.Integer |
rank
|
private java.lang.String |
suit
|
Constructor Summary | |
---|---|
Card()
A default constructor with rank 0 and unsuited. |
|
Card(java.lang.String cardString)
This constructor constructs a card out of just a string. |
|
Card(java.lang.String suit,
java.lang.Integer rank)
This is the constructor most often used to create a card with a given suit and rank. |
Method Summary | |
---|---|
java.lang.Integer |
getRank()
Returns the rank of the Card |
java.lang.String |
getSuit()
Returns the suit of the Card |
private java.lang.String |
printRank()
Returns a human readable rank from the rank integer. |
private java.lang.String |
printSuit()
Returns the first character of the suit in lower case. |
java.lang.String |
toString()
Returns a human readable String representation of the Card given by the rank then the first character of the suit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.Integer rank
private java.lang.String suit
Constructor Detail |
---|
public Card()
public Card(java.lang.String suit, java.lang.Integer rank)
suit
- The String representation of a playing card suitrank
- The Integer representation of the card suit.public Card(java.lang.String cardString)
cardString
- A String representation of the cardMethod Detail |
---|
public java.lang.Integer getRank()
public java.lang.String getSuit()
public java.lang.String toString()
toString
in class java.lang.Object
private java.lang.String printSuit()
private java.lang.String printRank()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |