|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.kosi.model.game.Trick
This class implements a trick in a game of Bridge.
ChangeLog:
$Log: Trick.java,v $ Revision 1.4 2001/06/27 11:53:21 betacarotine Worked on the Rubber and added comments. Revision 1.3 2001/06/15 12:06:10 betacarotine added serial version UIDs to Trick and CardList. Revision 1.2 2001/06/15 11:35:07 betacarotine added serialization support to the Trick Revision 1.1 2001/06/15 09:33:27 betacarotine Changed the Game-interface. Instead of int getLatestLeader() and List getLatestTrick() we now have Trick getLatestTrick() The internal representation and storage of the tricks is reimplemented too based on the new Trick-class.
Field Summary | |
static long |
serialVersionUID
Serial version id. |
Constructor Summary | |
Trick(int leader,
Card card,
int number)
Creates a new trick instance. |
Method Summary | |
void |
addCard(Card card,
CardList cardList)
Adds a card to the current trick. |
int |
getActivePlayer()
Returns the direction of the active player. |
Card |
getCard(int direction)
Returns the card played from the given direction. |
int |
getLeader()
Returns the direction of the leader of the trick. |
int |
getNumber()
Returns the number of the trick. |
int |
getNumberOfCards()
Returns the number of cards currently played in this trick. |
int |
getSuitToFollow()
Returns the suit to follow in the trick which is the suit of the first played card. |
int |
getWinner(SuitContract contract)
Returns the direction of the winner of the trick. |
boolean |
isComplete()
Returns true, if this trick is complete. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long serialVersionUID
Constructor Detail |
public Trick(int leader, Card card, int number)
leader
- The leader of the trick.card
- The card played by the leader;number
- The number of the trick.Method Detail |
public void addCard(Card card, CardList cardList) throws TrickException, InvalidCardException
card
- The card to be added to the trick.cardList
- The list of cards which must contain the given card.TrickException
- If the trick is already complete.InvalidCardException
- If the the given list of cards does
contain the given card or if the player has to follow suit.public Card getCard(int direction)
direction
- The direction you want to know the played card for.public int getLeader()
public int getNumber()
public int getSuitToFollow()
public boolean isComplete()
public int getNumberOfCards()
public int getActivePlayer() throws TrickException
TrickException
- If the trick is complete.public int getWinner(SuitContract contract) throws TrickException
contract
- The contract of the current game.TrickException
- If the trick is not complete so far.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |