|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the interface to a game of Bridge as it is seen by the Client. The interface does not contain methods, that are used internally. These can be found in the class GameImpl. If a method call fails with a RemoteException, it is unclear, wether the state of the Game changed. In this case the client should repeat the method call. The Game implementation is responsible for sorting out duplicate calls and throwing exceptions to inform the client on this.
ChangeLog:
$Log: Game.java,v $ Revision 1.6 2001/08/28 12:35:23 jiriki Started Implementation of claim Revision 1.5 2001/07/13 10:49:06 jiriki Started fix for Bugs 440155 and 440333. Revision 1.4 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.3 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.2 2001/05/23 13:28:27 betacarotine updated docs Revision 1.1.1.1 2001/04/29 18:05:18 jiriki Imported sources from zola. Revision 1.21 2001/04/17 19:30:08 wombat Updated Documentation Revision 1.20 2001/04/09 13:03:10 wombat Removed timeout from threadpool (did not work) Revision 1.19 2001/04/08 14:42:37 wombat Foyer chat entfernt. Revision 1.18 2001/04/08 14:30:44 wombat Anfang Implementierung der selbst-alertierung Revision 1.17 2001/03/29 21:01:04 wombat - Improved logging. - Removed bugs from StressClient 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/22 16:40:46 wombat - Updated ant to 1.3 - Removed bugs in GameImpl and StressClient Revision 1.14 2001/03/21 13:26:36 wombat - Removed bugs in Table - began implementation of stree client - updated documentation Revision 1.13 2001/03/19 21:50:49 wombat - Worked on admin client. - improved shutdown sequence - removed bugs in login/logout sequence Revision 1.12 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.11 2001/03/06 18:07:19 login documented Revision 1.10 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.9 2001/03/02 09:43:14 wombat Worked on gameimpl Revision 1.8 2001/02/27 14:43:14 wombat Updated documentation. Revision 1.7 2001/02/26 15:21:37 wombat worked on GamImpl and Board Revision 1.6 2001/02/21 11:38:47 wombat Worked on GameImpl and Board Revision 1.5 2001/02/19 15:51:47 wombat - Latex Task geschrieben - Entwurfsdokumente in Webseite eingebunden - Game Entwurfsdokument und Source aktualisiert. Revision 1.4 2001/02/11 23:36:26 wombat Started implementation of Game. Revision 1.3 2001/02/09 19:26:32 login Doc-Update Revision 1.2 2001/02/06 15:37:44 login Updated docs
Field Summary | |
static int |
BIDDING
Value (returned by getStatus()) indicating that this game is in the state of bidding. |
static int |
CLAIMING
Value (returned by getStatus()) indicating that this game is in the state of claiming. |
static int |
FINISHED
Value (returned by getStatus()) indicating that this game has ended. |
static int |
PLAYING
Value (returned by getStatus())indicating that this game is in the state of playing. |
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 alert)
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 hands 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 that the declarer made so far. |
int |
getDirection()
Returns the direction of the calling player. |
java.util.List |
getDummyCards()
Returns the cards of the dummy that are not played yet. |
Trick |
getLatestTrick()
Returns the trick that is currently played or just finished. |
int |
getOpener()
Returns the opener of the bidding sequence. |
java.lang.String[] |
getPlayerNames()
Returns the names of the plaer currently taking part in this Game. |
Result |
getResult()
Returns the result of this game. |
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. |
Field Detail |
public static final int BIDDING
public static final int PLAYING
public static final int CLAIMING
public static final int FINISHED
Method Detail |
public int getStatus() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the remote call fails.public ChatChannel getChatChannel() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the remote call fails.public void addGameListener(GameListener listener) throws java.rmi.RemoteException, InvalidSessionException
listener
- the game listener.InvalidSessionException
- when not called from within a valid session context.java.rmi.RemoteException
- if the remote call fails.public void removeGameListener(GameListener listener) throws java.rmi.RemoteException, InvalidSessionException
listener
- the game listener.java.rmi.RemoteException
- if the remote call fails.InvalidSessionException
- when not called from within a valid session context.public java.lang.String[] getPlayerNames() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the remote call fails.public int getActivePlayer() throws java.rmi.RemoteException, InvalidGameStateException
java.rmi.RemoteException
- if the remote call fails.InvalidGameStateException
- If the game is already
finished.public void appealToJudge(java.lang.String reason) throws java.rmi.RemoteException
reason
- Reason for calling a judge.java.rmi.RemoteException
- if the remote call fails.public int getDirection() throws java.rmi.RemoteException, KosiAccessException, InvalidSessionException
java.rmi.RemoteException
- if the remote call fails.KosiAccessException
- if the player is not currently seated at this game
and therefor has no direction assigned.InvalidSessionException
- if not called from a valid session context.public int getOpener() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the remote call fails.public boolean isVulnerableNorthSouth() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the remote call fails.public boolean isVulnerableEastWest() throws java.rmi.RemoteException
java.rmi.RemoteException
- if the remote call fails.public java.util.List getCards(int direction) throws InvalidGameStateException, java.rmi.RemoteException
direction
- Direction the cards should be returned for.InvalidGameStateException
- If the game is not finished
yet.java.rmi.RemoteException
- If the remote call fails.public java.util.List getCards() throws java.rmi.RemoteException, KosiAccessException, InvalidSessionException
java.rmi.RemoteException
- If the remote call fails.KosiAccessException
- If the caller isn't playing this game.InvalidSessionException
- If called from an invalid
session context.public java.util.List getDummyCards() throws java.rmi.RemoteException, KosiAccessException, InvalidGameStateException
java.rmi.RemoteException
- If the remote call fails.InvalidGameStateException
- If the game's state is bidding.KosiAccessException
- If access to the dummy cards is denied.public Alert getAlert(int round, int player) throws KosiAccessException, InvalidGameStateException, InvalidSessionException, java.rmi.RemoteException
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.java.rmi.RemoteException
- If the remote call fails.public java.util.List getBids() throws InvalidGameStateException, java.rmi.RemoteException
round
- Round the bid is returned for.player
- Player the bid is returned for.InvalidGameStateException
- if not in state of bidding.java.rmi.RemoteException
- If the remote call fails.public void bid(Bid bid, boolean alert) throws java.rmi.RemoteException, KosiAccessException, InvalidGameStateException, InvalidBidException, InvalidSessionException
bid
- Bid to bid.alert
- True, if this bid should be alerted.java.rmi.RemoteException
- if the remote call fails.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 java.rmi.RemoteException, InvalidGameStateException
java.rmi.RemoteException
- if the remote call fails.InvalidGameStateException
- If the game's state is other than
BIDDING.public Trick getLatestTrick() throws java.rmi.RemoteException, InvalidGameStateException, FirstTrickException
java.rmi.RemoteException
- If the remote call fails.InvalidGameStateException
- If the game's state is other
than playing.FirstTrickException
- If there is no card played yet (so
no trick is currently played in the point of view of the server).public void play(Card card) throws java.rmi.RemoteException, KosiAccessException, InvalidCardException, InvalidSessionException, InvalidGameStateException
card
- Card to play.java.rmi.RemoteException
- if the remote call fails.KosiAccessException
- if the calling user is not allowed to play
this card.InvalidCardException
- If the user doesn't have the card he plays
or isn't following suit.InvalidSessionException
- if not called from a valid session context.InvalidGameStateException
- If the game's state is not PLAYING.public void claim(int tricks) throws java.rmi.RemoteException, InvalidGameStateException, KosiAccessException, InvalidSessionException
tricks
- number of tricks to claim.java.rmi.RemoteException
- if the remote call fails.InvalidGameStateException
- If the game's state is not PLAYING.KosiAccessException
- If the caller is not a player of this game.public void answerClaim(boolean accept) throws java.rmi.RemoteException, InvalidGameStateException, KosiAccessException, InvalidSessionException
accept
- wether or not the claim is accepted.java.rmi.RemoteException
- if the remote call fails.InvalidGameStateException
- If the game's state is not PLAYING.KosiAccessException
- If the caller is not a player of this game.public Result getResult() throws InvalidGameStateException, java.rmi.RemoteException
InvalidGameStateException
- If the game hasn't been
finished yet.java.rmi.RemoteException
- If RMI runs into trouble.public int getDeclarerTricks() throws InvalidGameStateException, java.rmi.RemoteException
InvalidGameStateException
- If the game's state is BIDDING.java.rmi.RemoteException
- If RMI runs into trouble.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |