jskat.share
Class Card

java.lang.Object
  extended by jskat.share.Card

public class Card
extends java.lang.Object

Card class

Author:
Jan Schäfer, Markus J. Luzius

Field Summary
(package private) static org.apache.log4j.Logger log
           
 
Constructor Summary
Card(int suit, int value)
          Creates a new instance of Card
Card(java.lang.String card)
          Creates a new instance of Card by a definition string in the form of "SUIT-VALUE", each being a one-character abbreviation:
e.g.
 
Method Summary
 boolean beats(Card cardToCompare, GameAnnouncement gameAnnouncement, Card firstTrickCard)
          Checks whether the card beats another given card under the current game type and trumpf color with respect to the initial card on the table
 boolean beats(Card cardToCompare, int gameType, int currentTrumpColor, int initialColor)
          Deprecated.  
 boolean equals(Card card)
          Implementation of the equals() method
 boolean equals(java.lang.Object card)
           
 int getCalcValue()
          Get the Card value for calculations
 int getNullValue()
          Get the Card value for null games
 int getRamschValue()
          Get the Card value for ramsch games
 int getSuit()
          Get the Card suit
 int getSuitGrandValue()
          Get the Card value for suit or grand games
 int getSuitValue()
          Get the Card suit value
 int getValue()
          Get the Card value
 boolean isSameCalcValue(Card cardToCompare)
          Compares the Cards whether the value is the same or not
 boolean isSameNullValue(Card cardToCompare)
          Compares the Cards whether the value is the same or not
 boolean isSameRamschValue(Card cardToCompare)
          Compares the Cards whether the value is the same or not
 boolean isSameSuit(Card cardToCompare)
          Compares the Cards whether the suit is the same or not
 boolean isSameSuitGrandValue(Card cardToCompare)
          Compares the Cards whether the value is the same or not
 boolean isSameValue(Card cardToCompare)
          Compares the Cards whether the value is the same or not
 boolean isTrump(int currentTrumpColor)
          Deprecated.  
 boolean isTrump(int gameType, int trumpColor)
          Checks whether a Card is a trump card or not
 java.lang.String toString()
          Implementation of the toString() method
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

static org.apache.log4j.Logger log
Constructor Detail

Card

public Card(java.lang.String card)
Creates a new instance of Card by a definition string in the form of "SUIT-VALUE", each being a one-character abbreviation:
e.g. "D-K" for king of diamonds, "S-1" for ten of spades

Parameters:
card -

Card

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

Method Detail

isSameSuit

public boolean isSameSuit(Card cardToCompare)
Compares the Cards whether the suit is the same or not


isSameValue

public boolean isSameValue(Card cardToCompare)
Compares the Cards whether the value is the same or not


isSameCalcValue

public boolean isSameCalcValue(Card cardToCompare)
Compares the Cards whether the value is the same or not


isSameSuitGrandValue

public boolean isSameSuitGrandValue(Card cardToCompare)
Compares the Cards whether the value is the same or not


isSameNullValue

public boolean isSameNullValue(Card cardToCompare)
Compares the Cards whether the value is the same or not


isSameRamschValue

public boolean isSameRamschValue(Card cardToCompare)
Compares the Cards whether the value is the same or not


getSuit

public int getSuit()
Get the Card suit


getSuitValue

public int getSuitValue()
Get the Card suit value


getValue

public int getValue()
Get the Card value


getCalcValue

public int getCalcValue()
Get the Card value for calculations


getSuitGrandValue

public int getSuitGrandValue()
Get the Card value for suit or grand games


getNullValue

public int getNullValue()
Get the Card value for null games


getRamschValue

public int getRamschValue()
Get the Card value for ramsch games


beats

public boolean beats(Card cardToCompare,
                     int gameType,
                     int currentTrumpColor,
                     int initialColor)
Deprecated. 

Checks whether the card beats another given card under the current game type and trumpf color with respect to the initial card on the table

Parameters:
cardToCompare -
gameType -
currentTrumpColor -
initialColor -
Returns:
TRUE if the card beats the other one

beats

public boolean beats(Card cardToCompare,
                     GameAnnouncement gameAnnouncement,
                     Card firstTrickCard)
Checks whether the card beats another given card under the current game type and trumpf color with respect to the initial card on the table

Parameters:
cardToCompare -
gameAnnouncement -
firstTrickCard -
Returns:
TRUE if the card beats the other one

isTrump

public boolean isTrump(int currentTrumpColor)
Deprecated. 

Checks whether a Card is a trump card or not This method is deprecated, because it is only valid for suit games

Parameters:
currentTrumpColor -
Returns:
TRUE, when the card is a trump card

isTrump

public boolean isTrump(int gameType,
                       int trumpColor)
Checks whether a Card is a trump card or not

Parameters:
gameType - The game type within the card is checked
trumpColor - The trump color, only needed in suit games
Returns:
TRUE, when the card is a trump card

equals

public boolean equals(java.lang.Object card)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(Card card)
Implementation of the equals() method

Parameters:
card - The Card to compare
Returns:
TRUE, when the Cards are equal

toString

public java.lang.String toString()
Implementation of the toString() method

Overrides:
toString in class java.lang.Object
Returns:
A human readable String for the card