Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## glassfrog.model
Class Card

    java.lang.Object
      glassfrog.model.Card

All Implemented Interfaces:
  java.io.Serializable

    public class Card

extends java.lang.Object
implements java.io.Serializable

The Card class is used to represent cards in the deck. The cards have a suit and a rank and are initialized as such

Author:
  jdavidso
See Also:
  Serialized Form

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

### rank

    private java.lang.Integer rank

### suit

    private java.lang.String suit

Constructor Detail

### Card

    public Card()

  A default constructor with rank 0 and unsuited.

### Card

    public 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.

  Parameters:
    `suit` - The String representation of a playing card suit
    `rank` - The Integer representation of the card suit.

### Card

    public Card(java.lang.String cardString)

  This constructor constructs a card out of just a string. Strinks are Rank then Suit, as such As for the Ace of spades, Kh for the king of hearts Qd for the queen of diamonds Jc for the Jack of clubs then Th for the 10 of hearts 9-2 for the other ranks

  Parameters:
    `cardString` - A String representation of the card

Method Detail

### getRank

    public java.lang.Integer getRank()

  Returns the rank of the Card

  Returns:
    rank

### getSuit

    public java.lang.String getSuit()

  Returns the suit of the Card

  Returns:
    suit

### toString

    public java.lang.String toString()

  Returns a human readable String representation of the Card given by the rank then the first character of the suit. ie: 7d, Ac

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a String representing the card (Suit and Rank)

### printSuit

    private java.lang.String printSuit()

  Returns the first character of the suit in lower case.

  Returns:
    substring(0,1) suit

### printRank

    private java.lang.String printRank()

  Returns a human readable rank from the rank integer.

  Returns:
    rank {(0-9, T, J, Q, K, A }

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD