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.IComponentprotected 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 booleanWait for times or click events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPhilosopher(int no) jadex.core.IComponentgetAgent()jadex.core.IExternalAccessjadex.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) voidjadex.future.IFuture<Boolean> voidvoidreleaseLeftStick(int no) voidreleaseRightStick(int no) voidreleaseStick(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:
addPhilosopherin interfaceITableService
-
getPhilosopher
public jadex.future.IFuture<jadex.core.IExternalAccess> getPhilosopher(int no) - Specified by:
getPhilosopherin interfaceITableService
-
getLeftStick
- Specified by:
getLeftStickin interfaceITableService
-
getRightStick
- Specified by:
getRightStickin interfaceITableService
-
getStick
Implement me -
releaseLeftStick
public void releaseLeftStick(int no) - Specified by:
releaseLeftStickin interfaceITableService
-
releaseRightStick
public void releaseRightStick(int no) - Specified by:
releaseRightStickin 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:
getStickOwnerin interfaceITableService
-
isWaitForClicks
- Specified by:
isWaitForClicksin interfaceITableService
-
invertWaitForClicks
public void invertWaitForClicks()- Specified by:
invertWaitForClicksin interfaceITableService
-
notifyAllPhilosophers
public void notifyAllPhilosophers()- Specified by:
notifyAllPhilosophersin interfaceITableService
-
toString
-