Package jadex.micro.philosophers.agents
Class TableAgent
java.lang.Object
jadex.micro.philosophers.agents.TableAgent
- All Implemented Interfaces:
ITableService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected jadex.core.IComponent
protected jadex.core.IExternalAccess[]
The current owners of the sticks (who has stick 1, 2, ...).protected jadex.core.IExternalAccess[]
The philosopher that sit at the table.The chop sticksprotected boolean
Wait for times or click events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPhilosopher
(int no) jadex.core.IComponent
getAgent()
jadex.core.IExternalAccess
jadex.future.IFuture
<Void> getLeftStick
(int no) jadex.future.IFuture
<jadex.core.IExternalAccess> getPhilosopher
(int no) jadex.future.IFuture
<Void> getRightStick
(int no) jadex.future.IFuture
<Void> getStick
(int no) Implement mejadex.future.IFuture
<jadex.core.IExternalAccess> getStickOwner
(int no) void
jadex.future.IFuture
<Boolean> void
void
releaseLeftStick
(int no) void
releaseRightStick
(int no) void
releaseStick
(int no) Implement metoString()
-
Field Details
-
agent
protected jadex.core.IComponent agent -
sticks
The chop sticks -
owners
protected jadex.core.IExternalAccess[] ownersThe current owners of the sticks (who has stick 1, 2, ...). -
philosophers
protected jadex.core.IExternalAccess[] philosophersThe philosopher that sit at the table. -
waitforclicks
protected boolean waitforclicksWait 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 interfaceITableService
-
getPhilosopher
public jadex.future.IFuture<jadex.core.IExternalAccess> getPhilosopher(int no) - Specified by:
getPhilosopher
in interfaceITableService
-
getLeftStick
- Specified by:
getLeftStick
in interfaceITableService
-
getRightStick
- Specified by:
getRightStick
in interfaceITableService
-
getStick
Implement me -
releaseLeftStick
public void releaseLeftStick(int no) - Specified by:
releaseLeftStick
in interfaceITableService
-
releaseRightStick
public void releaseRightStick(int no) - Specified by:
releaseRightStick
in interfaceITableService
-
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 interfaceITableService
-
isWaitForClicks
- Specified by:
isWaitForClicks
in interfaceITableService
-
invertWaitForClicks
public void invertWaitForClicks()- Specified by:
invertWaitForClicks
in interfaceITableService
-
notifyAllPhilosophers
public void notifyAllPhilosophers()- Specified by:
notifyAllPhilosophers
in interfaceITableService
-
toString
-