cz.cuni.amis.pogamut.ut2004.agent.navigation
Class UT2004PathExecutor<PATH_ELEMENT extends ILocated>

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.navigation.impl.AbstractPathExecutor<PATH_ELEMENT>
      extended by cz.cuni.amis.pogamut.base.agent.navigation.impl.BasePathExecutor<PATH_ELEMENT>
          extended by cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004PathExecutor<PATH_ELEMENT>
All Implemented Interfaces:
IPathExecutor<PATH_ELEMENT>, IPathExecutorHelper<PATH_ELEMENT>, IUnrealPathExecutor<PATH_ELEMENT>, IUT2004PathExecutorHelper<PATH_ELEMENT>

public class UT2004PathExecutor<PATH_ELEMENT extends ILocated>
extends BasePathExecutor<PATH_ELEMENT>
implements IUnrealPathExecutor<PATH_ELEMENT>, IUT2004PathExecutorHelper<PATH_ELEMENT>


Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.navigation.impl.BasePathExecutor
mutex, pathFuture, previousPathElementIndex
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.navigation.impl.AbstractPathExecutor
log, state, stuckDetectors
 
Constructor Summary
UT2004PathExecutor(UT2004Bot bot)
           
UT2004PathExecutor(UT2004Bot bot, IUT2004PathNavigator<PATH_ELEMENT> navigator)
           
UT2004PathExecutor(UT2004Bot bot, IUT2004PathNavigator<PATH_ELEMENT> navigator, java.util.logging.Logger log)
           
 
Method Summary
protected  void calculateTimeout()
           
protected  void eventEndMessage()
           
protected  void followPathImpl()
          Method that is called just after the executor's state is switched to PathExecutorState.FOLLOW_PATH_CALLED from within the BasePathExecutor.followPath(IPathFuture) method.
 ILocated getFocus()
          Return current focus of the bot, null means "default" provided by the path executor.
 java.util.List<IStuckDetector> getStuckDetectors()
          Returns list of all stuck detectors registered inside the executor.
protected  void navigate()
           
protected  void pathComputationFailedImpl()
          Method that is called just after the executor's state is switched to PathExecutorState.PATH_COMPUTATION_FAILED from within the BasePathExecutor.pathComputationFailed() method.
protected  void pathComputedImpl()
          If the path is not zero-length, recalls IUT2004PathNavigator.newPath(List) and set the path into the GB2004 via SetRoute.
protected  void preStuckImpl()
          Method that is called just before the executor's state is switched to PathExecutorState#STUCKD from within the BasePathExecutor#stuck(IStuckDetector) method.
protected  void preTargetReachedImpl()
          Method that is called just before the executor's state is switched to PathExecutorState.TARGET_REACHED from within the BasePathExecutor.targetReached() method.
 void setFocus(ILocated located)
          Allows you to set focus during the path-execution, i.e., tell the bot where it should be looking.
 UT2004PathExecutor<PATH_ELEMENT> setTimeoutEstimator(IPathExecutionEstimator<PATH_ELEMENT> timeoutEstimator)
           
protected  void stopped()
          Method that is called just after the executor's state is switched to PathExecutorState.STOPPED from within the BasePathExecutor.stop() method.
protected  void stuckImpl()
          Method that is called just after the executor's state is switched to PathExecutorState.STUCK from within the BasePathExecutor#stuck(IStuckDetector) method.
protected  void switchToAnotherPathElementImpl()
          Sets the path into the GB2004 via SetRoute whenever switch occurs and the rest of the path is greater than 32 path elements.
protected  void targetReachedImpl()
          Method that is called just after the executor's state is switched to PathExecutorState.TARGET_REACHED from within the BasePathExecutor.targetReached() method.
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.navigation.impl.BasePathExecutor
checkStuckDetectors, createState, followPath, getPathElementIndex, getPathFuture, pathComputationFailed, pathComputed, preFollowPathImpl, prePathComputationFailed, prePathComputedImpl, preSwitchToAnotherPathElementImpl, stop, stopImpl, stuck, switchToAnotherPathElement, targetReached
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.navigation.impl.AbstractPathExecutor
addStuckDetector, getLog, getPath, getPathElement, getState, inState, isExecuting, isPathUnavailable, isStuck, isTargetReached, notInState, removeStuckDetector, setLog, switchState
 
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.base.agent.navigation.IPathExecutorHelper
checkStuckDetectors, stuck, switchToAnotherPathElement, targetReached
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.navigation.IPathExecutor
addStuckDetector, followPath, getLog, getPath, getPathElement, getPathElementIndex, getPathFuture, getState, inState, isExecuting, isPathUnavailable, isStuck, isTargetReached, notInState, removeStuckDetector, stop
 

Constructor Detail

UT2004PathExecutor

public UT2004PathExecutor(UT2004Bot bot)

UT2004PathExecutor

