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

java.lang.Objectcz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController<BOT>
cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController<BOT>
cz.cuni.amis.pogamut.sposh.ut2004.SposhLogicController<BOT,StateWorkExecutor>
cz.cuni.amis.pogamut.sposh.ut2004.StateSposhLogicController<BOT,CONTEXT>
public abstract class StateSposhLogicController<BOT extends UT2004Bot,CONTEXT extends IUT2004Context>
This class should be used as base for bot that utilizes sposh and state primitives.
It is failry simple, it creates PoshEngine, IWorkExecutor and Context during initializeController(cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot).
The IWorkExecutor takes all primitives from the plan and automatically
tries to instantiate them.
The automatic instantiation expects that names of the primitives are fully
qualified names of classes (e.g. cz.cuni.pogamut.senses.Fail) that implement
ISense for senses and IAction for actions. The classes are
expected to have public constructor with one parameter that is of type CONTEXT
(or its parent). It may be convinient to use classes StateAction and
StateSense as basic classes for your own custom primitives.
Custom instantiation can be utilized in method customPrimitiveInstantiation(cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor, java.util.Set, java.util.Set),
simply insert your own primitives into the StateWorkExecutor. When automatic
instantiation detects, that primitive with some name (probaly name that is not
FQN of class) is already defined in the executor, the name is skipped (IOW: if
you add sense hurt in the custom instantion, it won't cause error later one,
although it is not defined by any class).
| Field Summary | |
|---|---|
protected CONTEXT |
context
Context for states. |
| Fields inherited from class cz.cuni.amis.pogamut.sposh.ut2004.SposhLogicController |
|---|
SPOSH_LOG_CATEGORY |
| Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController |
|---|
logicModule |
| Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController |
|---|
bot, log, USER_LOG_CATEGORY_ID |
| Constructor Summary | |
|---|---|
StateSposhLogicController()
|
|
| Method Summary | |
|---|---|
protected abstract CONTEXT |
createContext()
Create context for this logic controller. |
protected StateWorkExecutor |
createWorkExecutor()
Create IWorkExecutor that will execute primitives contained in the plan. |
protected void |
customPrimitiveInstantiation(StateWorkExecutor executor,
Set<String> actions,
Set<String> senses)
To be overriden in children, this method enables user to instantiate primitives in any way it desires. |
void |
finishControllerInitialization()
|
CONTEXT |
getContext()
Get context. |
protected abstract String |
getPlan()
Get Yaposh plan this bot is supposed to execute. |
protected List<String> |
getPlans()
Take the plan from getPlan() and return it as the single plan
of the bot. |
void |
initializeController(BOT bot)
Initialize logic controller=call super initialization and create context and other stuff that is needed to have. |
| Methods inherited from class cz.cuni.amis.pogamut.sposh.ut2004.SposhLogicController |
|---|
createTimer, getEngines, getPlanFromFile, getPlanFromResource, getPlanFromStream, getPlansFromDirectory, getTimer, getWorkExecutor, logic, logicAfterPlan, logicBeforePlan |
| Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController |
|---|
beforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, initializeLogic, logicInitialize, logicShutdown |
| Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController |
|---|
botFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getName, getPassword, getWorldView, prepareBot |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController |
|---|
botFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getPassword, getWorldView, prepareBot |
| Field Detail |
|---|
protected CONTEXT extends IUT2004Context context
| Constructor Detail |
|---|
public StateSposhLogicController()
| Method Detail |
|---|
public void initializeController(BOT bot)
initializeController in interface IUT2004BotController<BOT extends UT2004Bot>initializeController in class SposhLogicController<BOT extends UT2004Bot,StateWorkExecutor>bot - public void finishControllerInitialization()
finishControllerInitialization in interface IUT2004BotController<BOT extends UT2004Bot>finishControllerInitialization in class UT2004BotController<BOT extends UT2004Bot>public final CONTEXT getContext()
protected void customPrimitiveInstantiation(StateWorkExecutor executor,
Set<String> actions,
Set<String> senses)
executor - executor that will be used for primitives (empty, no primitive should be defined yet)actions - set of actions used in the plan (unmodifiable)senses - set of senses used in the plan (unmodifiable)protected StateWorkExecutor createWorkExecutor()
SposhLogicControllerIWorkExecutor that will execute primitives contained in the plan.
This method will be called only once.
createWorkExecutor in class SposhLogicController<BOT extends UT2004Bot,StateWorkExecutor>
protected List<String> getPlans()
throws IOException
getPlan() and return it as the single plan
of the bot.
getPlans in class SposhLogicController<BOT extends UT2004Bot,StateWorkExecutor>getPlan().
IOExceptionSposhLogicController.getPlans()
protected abstract String getPlan()
throws IOException
SposhLogicController.getPlanFromResource(java.lang.String), SposhLogicController.getPlanFromFile(java.lang.String) or SposhLogicController.getPlanFromStream(java.io.InputStream).
IOExceptionprotected abstract CONTEXT createContext()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||