Last Site Update: 18 January 2010

GWAP API

Class

   java.lang.Object
     extended byjava.lang.Thread
     	extended byHumanComputation.GWAP.Player
   public abstract class Player
   extends java.lang.Thread

This class represents the player in the game.

Constructor

  • Player

    public Player() Creates an empty player.

Method

GamegetGame ( )
Get the game of this player participating in.
abstract
java.lang.String
getInformation (java.lang.String str)
Get the information about this player according to the input string str.
protected
Log
getLog ( )
Get the log system.
booleanisBot ( )
Return whether this player is a bot.
abstract
void
run ( )
Receive messages from client.
abstract
void
sendMessage (java.lang.String msg)
Send messages to client.
voidsetGame (Game g)
Set a game in which is being participated by this player.
abstract
void
setInformation (java.lang.String name, java.lang.String value)
Set information according to the input string.
voidsetIsBot (boolean isbot)
Set this player is a bot or not.
protected
void
setLog ( )
Set the log system.

 

Method Detail

  • getGame

    public final Game getGame()

    Cet the game of this player participating in. (This method cannot be overridden.)

     

  • getInformation

    public abstract java.lang.String getInformation(java.lang.String str)

    Gets the information about this player according to input string. (This method must be overridden.)

      Parameter -
      str - key parameter
      Return -
      the information about this player according to parameter str

     

  • getLog

    protected final LoggetLog()

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

      Return -
      the log system of this GWAP server

     

  • isBot

    public final booleanisBot()

    Returns whether this player is a bot. (This method cannot be overridden.)

      Return -
      false if this player isn't a bot (default), true otherwise

     

  • run

    public abstract void run()

    Receives messages from client. (This method must be overridden.)

      Specified by -
      run in interface java.lang.Runnable
      Override -
      run in class java.lang.Thread

     

  • sendMessage

    public abstract void sendMessage(java.lang.String msg)

    Send messages to client. (This method must be overridden.)

      Parameter -
      msg - the message which is needed to be sent to client

     

  • setGame

    public final void setGame(Game g)

    Set a game in which is being participated by this player. (This method cannot be overridden.)

      Parameter -
      g - the game in which is being participated by this player

     

  • setInformation

    public abstract void setInformation(java.lang.String name, java.lang.String value)

    Set information according to input string. (This method must be overridden.)

      Parameter -
      name - name
      value - value

     

  • setIsBot

    public final void setIsBot(boolean isbot)

    Set this player is a bot or not. (This method cannot be overridden.)

      Parameter -
      isbot - the game in which is being participated by this player

     

  • setLog

    protected final void setLog(Log l)

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

      Parameter -
      l - the log system