|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.kosi.model.game.Bidding
This class handles the bidding sequence which is the first phase in a game of Bridge. It has methods for adding bids at the end of the sequence and checks the compliance to the bidding rules of Bridge.
ChangeLog:
$Log: Bidding.java,v $ Revision 1.9 2001/06/15 12:51:06 betacarotine Added the possibility to get the number of tricks that the declarer made while the game's state is PLAYING. Revision 1.8 2001/06/15 12:32:15 betacarotine hopefully removed two bugs Revision 1.7 2001/06/06 09:22:35 betacarotine updated documentation Revision 1.6 2001/06/01 14:49:54 betacarotine improved the result handling, added tournament scoring Revision 1.5 2001/06/01 13:22:58 jiriki GameView working again. Revision 1.4 2001/05/30 10:25:51 jiriki Refactored Client. Revision 1.3 2001/05/25 14:51:23 betacarotine Added a result handling mechanism for the game. Revision 1.2 2001/05/23 13:00:39 betacarotine Restructured the implementation of the game interface. Revision 1.1.1.1 2001/04/29 18:05:18 jiriki Imported sources from zola. Revision 1.14 2001/04/20 12:57:56 login added testcase for the Bidding class Revision 1.13 2001/04/17 19:30:08 wombat Updated Documentation Revision 1.12 2001/04/08 14:30:44 wombat Anfang Implementierung der selbst-alertierung Revision 1.11 2001/03/29 21:01:04 wombat - Improved logging. - Removed bugs from StressClient Revision 1.10 2001/03/22 16:40:46 wombat - Updated ant to 1.3 - Removed bugs in GameImpl and StressClient Revision 1.9 2001/03/21 22:34:40 wombat Worked on StressClient, removed bugs in GameImpl/Bidding, improved logging Revision 1.8 2001/03/06 18:07:19 login documented Revision 1.7 2001/03/05 20:55:22 login - Game (und zugehoerige Klassen) soweit fertig - package de.kosi.model.tournament angelegt - Pair angelegt - Round angelegt - Movement-Interface angelegt - KosiMovement fertig!!! :-) - KosiMovementTest um das KosiMovement zu testen (kann mit KOSI/kosimovementtestaufgerufen werden) - Tournament und TournamentImpl in das package de.kosi.model.tournament verschoben - buildfile fuer die neuen klassen angepasst Revision 1.6 2001/02/27 14:43:14 wombat Updated documentation. Revision 1.5 2001/02/26 15:21:37 wombat worked on GamImpl and Board Revision 1.4 2001/02/21 11:38:47 wombat Worked on GameImpl and Board Revision 1.3 2001/02/09 19:26:32 login Doc-Update Revision 1.2 2001/02/06 15:37:44 login Updated docs
Constructor Summary | |
Bidding(Players players,
Board board)
This constructor creates a new Bidding instance for the given players. |
Method Summary | |
void |
addBid(Bid bid,
Alert alert)
Adds the given bid to the end of the vector of bids. |
int |
getActivePlayer()
Returns the direction of the active player. |
Alert |
getAlert(int round,
int player)
Returns an Alert. |
Bid |
getBid(int round,
int player)
Returns the Bid that the given player made in the given bidding round. |
java.util.List |
getBidList()
Return the list of bids. |
java.util.List |
getBids()
Returns a list of Bids without information about alerts. |
Board |
getBoard()
Returns the board that the game is played on. |
java.util.List |
getCards(int direction)
Returns a list of cards currently in the hands of the player at the given direction. |
Contract |
getContract()
Returns the contract once the bidding is finished. |
int |
getFirstSuitBidIndex(int startIndex,
int suit)
Returns the index of the bid, that is the first occurance of the suit (But only by the pair that bid the bid at startIndex). |
SuitBid |
getLastSuitBid()
Returns the latest suit bid in the vector of bids (the one with the highest index) or null if no player has made a suit bid yet. |
int |
getLastSuitBidIndex()
Returns the index of the latest suit bid in the vector of bids (the one with the highest index) or -1 if no player has made a suit bid yet. |
int |
getNumRounds()
Returns the number of completed bidding rounds (rounds in which every player made an announcement). |
int |
getState()
Returns the state of the game which is Game.BIDDING. |
boolean |
isDoublePossible()
Checks whether the active player is allowed to double according to the rules of bridge. |
boolean |
isFinished()
Returns if the bidding is finished. |
boolean |
isRedoublePossible()
Checks whether the active player is allowed to redouble according to the rules of bridge. |
void |
removeLastBid()
Removes the latest bid from the vector of bids. |
int |
size()
Returns the number of bids made yet. |
java.lang.String |
toString()
Returns a String representation of the bidding. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Bidding(Players players, Board board)
players
- The players that have a game of Bridge together
and therefore need a bidding phase.board
- The board that the game of Bridge will be played
with. Needed to find out which player the opener is.Method Detail |
public void removeLastBid()
public SuitBid getLastSuitBid()
public int getFirstSuitBidIndex(int startIndex, int suit)
startIndex
- Bid that made the contract.suit
- Suit to look for.public int getLastSuitBidIndex()
public boolean isRedoublePossible()
public boolean isDoublePossible()
public void addBid(Bid bid, Alert alert) throws InvalidBidException
bid
- The bid to add.alert
- Alert object if the bid has been alerted, null otherwise.InvalidBidException
- If the addition violates the rules
of Bridge bidding.java.lang.IllegalArgumentException
- If bid is null.java.lang.IllegalStateException
- If the bidding has ended.public boolean isFinished()
public Contract getContract() throws InvalidGameStateException
InvalidGameStateException
- If the bidding phase is not finished yet.public Bid getBid(int round, int player)
round
- The bidding round.player
- The player who made the returned bid.java.lang.IllegalArgumentException
- If the round or player are out of bounds.ArrayIndexOutOfBoundsException
- If the round hasn't
been played yet or the player hasn't bidden in the specified
round yet.public Alert getAlert(int round, int player)
round
- Round the alert is returned for.player
- Player the alert is returned for.public int getNumRounds()
public java.util.List getBidList()
public java.util.List getBids()
public int getState()
getState
in interface GamePhase
public java.util.List getCards(int direction)
getCards
in interface GamePhase
direction
- The direction the player whose cards are to be
returned is seated at.public int getActivePlayer()
getActivePlayer
in interface GamePhase
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public Board getBoard()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |