|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.kosi.model.game.GameImpl
This class implements a nice game of Bridge.
ChangeLog:
$Log: GameImpl.java,v $ Revision 1.20 2001/08/30 10:44:38 jiriki Finished implementation of claim Revision 1.19 2001/08/30 08:05:19 jiriki Worked on claiming Revision 1.18 2001/08/28 12:35:23 jiriki Started Implementation of claim Revision 1.17 2001/07/31 12:55:27 betacarotine worked on the tournament Revision 1.16 2001/07/31 12:15:23 betacarotine worked on the tournament Revision 1.15 2001/07/13 14:42:38 jiriki Worked on bugs. Revision 1.14 2001/07/13 10:49:06 jiriki Started fix for Bugs 440155 and 440333. Revision 1.13 2001/07/04 12:17:12 uid51247 now the rubber valuations are available to the clients Revision 1.12 2001/06/27 11:53:20 betacarotine Worked on the Rubber and added comments. Revision 1.11 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.10 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. Revision 1.9 2001/06/06 09:22:35 betacarotine updated documentation Revision 1.8 2001/06/01 14:49:54 betacarotine improved the result handling, added tournament scoring Revision 1.7 2001/06/01 13:22:58 jiriki GameView working again. Revision 1.6 2001/05/30 10:25:51 jiriki Refactored Client. Revision 1.5 2001/05/30 08:42:50 betacarotine Updated documentation Revision 1.4 2001/05/25 14:51:23 betacarotine Added a result handling mechanism for the game. Revision 1.3 2001/05/23 13:00:39 betacarotine Restructured the implementation of the game interface. Revision 1.2 2001/05/09 11:44:40 betacarotine The Table interface got a getDirection method that returns the direction of the calling user. Revision 1.1.1.1 2001/04/29 18:05:18 jiriki Imported sources from zola. Revision 1.26 2001/04/27 12:49:35 login Added Locale in user creation, improved game stopwatch Revision 1.25 2001/04/25 12:47:06 login Implemented stopwatch Revision 1.24 2001/04/25 12:05:40 login Worked on TournamentImpl Revision 1.23 2001/04/17 19:30:08 wombat Updated Documentation Revision 1.22 2001/04/09 15:36:19 wombat Improved UserImpl, removed bugs Revision 1.21 2001/04/09 13:03:10 wombat Removed timeout from threadpool (did not work) Revision 1.20 2001/04/08 14:30:45 wombat Anfang Implementierung der selbst-alertierung Revision 1.19 2001/03/29 21:01:04 wombat - Improved logging. - Removed bugs from StressClient Revision 1.18 2001/03/27 14:51:00 timo Removed Copy & Paste Error Replaced NorthSouth with EastWest Revision 1.17 2001/03/27 12:29:29 wombat GameListener are now send the last event, that occurred, when they register. Revision 1.16 2001/03/27 10:38:53 wombat Added getOpener method and modified StressClient to user it. There is a problem with the StressClient, when the listeners are not registered before events are sent. The GameImpl should the last event to the listener, after it registered. Revision 1.15 2001/03/23 10:48:52 wombat - Table now restarts game - began GuestUser implementation Revision 1.14 2001/03/22 16:40:47 wombat - Updated ant to 1.3 - Removed bugs in GameImpl and StressClient Revision 1.13 2001/03/21 22:34:40 wombat Worked on StressClient, removed bugs in GameImpl/Bidding, improved logging Revision 1.12 2001/03/21 13:26:36 wombat - Removed bugs in Table - began implementation of stree client - updated documentation Revision 1.11 2001/03/19 21:50:49 wombat - Worked on admin client. - improved shutdown sequence - removed bugs in login/logout sequence Revision 1.10 2001/03/16 10:01:48 login removed one bug Revision 1.9 2001/03/15 19:58:27 login now dummy down events are sent!! Revision 1.8 2001/03/15 19:19:48 login Worked on GameImpl to make it possible that the declarer plays the dummy's cards and prohibit that the dummy does anything. Revision 1.7 2001/03/06 18:07:19 login documented Revision 1.6 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.5 2001/03/02 09:43:14 wombat Worked on gameimpl Revision 1.4 2001/02/27 14:43:14 wombat Updated documentation. Revision 1.3 2001/02/26 15:21:37 wombat worked on GamImpl and Board Revision 1.2 2001/02/21 11:38:47 wombat Worked on GameImpl and Board Revision 1.1 2001/02/20 11:32:17 wombat Started GameImpl implementation.
Fields inherited from interface de.kosi.model.game.Game |
BIDDING, CLAIMING, FINISHED, PLAYING |
Constructor Summary | |
GameImpl(Board board,
Players players,
GameContainer container,
ChatChannel chatChannel)
Creates a new GameImpl. |
Method Summary | |
void |
addGameListener(GameListener listener)
Add a GameListener to this Game. |
void |
answerClaim(boolean accept)
Answer a claim. |
void |
appealToJudge(java.lang.String reason)
Appeal to a judge. |
void |
bid(Bid bid,
boolean alerted)
Bid a bid. |
void |
claim(int tricks)
Claim the remaining tricks. |
int |
getActivePlayer()
Returns the player (direction), that is currently due to make a move. |
Alert |
getAlert(int round,
int player)
Returns an Alert. |
java.util.List |
getBids()
Returns a bid. |
java.util.List |
getCards()
Returns the cards *currently* in the hand of the caller. |
java.util.List |
getCards(int direction)
Returns the cards in one direction of the board. |
ChatChannel |
getChatChannel()
This method returns the ChatChannel of this game. |
Contract |
getContract()
Returns the contract being played. |
int |
getDeclarerTricks()
Returns the number of tricks the declarer made so far. |
int |
getDirection()
Returns the direction of the calling player. |
java.util.List |
getDummyCards()
Returns the cards of the dummy. |
Trick |
getLatestTrick()
Returns the trick currently played. |
int |
getOpener()
Returns the opener of the bidding sequence. |
java.lang.String[] |
getPlayerNames()
Returns the names of the player currently taking part in this Game. |
Players |
getPlayers()
|
Result |
getResult()
This method returns the result of the game of Bridge. |
int |
getStatus()
This method returns the status of the game. |
boolean |
isVulnerableEastWest()
Returns wether East and West are vulnerable. |
boolean |
isVulnerableNorthSouth()
Returns wether North and South are vulnerable. |
void |
play(Card card)
Play a card. |
void |
removeGameListener(GameListener listener)
Removes a GameListener from this Game. |
void |
terminate()
Terminate the game in case that the time was exceeded. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GameImpl(Board board, Players players, GameContainer container, ChatChannel chatChannel)
board
- Board to play.players
- Players of this Game.container
- Container of this game.chatChannel
- ChatChannel of this game.Method Detail |
public int getStatus()
getStatus
in interface Game
public ChatChannel getChatChannel()
getChatChannel
in interface Game
public void addGameListener(GameListener listener) throws InvalidSessionException
addGameListener
in interface Game
listener
- the game listener.InvalidSessionException
- when not called from within a
valid session context.public void removeGameListener(GameListener listener) throws InvalidSessionException
removeGameListener
in interface Game
listener
- the game listener.InvalidSessionException
- when not called from within a
valid session context.public java.lang.String[] getPlayerNames()
getPlayerNames
in interface Game
public int getActivePlayer() throws InvalidGameStateException
getActivePlayer
in interface Game
InvalidGameStateException
- If the game is already
finished.public void appealToJudge(java.lang.String reason)
appealToJudge
in interface Game
reason
- Reason for calling a judge.public int getDirection() throws KosiAccessException, InvalidSessionException
getDirection
in interface Game
KosiAccessException
- if the player is not currently seated at this
gameInvalidSessionException
- if not called from a valid session context.
and therefor has no direction assigned.public int getOpener()
getOpener
in interface Game
public boolean isVulnerableNorthSouth()
isVulnerableNorthSouth
in interface Game
public boolean isVulnerableEastWest()
isVulnerableEastWest
in interface Game
public java.util.List getCards(int direction) throws InvalidGameStateException
getCards
in interface Game
direction
- Direction the cards should be returned for.InvalidGameStateException
- If the game is not finished
yet.public java.util.List getCards() throws KosiAccessException, InvalidSessionException
getCards
in interface Game
KosiAccessException
- If the caller isn't playing this game.InvalidSessionException
- If called from an invalid
session context.public Players getPlayers()
public java.util.List getDummyCards() throws KosiAccessException
getDummyCards
in interface Game
KosiAccessException
- If the dummy cards are not
available. The dummy cards become available to all players and
watchers after the opening lead has been made.public Alert getAlert(int round, int player) throws KosiAccessException, InvalidGameStateException, InvalidSessionException
getAlert
in interface Game
round
- Round the alert is returned for.player
- Player the alert is returned for.KosiAccessException
- if the calling user is not allowed to request this information.InvalidSessionException
- if not called from a valid session context.InvalidGameStateException
- if not in state of bidding.public java.util.List getBids() throws InvalidGameStateException
getBids
in interface Game
round
- Round the bid is returned for.player
- Player the bid is returned for.InvalidGameStateException
- if not in state of bidding.public void bid(Bid bid, boolean alerted) throws KosiAccessException, InvalidBidException, InvalidGameStateException, InvalidSessionException
bid
in interface Game
bid
- Bid to bid.alerted
- True, if this bid should be alerted.KosiAccessException
- if the calling user is not allowed to place a
bid.InvalidGameStateException
- if not in state of bidding.InvalidBidException
- if the bid is not according to the bridge
rules.InvalidSessionException
- if not called from a valid session context.public Contract getContract() throws InvalidGameStateException
getContract
in interface Game
InvalidGameStateException
- If the game's state is
BIDDING.public Trick getLatestTrick() throws InvalidGameStateException, FirstTrickException
getLatestTrick
in interface Game
InvalidGameStateException
- If the game's state is
BIDDING.FirstTrickException
- If the opening lead has not been
made yet.public void play(Card card) throws KosiAccessException, InvalidCardException, InvalidSessionException, InvalidGameStateException
play
in interface Game
card
- Card to play.KosiAccessException
- if the calling user is not allowed to
play this card.InvalidCardException
- If the card cannot be played.InvalidSessionException
- If the method was called from
an invalid session context.InvalidGameStateException
- If the status is either
BIDDING or FINISHED.public Result getResult() throws InvalidGameStateException
getResult
in interface Game
InvalidGameStateException
- If the game hasn't been
finished yet.public void claim(int tricks) throws KosiAccessException, InvalidGameStateException, InvalidSessionException
claim
in interface Game
tricks
- number of tricks to claim.public void answerClaim(boolean accept) throws KosiAccessException, InvalidGameStateException, InvalidSessionException
answerClaim
in interface Game
accept
- wether or not the claim is accepted.public void terminate()
public int getDeclarerTricks() throws InvalidGameStateException
getDeclarerTricks
in interface Game
InvalidGameStateException
- If the game is in the bidding
phase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |