cs4099
Class Card

java.lang.Object
  extended by cs4099.Card

public class Card
extends java.lang.Object

This class represents an individual playing card, which can have one of four suits and one of thirteen values.

Author:
David Newton
See Also:
Pile

Constructor Summary
Card(int suit, int value)
          Creates a new instance of Card.
 
Method Summary
 boolean equals(Card card)
          Comparator method for cards.
 javax.swing.JLabel getCardImage()
          A method that returns the image file that represents this card.
 javax.swing.JLabel getCardLabel()
          Builds a JLabel illustrating this card's properties.
 java.lang.String toString()
          Converts the data held in this card to string form for output.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Card

public Card(int suit,
            int value)
Creates a new instance of Card.

Parameters:
suit - The suit of the card (0-3: 0 = Spades, 1 = Hearts, 2 = Clubs, 3 = Diamonds)
value - The value of the card (1-13)
Method Detail

equals

public boolean equals(Card card)
Comparator method for cards.

Parameters:
card - The card to compare to
Returns:
True if the cards are equivalent, False if not.

toString

public java.lang.String toString()
Converts the data held in this card to string form for output.

Overrides:
toString in class java.lang.Object

getCardLabel

public javax.swing.JLabel getCardLabel()
Builds a JLabel illustrating this card's properties.

Returns:
A JLabel containing a suit image and textual value.

getCardImage

public javax.swing.JLabel getCardImage()
A method that returns the image file that represents this card.

Returns:
A JLabel containing the image.