java.lang.Object
cn.wjybxx.btree.Task<T>
cn.wjybxx.btree.Decorator<T>
cn.wjybxx.btree.decorator.LoopDecorator<T>
- 所有已实现的接口:
ICancelTokenListener
- 直接已知子类:
Repeat,UntilCond,UntilFail,UntilSuccess
循环节点抽象
如果
execute()方法是有循环体的,那么一定要注意:
只有循环的尾部运行child才是安全的,如果在运行child后还读写其它数据,可能导致bug(小心递归)。- 作者:
- wjybxx date - 2023/11/26
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voidexecute()Task的心跳方法,在Task进入完成状态之前会反复执行。intvoidsetMaxLoopPerFrame(int maxLoopPerFrame) 从类继承的方法 cn.wjybxx.btree.Decorator
addChildImpl, childStream, getChild, getChild, getChildCount, indexChild, onChildRunning, onEventImpl, removeChildImpl, setChild, setChildImpl, stopRunningChildren从类继承的方法 cn.wjybxx.btree.Task
addChild, beforeEnter, canHandleEvent, checkCancel, enter, exit, getBlackboard, getCancelToken, getControl, getControlData, getCurFrame, getEnterFrame, getEntity, getEntryBlackboard, getExitFrame, getFlags, getGuard, getNormalizedStatus, getPrevStatus, getReentryId, getRunFrames, getSharedProps, getStatus, getTaskEntry, isAutoCheckCancel, isAutoListenCancel, isAutoResetChildren, isCancelled, isCompleted, isDisableDelayNotify, isExecuteTriggeredByEnter, isExecuting, isExited, isExitTriggeredByStop, isFailed, isFailedOrCancelled, isLocked, isNotified, isReentered, isRunning, isSlowStart, isStillborn, isSucceeded, lock, onCancelRequested, onChildCompleted, onEvent, removeAllChild, removeChild, removeChild, resetChildrenForRestart, resetForRestart, resetForRestart, setAutoCheckCancel, setAutoListenCancel, setAutoResetChildren, setBlackboard, setCancelled, setCancelToken, setChild, setCompleted, setControl, setControlData, setDisableDelayNotify, setEnterFrame, setExitFrame, setFailed, setFlags, setGuard, setGuardFailed, setPrevStatus, setSharedProps, setSlowStart, setSuccess, stop, stop, template_checkGuard, template_execute, template_runChild, template_runChildDirectly, template_runHook, template_runHookDirectly, tryLock, unlock, unsetControl
-
字段详细资料
-
maxLoopPerFrame
protected int maxLoopPerFrame每帧最大循环次数 - 避免死循环和占用较多CPU;默认1
-
-
构造器详细资料
-
LoopDecorator
public LoopDecorator() -
LoopDecorator
-
LoopDecorator
public LoopDecorator(int maxLoopPerFrame)
-
-
方法详细资料
-
execute
protected void execute()从类复制的说明:TaskTask的心跳方法,在Task进入完成状态之前会反复执行。 1.可以根据Task.isExecuteTriggeredByEnter()判断是否是与Task.enter(int)连续执行的。 2.运行中可通过Task.setSuccess()、Task.setFailed(int)()}、Task.setCancelled()将自己更新为完成状态。 3.不建议直接调用该方法,而是通过模板方法运行。 -
getMaxLoopPerFrame
public int getMaxLoopPerFrame() -
setMaxLoopPerFrame
public void setMaxLoopPerFrame(int maxLoopPerFrame)
-