ks.domain
Class Table

java.lang.Object
  extended byks.domain.Table
All Implemented Interfaces:
java.io.Serializable

public class Table
extends java.lang.Object
implements java.io.Serializable

Represents a Solitaire Table

See Also:
Serialized Form

Field Summary
static java.lang.String invitationType
           
static int maxGameLength
           
static int maxIncrement
           
static int maxNumPlayers
           
static int minGameLength
          Min values for game Length (in seconds).
static int minIncrement
          Min/Max values for GameIncrement.
static int minNumPlayers
          Min/Max values for numPlayers
static java.lang.String openType
           
static java.lang.String requestType
           
 
Constructor Summary
Table()
          Table constructor comment.
 
Method Summary
static Table fromString(java.lang.String s)
          Recover a Table object from the given string [the inverse of toString]
 java.lang.String getAccessType()
          Get Access permissions for this table.
 int getCount()
          Return the player index to next be added (0 through numPlayers-1).
 int getGameIncrement()
          Return the game increment for this table.
 int getGameLength()
          Return the gameLength for this table.
 java.lang.String getModerator()
          Get moderator for the table.
 java.lang.String getName()
          Return the name of this table.
 int getNumPlayers()
          Return the number of players on this table.
 int getSeed()
          Return the seed to be used for this table.
 java.lang.String getType()
          Return the solitaire type of this table.
 boolean hasUser(java.lang.String name)
          Determines if user is already a member of this table
 boolean isActive()
          Determine whether Table is active.
 boolean isReady()
          Determines whether a table is ready for play
 boolean join(java.lang.String name)
          User userName wishes to join this table.
 boolean leave(java.lang.String name)
          User userName wishes to leave this table.
 java.util.Enumeration players()
          Return an Enumeration (of String) of player names for this table.
 void setAccessType(java.lang.String newAccess)
          Set the Table's Access rights.
 void setActive(boolean newActive)
          Set the active status for this table.
 void setGameIncrement(int newIncrement)
          Sets the increment for the next seed on a table (a number from minIncrment..maxIncrement).
 void setGameLength(int newGameLength)
          Set the time for a game (in seconds).
 void setModerator(java.lang.String newModerator)
          Set moderator for the table.
 void setName(java.lang.String newName)
          Set the name of the table (alphanumeric, no spaces).
 void setNumPlayers(int newNumPlayers)
          Sets the number of players in this table.
 void setSeed(int newSeed)
          Set the seed for the table.
 void setType(java.lang.String newType)
          Set the type of solitaire game for this table.
 java.lang.String toString()
          Convert into ':'-separated string, suitable for being transported over the wire.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minNumPlayers

public static final int minNumPlayers
Min/Max values for numPlayers

See Also:
Constant Field Values

maxNumPlayers

public static final int maxNumPlayers
See Also:
Constant Field Values

minIncrement

public static final int minIncrement
Min/Max values for GameIncrement.

See Also:
Constant Field Values

maxIncrement

public static final int maxIncrement
See Also:
Constant Field Values

minGameLength

public static final int minGameLength
Min values for game Length (in seconds).

See Also:
Constant Field Values

maxGameLength

public static final int maxGameLength
See Also:
Constant Field Values

invitationType

public static final java.lang.String invitationType
See Also:
Constant Field Values

openType

public static final java.lang.String openType
See Also:
Constant Field Values

requestType

public static final java.lang.String requestType
See Also:
Constant Field Values
Constructor Detail

Table

public Table()
Table constructor comment.

Method Detail

fromString

public static Table fromString(java.lang.String s)
Recover a Table object from the given string [the inverse of toString]

Parameters:
s - String
Returns:
ks.common.Table

getCount

public int getCount()
Return the player index to next be added (0 through numPlayers-1).

Returns:
int

getGameIncrement

public int getGameIncrement()
Return the game increment for this table.

Returns:
int

getGameLength

public int getGameLength()
Return the gameLength for this table.

Returns:
int

getModerator

public java.lang.String getModerator()
Get moderator for the table.

Returns:
String
Since:
V1.7.3

getName

public java.lang.String getName()
Return the name of this table.

Returns:
String

getNumPlayers

public int getNumPlayers()
Return the number of players on this table.

Returns:
int

getSeed

public int getSeed()
Return the seed to be used for this table.

Returns:
int

getType

public java.lang.String getType()
Return the solitaire type of this table.

Returns:
String

hasUser

public boolean hasUser(java.lang.String name)
Determines if user is already a member of this table

Parameters:
name - String
Returns:
boolean

isActive

public boolean isActive()
Determine whether Table is active.

Returns:
boolean

isReady

public boolean isReady()
Determines whether a table is ready for play

Returns:
boolean

join

public boolean join(java.lang.String name)
User userName wishes to join this table. Note: all logic about invitees and/or moderator enabled access are part of the game Manager.

Parameters:
name - String
Returns:
boolean false if (1) table already full

leave

public boolean leave(java.lang.String name)
User userName wishes to leave this table. Note: all logic about invitees and/or moderator enabled access are part of the game Manager.

Parameters:
name - String
Returns:
boolean false if (1) table already full

players

public java.util.Enumeration players()
Return an Enumeration (of String) of player names for this table. Must only show up to count!

Returns:
java.util.Enumeration

setActive

public void setActive(boolean newActive)
Set the active status for this table.

Parameters:
newActive - boolean

setGameIncrement

public void setGameIncrement(int newIncrement)
Sets the increment for the next seed on a table (a number from minIncrment..maxIncrement).

Parameters:
newIncrement - int
Throws:
java.lang.IllegalArgumentException - if newIncrement is an invalid value.

setGameLength

public void setGameLength(int newGameLength)
Set the time for a game (in seconds). (minGameLength..maxGameLength)

Parameters:
newGameLength - int
Throws:
java.lang.IllegalArgumentException - if newGameLength is an invalid value.

setModerator

public void setModerator(java.lang.String newModerator)
Set moderator for the table.

ERROR: SHOULD VERIFY THAT MODERATOR IS IN TABLE!

Parameters:
newModerator - String
Since:
V1.7.3

setName

public void setName(java.lang.String newName)
Set the name of the table (alphanumeric, no spaces).

Parameters:
newName - String

setNumPlayers

public void setNumPlayers(int newNumPlayers)
Sets the number of players in this table. (minNumPlayers..maxNumPlayers)

Parameters:
newNumPlayers - int
Throws:
java.lang.IllegalArgumentException - if newNumPlayers is an invalid number.

setSeed

public void setSeed(int newSeed)
Set the seed for the table.

Parameters:
newSeed - int
Throws:
java.lang.IllegalArgumentException - if newSeed is an invalid amount.

setType

public void setType(java.lang.String newType)
Set the type of solitaire game for this table. There is no way to verify this is a valid solitaire game type, so be careful.

Parameters:
newType - String

toString

public java.lang.String toString()
Convert into ':'-separated string, suitable for being transported over the wire. Format: tableName:tableType:seed:increment:gameLength:numPlayers:player1Name:player2Name:...:playernName

Returns:
String

getAccessType

public java.lang.String getAccessType()
Get Access permissions for this table.

Returns:
String

setAccessType

public void setAccessType(java.lang.String newAccess)
Set the Table's Access rights.

Parameters:
newAccess - String