com.javaflair.pokerprophesier.api.card
Class Card

java.lang.Object
  extended by com.javaflair.pokerprophesier.api.card.Card
All Implemented Interfaces:
Comparable

public class Card
extends Object
implements Comparable

A representation of a playing card.

Author:
Javaflair

Field Summary
static int ACE
          Rank: ace
static int CLUBS
          Suit: clubs
static int DIAMONDS
          Suit: diamonds
static int EIGHT
          Rank: eight
static int FIVE
          Rank: five
static int FOUR
          Rank: four
static int HEARTS
          Suit: hearts
static int JACK
          Rank: jack
static int KING
          Rank: king
static int NINE
          Rank: nine
static int QUEEN
          Rank: queen
static int SEVEN
          Rank: seven
static int SIX
          Rank: six
static int SPADES
          Suit: spades
static int TEN
          Rank: ten
static int THREE
          Rank: three
static int TWO
          Rank: two
 
Constructor Summary
Card(int rank, int suit)
          Constructs a card with the specified rank and suit.
Card(int rank, int suit, boolean isHoleCard)
          Constructs a card with the specified rank, suit and boolean flag which indicates whether the card is a hole card.
 
Method Summary
 int compareTo(Object obj)
          Performs a comparison based on rank.
 boolean equals(Object obj)
           
 int getRank()
          Returns the card's rank.
 int getSuit()
          Returns the card's suit.
 int hashCode()
           
 boolean isHoleCard()
          Returns a boolean indicating whether the card is a hole card.
 void setHoleCard(boolean isHoleCard)
          Sets the hole card flag.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TWO

public static final int TWO
Rank: two

See Also:
Constant Field Values

THREE

public static final int THREE
Rank: three

See Also:
Constant Field Values

FOUR

public static final int FOUR
Rank: four

See Also:
Constant Field Values

FIVE

public static final int FIVE
Rank: five

See Also:
Constant Field Values

SIX

public static final int SIX
Rank: six

See Also:
Constant Field Values

SEVEN

public static final int SEVEN
Rank: seven

See Also:
Constant Field Values

EIGHT

public static final int EIGHT
Rank: eight

See Also:
Constant Field Values

NINE

public static final int NINE
Rank: nine

See Also:
Constant Field Values

TEN

public static final int TEN
Rank: ten

See Also:
Constant Field Values

JACK

public static final int JACK
Rank: jack

See Also:
Constant Field Values

QUEEN

public static final int QUEEN
Rank: queen

See Also:
Constant Field Values

KING

public static final int KING
Rank: king

See Also:
Constant Field Values

ACE

public static final int ACE
Rank: ace

See Also:
Constant Field Values

HEARTS

public static final int HEARTS
Suit: hearts

See Also:
Constant Field Values

DIAMONDS

public static final int DIAMONDS
Suit: diamonds

See Also:
Constant Field Values

SPADES

public static final int SPADES
Suit: spades

See Also:
Constant Field Values

CLUBS

public static final int CLUBS
Suit: clubs

See Also:
Constant Field Values
Constructor Detail

Card

public Card(int rank,
            int suit)
Constructs a card with the specified rank and suit. A card must be defined using the appropriate rank and suit constants.

Parameters:
rank - the rank
suit - the suit

Card

public Card(int rank,
            int suit,
            boolean isHoleCard)
Constructs a card with the specified rank, suit and boolean flag which indicates whether the card is a hole card. A card must be defined using the appropriate rank and suit constants.

Parameters:
rank - the rank
suit - the suit
isHoleCard - the hole card flag
Method Detail

getRank

public int getRank()
Returns the card's rank.

Returns:
the rank

getSuit

public int getSuit()
Returns the card's suit.

Returns:
the suit

setHoleCard

public void setHoleCard(boolean isHoleCard)
Sets the hole card flag.

Parameters:
isHoleCard - the flag

isHoleCard

public boolean isHoleCard()
Returns a boolean indicating whether the card is a hole card.

Returns:
true if the card is a hole card; false if not

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Object obj)
Performs a comparison based on rank.

Specified by:
compareTo in interface Comparable
Parameters:
obj - the object to compare to
Returns:
the comparison result

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006 Javaflair. All Rights Reserved.