public UT2004PathExecutor(UT2004Bot bot,
                          IUT2004PathNavigator<PATH_ELEMENT> navigator)

UT2004PathExecutor

public UT2004PathExecutor(UT2004Bot bot,
                          IUT2004PathNavigator<PATH_ELEMENT> navigator,
                          java.util.logging.Logger log)
Method Detail

setTimeoutEstimator

public UT2004PathExecutor<PATH_ELEMENT> setTimeoutEstimator(IPathExecutionEstimator<PATH_ELEMENT> timeoutEstimator)

stopped

protected void stopped()
Description copied from class: BasePathExecutor
Method that is called just after the executor's state is switched to PathExecutorState.STOPPED from within the BasePathExecutor.stop() method.

You may utilize this method (for instance) to:

Specified by:
stopped in class BasePathExecutor<PATH_ELEMENT extends ILocated>

followPathImpl

protected void followPathImpl()
Description copied from class: BasePathExecutor
Method that is called just after the executor's state is switched to PathExecutorState.FOLLOW_PATH_CALLED from within the BasePathExecutor.followPath(IPathFuture) method.

You may utilize this method this way:

Specified by:
followPathImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

pathComputedImpl

protected void pathComputedImpl()
If the path is not zero-length, recalls IUT2004PathNavigator.newPath(List) and set the path into the GB2004 via SetRoute.

Specified by:
pathComputedImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

pathComputationFailedImpl

protected void pathComputationFailedImpl()
Description copied from class: BasePathExecutor
Method that is called just after the executor's state is switched to PathExecutorState.PATH_COMPUTATION_FAILED from within the BasePathExecutor.pathComputationFailed() method. Note that the path can be simply obtained by calling AbstractPathExecutor.getPath().

You may utilize this method (for instance) to:

Specified by:
pathComputationFailedImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

preStuckImpl

protected void preStuckImpl()
Description copied from class: BasePathExecutor
Method that is called just before the executor's state is switched to PathExecutorState#STUCKD from within the BasePathExecutor#stuck(IStuckDetector) method. Note that this method is called to clean up internal data structures before we switch itself into PathExecutorState.STUCK state.

You may utilize this method (for instance) to:

WARNING: 'null' may be passed as 'detector' if the stuck has been detected by different component

Overrides:
preStuckImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

switchToAnotherPathElementImpl

protected void switchToAnotherPathElementImpl()
Sets the path into the GB2004 via SetRoute whenever switch occurs and the rest of the path is greater than 32 path elements.

Specified by:
switchToAnotherPathElementImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

calculateTimeout

protected void calculateTimeout()

preTargetReachedImpl

protected void preTargetReachedImpl()
Description copied from class: BasePathExecutor
Method that is called just before the executor's state is switched to PathExecutorState.TARGET_REACHED from within the BasePathExecutor.targetReached() method.

You may utilize this method (for instance) to:

Empty implementation, does not doing anything.

Overrides:
preTargetReachedImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

eventEndMessage

protected void eventEndMessage()

navigate

protected void navigate()

getFocus

public ILocated getFocus()
Description copied from interface: IUnrealPathExecutor
Return current focus of the bot, null means "default" provided by the path executor.

Specified by:
getFocus in interface IUnrealPathExecutor<PATH_ELEMENT extends ILocated>
Returns:

setFocus

public void setFocus(ILocated located)
Description copied from interface: IUnrealPathExecutor
Allows you to set focus during the path-execution, i.e., tell the bot where it should be looking. You may set this focus multiple times during the whole run.

Note that the focus once set is never overridden by the path executer. So if you want to reset it back to the default focus, set the focus to 'null'.

Specified by:
setFocus in interface IUnrealPathExecutor<PATH_ELEMENT extends ILocated>

getStuckDetectors

public java.util.List<IStuckDetector> getStuckDetectors()
Description copied from interface: IUT2004PathExecutorHelper
Returns list of all stuck detectors registered inside the executor.

Specified by:
getStuckDetectors in interface IUT2004PathExecutorHelper<PATH_ELEMENT extends ILocated>
Returns:

stuckImpl

protected void stuckImpl()
Description copied from class: BasePathExecutor
Method that is called just after the executor's state is switched to PathExecutorState.STUCK from within the BasePathExecutor#stuck(IStuckDetector) method.

You may utilize this method (for instance) to:

WARNING: 'null' may be passed as 'detector' if the stuck has been detected by different component

Specified by:
stuckImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>

targetReachedImpl

protected void targetReachedImpl()
Description copied from class: BasePathExecutor
Method that is called just after the executor's state is switched to PathExecutorState.TARGET_REACHED from within the BasePathExecutor.targetReached() method.

You may utilize this method (for instance) to:

Specified by:
targetReachedImpl in class BasePathExecutor<PATH_ELEMENT extends ILocated>