|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.kosi.model.game.Player
This class represents a player who is either playing a game of
Bridge or waiting at a table for three other players to have a game
of Bridge together.
In Bridge there are always four players playing a game. Their
seatings are called north, east, south, west -- this class provides
the constants to refer to these directions.
ChangeLog:
$Log: Player.java,v $ Revision 1.3 2001/06/27 11:53:21 betacarotine Worked on the Rubber and added comments. Revision 1.2 2001/05/30 10:25:51 jiriki Refactored Client. Revision 1.1.1.1 2001/04/29 18:05:18 jiriki Imported sources from zola. 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/01 20:31:32 wombat Worked on table implementation / updated documentation Revision 1.6 2001/02/26 11:21:45 wombat Worked on table. Revision 1.5 2001/02/07 10:28:52 login Updated documentation!!!! Revision 1.4 2001/02/06 14:37:09 login Updated docs Revision 1.3 2001/02/06 11:38:48 login Updated docs
Field Summary | |
static java.lang.String[] |
DIRECTION_STRINGS
This constant provides english string representations of the directions. |
static int |
EAST
This constant refers the player seated at east direction. |
static int |
NORTH
This constant refers the player seated at north direction. |
static int |
NUM_DIRECTIONS
This constant describes how many directions there are. |
static int |
SOUTH
This constant refers the player seated at south direction. |
static int |
UNKNOWN
This constant indicates, that a player has no seat, or the seat is not known. |
static int |
WEST
This constant refers the player seated at west direction. |
Constructor Summary | |
Player(UserImpl user,
int direction)
This constructor creates a new Player instance. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Players are equals, if they are players for the same user. |
int |
getDirection()
This method returns the seating direction of this player. |
java.lang.String |
getName()
This method returns the player's user name. |
UserImpl |
getUser()
This method returns the user assigned to this player. |
static int |
next(int direction)
Returns the direction next to the given direction. |
static int |
oppositeOf(int direction)
Returns the direction opposite of the given direction. |
static int |
prev(int direction)
Returns the direction previous to the given direction. |
void |
setUser(UserImpl user)
This method assigns another user with this player. |
java.lang.String |
toString()
Returns a string representation of this instance in the form " |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int UNKNOWN
public static final int NORTH
public static final int EAST
public static final int SOUTH
public static final int WEST
public static final java.lang.String[] DIRECTION_STRINGS
public static final int NUM_DIRECTIONS
Constructor Detail |
public Player(UserImpl user, int direction)
user
- The user who wants to play Bridge.direction
- Tells where the player will be seated (this
argument must be one of the provided constants NORTH, EAST,
SOUTH, WEST)java.lang.IllegalArgumentException
- Thrown if the user was null
or the direction wasn't one of the constants NORTH, EAST, SOUTH,
WEST.Method Detail |
public void setUser(UserImpl user)
user
- The new user assigned to this player instance.java.lang.IllegalArgumentException
- Thrown if the user argument
was null.public int getDirection()
public static int oppositeOf(int direction)
direction
- The direction to return the opposite of.public static int next(int direction)
direction
- The direction to return the next of.public static int prev(int direction)
direction
- The direction to return the previous of.public UserImpl getUser()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object to compare to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |