Holger's
Java API

com.antelmann.game.card
Class Card

java.lang.Object
  extended by com.antelmann.game.card.Card
All Implemented Interfaces:
Serializable

public class Card
extends Object
implements Serializable

a representation of a game card

Author:
Holger Antelmann
See Also:
Serialized Form

Field Summary
static int ACE
           
static boolean BIG_DECK
           
static byte CLUBS
           
static byte DIAMONDS
           
static int EIGHT
           
static int FIVE
           
static int FOUR
           
static byte HEARTS
           
static int JACK
           
static int JOKER
           
static int KING
           
static int NINE
           
static int QUEEN
           
static int SEVEN
           
static int SIX
           
static boolean SMALL_DECK
           
static byte SPADES
           
static int TEN
           
static int THREE
           
static int TWO
           
 
Constructor Summary
Card(int type)
          to instanciate a Joker only; accepts only JOKER as type
Card(int rank, byte suit)
          use static members of this class for parameters
 
Method Summary
 boolean equals(Object obj)
           
 int getRank()
           
 byte getSuit()
           
 boolean isInSmallDeck()
          returns true only if the Card is one that belongs in a small deck (Ace, King, Queen, Jack, Ten, Nine, Eight, Seven)
 boolean sameRank(Card c)
           
 boolean sameSuit(Card c)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BIG_DECK

public static final boolean BIG_DECK
See Also:
Constant Field Values

SMALL_DECK

public static final boolean SMALL_DECK
See Also:
Constant Field Values

CLUBS

public static final byte CLUBS
See Also:
Constant Field Values

SPADES

public static final byte SPADES
See Also:
Constant Field Values

HEARTS

public static final byte HEARTS
See Also:
Constant Field Values

DIAMONDS

public static final byte DIAMONDS
See Also:
Constant Field Values

ACE

public static final int ACE
See Also:
Constant Field Values

KING

public static final int KING
See Also:
Constant Field Values

QUEEN

public static final int QUEEN
See Also:
Constant Field Values

JACK

public static final int JACK
See Also:
Constant Field Values

TEN

public static final int TEN
See Also:
Constant Field Values

NINE

public static final int NINE
See Also:
Constant Field Values

EIGHT

public static final int EIGHT
See Also:
Constant Field Values

SEVEN

public static final int SEVEN
See Also:
Constant Field Values

SIX

public static final int SIX
See Also:
Constant Field Values

FIVE

public static final int FIVE
See Also:
Constant Field Values

FOUR

public static final int FOUR
See Also:
Constant Field Values

THREE

public static final int THREE
See Also:
Constant Field Values

TWO

public static final int TWO
See Also:
Constant Field Values

JOKER

public static final int JOKER
See Also:
Constant Field Values
Constructor Detail

Card

public Card(int type)
     throws IllegalArgumentException
to instanciate a Joker only; accepts only JOKER as type

Throws:
IllegalArgumentException

Card

public Card(int rank,
            byte suit)
     throws IllegalArgumentException
use static members of this class for parameters

Throws:
IllegalArgumentException
Method Detail

isInSmallDeck

public boolean isInSmallDeck()
returns true only if the Card is one that belongs in a small deck (Ace, King, Queen, Jack, Ten, Nine, Eight, Seven)


getSuit

public byte getSuit()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

sameRank

public boolean sameRank(Card c)

sameSuit

public boolean sameSuit(Card c)

getRank

public int getRank()

toString

public String toString()
Overrides:
toString in class Object


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads