Class TableAgent

java.lang.Object
jadex.micro.philosophers.agents.TableAgent
All Implemented Interfaces:
ITableService

public class TableAgent extends Object implements ITableService
  • Field Details

    • agent

      protected jadex.core.IComponent agent
    • sticks

      protected Queue<jadex.future.Future<Void>>[] sticks
      The chop sticks
    • owners

      protected jadex.core.IExternalAccess[] owners
      The current owners of the sticks (who has stick 1, 2, ...).
    • philosophers

      protected jadex.core.IExternalAccess[] philosophers
      The philosopher that sit at the table.
    • waitforclicks

      protected boolean waitforclicks
      Wait for times or click events.
  • Constructor Details

    • TableAgent

      public TableAgent(int seats, boolean waitforclicks)
  • Method Details

    • getAgent

      public jadex.core.IComponent getAgent()
    • addPhilosopher

      public void addPhilosopher(int no)
      Specified by:
      addPhilosopher in interface ITableService
    • getPhilosopher

      public jadex.future.IFuture<jadex.core.IExternalAccess> getPhilosopher(int no)
      Specified by:
      getPhilosopher in interface ITableService
    • getLeftStick

      public jadex.future.IFuture<Void> getLeftStick(int no)
      Specified by:
      getLeftStick in interface ITableService
    • getRightStick

      public jadex.future.IFuture<Void> getRightStick(int no)
      Specified by:
      getRightStick in interface ITableService
    • getStick

      public jadex.future.IFuture<Void> getStick(int no)
      Implement me
    • releaseLeftStick

      public void releaseLeftStick(int no)
      Specified by:
      releaseLeftStick in interface ITableService
    • releaseRightStick

      public void releaseRightStick(int no)
      Specified by:
      releaseRightStick in interface ITableService
    • releaseStick

      public void releaseStick(int no)
      Implement me
    • getCurrentPhilosopher

      public jadex.core.IExternalAccess getCurrentPhilosopher()
    • getStickOwner

      public jadex.future.IFuture<jadex.core.IExternalAccess> getStickOwner(int no)
      Specified by:
      getStickOwner in interface ITableService
    • isWaitForClicks

      public jadex.future.IFuture<Boolean> isWaitForClicks()
      Specified by:
      isWaitForClicks in interface ITableService
    • invertWaitForClicks

      public void invertWaitForClicks()
      Specified by:
      invertWaitForClicks in interface ITableService
    • notifyAllPhilosophers

      public void notifyAllPhilosophers()
      Specified by:
      notifyAllPhilosophers in interface ITableService
    • toString

      public String toString()
      Overrides:
      toString in class Object