poker
Class Card

java.lang.Object
  extended by poker.Card

public class Card
extends java.lang.Object

An immutable class representing a playing card from a standard deck. Each card has a value and a suit.

Author:
Fawzi Emad (c) 2008

Constructor Summary
Card(int value, int suit)
          Standard constructor.
 
Method Summary
 java.lang.String getImageFileName()
          [STUDENTS SHOULD NOT BE CALLING THIS METHOD!] Used for finding the image corresponding to this Card.
 int getSuit()
          "Getter" for suit of Card.
 int getValue()
          "Getter" for value of Card.
 java.lang.String toString()
          Returns the name of the card as a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Card

public Card(int value,
            int suit)
Standard constructor.

Parameters:
value - 1 through 13; 1 represents Ace, 2 through 10 for numerical cards, 11 is Jack, 12 is Queen, 13 is King
suit - 0 through 3; represents Spades, Hearts, Clubs, or Diamonds
Method Detail

getValue

public int getValue()
"Getter" for value of Card.

Returns:
value of card (1-13; 1 for Ace, 2-10 for numerical cards, 11 for Jack, 12 for Queen, 13 for King)

getSuit

public int getSuit()
"Getter" for suit of Card.

Returns:
suit of card (0-3; 0 for Spades, 1 for Hearts, 2 for Clubs, 3 for Diamonds)

toString

public java.lang.String toString()
Returns the name of the card as a String. For example, the 2 of hearts would be "2 of h", and the Jack of Spades would be "J of s".

Overrides:
toString in class java.lang.Object
Returns:
string that looks like: value "of" suit

getImageFileName

public java.lang.String getImageFileName()
[STUDENTS SHOULD NOT BE CALLING THIS METHOD!] Used for finding the image corresponding to this Card.

Returns:
path of image file corresponding to this Card.


Web Accessibility