|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectcz.cuni.amis.pogamut.sposh.JavaBehaviour<AGENT>
public class JavaBehaviour<AGENT>
Base class for definitions of senses and acts of SPOSH bot.
User will implement actions and senses used in the plan by deriving this class and by creating senses and actions for SPOSH plan in following fashion:actions are methods annotated with @SPOSHAction annotation. Name of method is arbitrary and return type should one of the standard ones (String + numbers). SPOSH engine will use toString() method for the return values of user defined classes (probably), but because there are some issues with jython-java interaction, it may produce some weird bugs.
doNothing() or sense fail().
The actions can utilize log, that is available through log member of class
(it is a AgentLogger of the SPOSH bot.
This basic class (as well all derived ones) implements following actions
| Field Summary | |
|---|---|
protected AGENT |
bot
|
| Constructor Summary | |
|---|---|
JavaBehaviour(String name,
AGENT bot)
Create new behaviour. |
|
| Method Summary | |
|---|---|
ActionResult |
doNothing()
Standard action that has to be implemented everywhere. |
boolean |
fail()
Standard sense that has to be implemented everywhere. |
String[] |
getActions()
Returns list of actions that are declared in the behaviour class. |
AGENT |
getBot()
Returns underlying AGENT instance. |
String |
getName()
Get name of the behaviour specified in the constructor. |
String[] |
getSenses()
Returns list of senses that are declared in the behaviour class. |
void |
logicAfterPlan()
Method that is triggered every time the plan for executor is evaluated. |
void |
logicBeforePlan()
Method that is triggered every time the plan for executor is evaluated. |
boolean |
succeed()
Standard sense that has to be implemented everywhere. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AGENT bot
| Constructor Detail |
|---|
public JavaBehaviour(String name,
AGENT bot)
name - Name of behaviour so it is easy to distinguish between
different behaviours classes in the log and error messagesbot - Class of the bot that this behaviour is serving.
Used by sense and actions for gathering info and manipulation of the bot.| Method Detail |
|---|
public String getName()
public String[] getActions()
Use Java Reflection API to search through the methods for methods with annotations @SPOSHActions and return list of strings that contains the methods.
public String[] getSenses()
Use Java Reflection API to search through the methods for methods with annotations @SPOSHSense and return list of strings that contains the methods.
public ActionResult doNothing()
public boolean fail()
public boolean succeed()
public void logicBeforePlan()
public void logicAfterPlan()
public AGENT getBot()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||