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

java.lang.Objectcz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor
public class StateWorkExecutor
This class is an IWorkExecutor, that considers actions to be have state,
in this executor, primitive is working in phases INIT, RUN*, DONE.
..., walk.INIT, walk.RUN*, walk.DONE, shoot.INIT, shoot.RUN*, shoot.DONE....,
primitive walk would have DONE called before shoot.INIT would be called,
allowing it to stop walking. Same thing is valid for state shoot too.
Since we have phase DONE to cleanup some stuff before we switch to another,
where another can be nearly anything, what state bot should be in when DONE
phase is DONE. In neutral bot state (precise neutral state is defined by programmer,
in unreal, that would probably be standing, not shooting.).
What if we don't want to switch to neutral bot state after primitive is DONE?
Don't, there is no explicit need, and in many situation it is meaningless (such as
primtive "enter_ducts" where bot would entering INIT in standing state, but left
DONE crouching).
IAction| Field Summary | |
|---|---|
protected HashMap<String,IAction> |
actions
Map that maps primtive name to IAction. |
protected String |
currentActionName
Primitive that is currently being executed. |
protected String |
currentVariableContext
String representation of current variable context. |
protected Logger |
log
Log where we put |
protected HashMap<String,ISense> |
senses
Map that maps primitive name to its respective ISense. |
| Constructor Summary | |
|---|---|
StateWorkExecutor()
|
|
StateWorkExecutor(Logger log)
|
|
| Method Summary | |
|---|---|
void |
addAction(IAction action)
Add primitive, use name from annotations. |
void |
addAction(String name,
IAction action)
Add new IAction with primitive name. |
void |
addSense(ISense sense)
Add primitive, use name from annotations. |
void |
addSense(String name,
ISense sense)
Add new ISense with primtive name. |
ActionResult |
executeAction(String actionToExecuteName,
VariableContext ctx)
Execute action and get the result. |
Object |
executeSense(String primitive,
VariableContext ctx)
Execute sense and get the result. |
Logger |
getLogger()
Get logger of this IWorkExecutor. |
protected boolean |
isAction(String name)
Is there an action with the name. |
boolean |
isNameUsed(String name)
Is name used in some primtive in this the work executor. |
protected boolean |
isSense(String name)
Is there a sense with the name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final HashMap<String,IAction> actions
IAction.
protected final HashMap<String,ISense> senses
ISense.
protected String currentActionName
protected String currentVariableContext
protected Logger log
| Constructor Detail |
|---|
public StateWorkExecutor()
public StateWorkExecutor(Logger log)
| Method Detail |
|---|
public Logger getLogger()
IWorkExecutor.
public boolean isNameUsed(String name)
name - queried name
StateWorkExecutor.protected boolean isAction(String name)
name - queries nameprotected boolean isSense(String name)
name - queries name
public void addAction(String name,
IAction action)
IAction with primitive name.
name - name that will be used for this IAction in posh plan.action - primitive that will be executed when executor will be asked to execute primtive with name.
IllegalArgumentException - if primitive with name already exists in StateWorkExecutor.
public void addSense(String name,
ISense sense)
ISense with primtive name.
name - name of primtive to be associated with passed sense objectsense - sense object to be used, when sense with name is supposed to execute.public void addAction(IAction action)
action - primitive that will be addedpublic void addSense(ISense sense)
sense - primitive that will be added
public Object executeSense(String primitive,
VariableContext ctx)
IWorkExecutor
executeSense in interface IWorkExecutorprimitive - name of primitivectx - variable context for sense containing possible parameters
public ActionResult executeAction(String actionToExecuteName,
VariableContext ctx)
IWorkExecutor
executeAction in interface IWorkExecutoractionToExecuteName - name of primitivectx - variable context for action containing possible parameters
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||