程序包 cn.wjybxx.btree

类 LeafTask<T>

java.lang.Object
cn.wjybxx.btree.Task<T>
cn.wjybxx.btree.LeafTask<T>
所有已实现的接口:
ICancelTokenListener
直接已知子类:
ActionTask, ChangeStateTask, ConditionTask, ConditionTask2, Failure, Running, SimpleRandom, Success, WaitFrame

public abstract class LeafTask<T> extends Task<T>
叶子任务(不能有子节点)
作者:
wjybxx date - 2023/11/25
  • 构造器详细资料

    • LeafTask

      public LeafTask()
  • 方法详细资料

    • onChildRunning

      protected final void onChildRunning(Task<T> child)
      从类复制的说明: Task
      子节点还需要继续运行 1.child在运行期间只会通知一次 2.该方法不应该触发状态迁移,即不应该使自己进入完成状态
      指定者:
      onChildRunning 在类中 Task<T>
    • onChildCompleted

      protected final void onChildCompleted(Task<T> child)
      从类复制的说明: Task
      子节点进入完成状态 1.避免方法数太多,实现类测试task的status即可 2.Task.getNormalizedStatus()有助于switch测试 3.task可能是取消状态,甚至可能没运行过直接失败(前置条件失败) 4.钩子任务和guard不会调用该方法 5.Task.isExecuting()有助于检测冲突,减少调用栈深度 6.同一子节点连续通知的情况下,completed的逻辑应当覆盖Task.onChildRunning(Task)的影响。 7.任何的回调和事件方法中都由用户自身检测取消信号
      指定者:
      onChildCompleted 在类中 Task<T>
    • indexChild

      public final int indexChild(Task<?> task)
      覆盖:
      indexChild 在类中 Task<T>
      返回:
      index or -1
    • childStream

      public final Stream<Task<T>> childStream()
      从类复制的说明: Task
      该接口主要用于测试,该接口有一定的开销
      指定者:
      childStream 在类中 Task<T>
    • getChildCount

      public final int getChildCount()
      从类复制的说明: Task
      子节点的数量(仅包括普通意义上的child,不包括钩子任务)
      指定者:
      getChildCount 在类中 Task<T>
    • getChild

      public final Task<T> getChild(int index)
      从类复制的说明: Task
      获取指定索引的child
      指定者:
      getChild 在类中 Task<T>
    • addChildImpl

      protected final int addChildImpl(Task<T> task)
      指定者:
      addChildImpl 在类中 Task<T>
      返回:
      为child分配的index
    • setChildImpl

      protected final Task<T> setChildImpl(int index, Task<T> task)
      指定者:
      setChildImpl 在类中 Task<T>
      返回:
      索引位置旧的child
    • removeChildImpl

      protected final Task<T> removeChildImpl(int index)
      指定者:
      removeChildImpl 在类中 Task<T>
      返回:
      index对应的child