Package Jade.Agents

Class ArbiterAgent

java.lang.Object
jade.core.Agent
Jade.Agents.ArbiterAgent
All Implemented Interfaces:
jade.core.TimerListener, jade.util.leap.Serializable, Serializable, Runnable

public class ArbiterAgent extends jade.core.Agent
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class jade.core.Agent

    jade.core.Agent.Interrupted
  • Field Summary

    Fields inherited from class jade.core.Agent

    AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN, MSG_QUEUE_CLASS
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jade.core.AID
    Returns the AID of the first player of the couple.
    Returns the symbol of the first player.
    jade.core.AID
    Returns the AID of the assigned Master Arbiter.
    int
    Returns the round number.
    jade.core.AID
    Returns the AID of the second player of the couple.
    Returns the symbol of the second player.
    int
    Returns the total number of rounds of the game.
    int
    Returns the turn number.
    jade.core.AID
    Returns the AID of the winner
    void
    Advances the turn.
    void
    setFirstPlayer(jade.core.AID firstPlayer)
    Sets the AID of the first player of the couple.
    void
    setFirstSymbol(String firstSymbol)
    Sets the symbol of the first player.
    void
    setMasterArbiter(jade.core.AID masterArbiter)
    Sets the AID of the assigned Master Arbiter.
    void
    setNumRound(int numRound)
    Sets the number of rounds of the game.
    void
    setSecondPlayer(jade.core.AID secondPlayer)
    Sets the AID of the second player of the couple.
    void
    setSecondSymbol(String secondSymbol)
    Sets the symbol of the second player.
    void
    setTotalRounds(int totalRounds)
    Sets the total number of rounds of the game.
    protected void
    This method is called when the arbiter is created.
    void
    setWinner(jade.core.AID winner)
    Sets the AID of the winner
    protected void
    This method is called when the arbiter is terminated.

    Methods inherited from class jade.core.Agent

    addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getProperty, getQueueSize, getState, here, isAlive, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, registerO2AInterface, removeBehaviour, removeTimer, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setO2AManager, setQueueSize, waitUntilStarted, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArbiterAgent

      public ArbiterAgent()
  • Method Details

    • setup

      protected void setup()
      This method is called when the arbiter is created. The arbiter then schedules three behaviours: - RegisterBehaviour: to register itself in the DF - WaitProposalArbiterBehaviour: to receive the couple of players from the master to arbitrate - EndGameBehaviour: to end the game
      Overrides:
      setup in class jade.core.Agent
    • takeDown

      protected void takeDown()
      This method is called when the arbiter is terminated. The arbiter then unregisters itself from the DF
      Overrides:
      takeDown in class jade.core.Agent
    • getFirstPlayer

      public jade.core.AID getFirstPlayer()
      Returns the AID of the first player of the couple.
      Returns:
      AID
    • setFirstPlayer

      public void setFirstPlayer(jade.core.AID firstPlayer)
      Sets the AID of the first player of the couple.
      Parameters:
      firstPlayer -
    • getSecondPlayer

      public jade.core.AID getSecondPlayer()
      Returns the AID of the second player of the couple.
      Returns:
      AID
    • setSecondPlayer

      public void setSecondPlayer(jade.core.AID secondPlayer)
      Sets the AID of the second player of the couple.
      Parameters:
      secondPlayer -
    • setNumRound

      public void setNumRound(int numRound)
      Sets the number of rounds of the game.
      Parameters:
      numRound -
    • nextTurn

      public void nextTurn()
      Advances the turn.
    • getTurno

      public int getTurno()
      Returns the turn number. A turn is the n-th move of the game.
      Returns:
      int
    • getRound

      public int getRound()
      Returns the round number. A round is a match between two players.
      Returns:
      int
    • getWinner

      public jade.core.AID getWinner()
      Returns the AID of the winner
      Returns:
      AID
    • setWinner

      public void setWinner(jade.core.AID winner)
      Sets the AID of the winner
      Parameters:
      winner -
    • getMasterArbiter

      public jade.core.AID getMasterArbiter()
      Returns the AID of the assigned Master Arbiter.
      Returns:
      AID
    • setMasterArbiter

      public void setMasterArbiter(jade.core.AID masterArbiter)
      Sets the AID of the assigned Master Arbiter.
      Parameters:
      masterArbiter -
    • getFirstSymbol

      public String getFirstSymbol()
      Returns the symbol of the first player.
      Returns:
      String
    • setFirstSymbol

      public void setFirstSymbol(String firstSymbol)
      Sets the symbol of the first player.
      Parameters:
      firstSymbol -
    • getSecondSymbol

      public String getSecondSymbol()
      Returns the symbol of the second player.
      Returns:
      String
    • setSecondSymbol

      public void setSecondSymbol(String secondSymbol)
      Sets the symbol of the second player.
      Parameters:
      secondSymbol -
    • getTotalRounds

      public int getTotalRounds()
      Returns the total number of rounds of the game.
      Returns:
      int
    • setTotalRounds

      public void setTotalRounds(int totalRounds)
      Sets the total number of rounds of the game.
      Parameters:
      totalRounds -