Last Site Update: 18 January 2010

GWAP API

Class

   java.lang.Object
     extended byHumanComputation.GWAP.Game
   public abstract class Game
   extends java.lang.Object

This class represents the database server.

Constructor

  • Game

    public Game() Creates an empty game.

Method

voidaddPlayer (Player p )
Add a player to this game.
voidaddRound (Round r)
Add a round to this game.
abstract
void
close ( )
Closes this game.
protected
Database
getDatabase ( )
Get the database interface.
protected
Log
getLog ( )
Get the log system.
Player
getPlayer (int index)
Get the specified player of this game.
int
getPlayerIndex (Player p)
Get index of player p
int
getPlayerSize ( )
Get the number of players in this game.
int
getRoundSize ( )
Gets the number of rounds of this game.
protected
Score
getScore ( )
Gets the score system.
abstract
void
processMessage (Player p, java.lang.String msg)
Process messages passed by players in this game.
void
removePlayer (int index)
Remove the specified player of this game.
protected
void
setDatabase (Database db)
Set the log system.
protected
void
setLog (Log l)
Set the log system.
void
setPlayer (java.util.List <Player> playerlist)
Set players in this game.
protected
void
setScore (Score sc)
Set the score system.
abstract
void
start ( )
Start this game.

 

Method Detail

  • addPlayer

    public final void addPlayer(Player p)

    Add a player to this game. (This method cannot be overridden.)

      Parameter -
      p - the player who will join this game

     

  • addRound

    public final void addRound(Round r)

    Add a round to this game. (This method cannot be overridden.)

      Parameter -
      r - the round already played in this game

     

  • getPlayer

    public final Player getPlayer(int index)

    Gets the specified player of this game. (This method cannot be overridden.)

      Parameter -
      index - index of player to Return
      Return -
      The player at the specified position in the game, null if the index is invalid

     

  • getPlayerIndex

    public final int getPlayerIndex(Player p)

    Get the index of player p. (This method cannot be overridden.)

      Parameter -
      p - the player
      Return -
      the index of player p

     

  • getRoundSize

    public final int getRoundSize()

    Get the number of rouonds of this game. (This method cannot be overridden.)

      Return -
      the number of rounds of this game

     

  • getPlayerSize

    public final int getPlayerSize()

    Get the number of players in this game. (This method cannot be overridden.)

      Return -
      the number of players in this game.

     

  • close

    public abstract void close()

    Close this game. (This method must be overridden.)

     

  • processMessage

    public abstract void processMessage(Player p, java.lang.String msg)

    Processes messages passed by player p in this game. (This method must be overridden.)

      Parameter -
      p - the player passing the message
      msg - the message received by player

     

  • removePlayer

    public final void removePlayer(int index)

    Remove the specified player of this game. (This method cannot be overridden.)

      Parameter -
      index - index of player

     

  • setPlayer

    public final void setPlayer(java.util.List<Player> playerlist)

    Set players in this game. (This method cannot be overridden.)

      Parameter -
      playerlist - the player list

     

  • start

    public abstract void start()

    Starts this game. (This method must be overridden.)

     

  • getDatabase

    protected final getDatabase()

    Get the database interface. (This method cannot be overridden.)

      Return -
      the database interface of this GWAP server

     

  • getLog

    protected final getLog()

    Get the log system. (This method cannot be overridden.)

      Return -
      the log system

     

  • getScore

    protected final ScoregetScore()

    Get the score system. (This method cannot be overridden.)

      Return -
      the score system of this GWAP server

     

  • setDatabase

    protected final void setDatabase(Database db)

    Set the database interface. (This method cannot be overridden.)

      Parameter -
      db - the database interface

     

  • getDatabase

    protected final getDatabase()

    Get the database interface. (This method cannot be overridden.)

      Return -
      the database interface of this GWAP server

     

  • setLog

    protected final void setLog(Log l)

    Set the log system. (This method cannot be overridden.)

      Parameter -
      l - the log system

     

  • setScore

    protected final void setScore(Score sc)

    Set the score system. (This method cannot be overridden.)

      Parameter -
      sc - the score system of this GWAP server