org.ninm.games.cardgames.common
Class Card

java.lang.Object
  |
  +--org.ninm.games.cardgames.common.Card
Direct Known Subclasses:
Joker

public class Card
extends java.lang.Object

this class represents an arbitrary playing card

Version:
1.0
Author:
Nikolay

Field Summary
protected  java.lang.Object m_deckID
          and ID used to distinguish between different decks
protected  Face m_face
          the face of this card
protected  Suit m_suit
          the suit of this card
 
Constructor Summary
Card(Face face, Suit suit)
          creates a new card with a null ID
Card(Face face, Suit suit, java.lang.Object deckID)
          creates a new card with a specified ID
 
Method Summary
 boolean equals(java.lang.Object other)
          compares the members for equality
 java.lang.Object getDeckID()
          returns the deck ID of this card (i.e.
 Face getFace()
          returns the face of this card
 Suit getSuit()
          returns the suit of this card
 int hashCode()
          the hashcode based on the members
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_face

protected final Face m_face
the face of this card


m_deckID

protected final java.lang.Object m_deckID
and ID used to distinguish between different decks


m_suit

protected final Suit m_suit
the suit of this card

Constructor Detail

Card

public Card(Face face,
            Suit suit)
creates a new card with a null ID

Parameters:
face - the face of this card
suit - the suit of this card

Card

public Card(Face face,
            Suit suit,
            java.lang.Object deckID)
creates a new card with a specified ID

Parameters:
face - the face of this card
suit - the suit of this card
deckID - the id that distinguishes two cards by the deck they belong to
Method Detail

hashCode

public int hashCode()
the hashcode based on the members

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object other)
compares the members for equality

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

getFace

public Face getFace()
returns the face of this card

Returns:
Face the face of this card

getSuit

public Suit getSuit()
returns the suit of this card

Returns:
Suit the suit of this card

getDeckID

public java.lang.Object getDeckID()
returns the deck ID of this card (i.e. which deck does this card belong to

Returns:
Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SourceForge.net Logo