Class Selector

All Implemented Interfaces:
Goal, Behavior

public class Selector extends Composite
A selector of sub-goals, that chooses a single Behavior to execute from a list. The default selection function is a random selection but this can be specified in the builder.
  • Method Details

    • getNextBehavior

      public Behavior getNextBehavior()
    • getSelectionFunction

      public<List<Behavior>,Behavior> getSelectionFunction()
    • reset

      public void reset()
      Description copied from interface: Goal
      Resets the goal and any resources or state it is holding.
      Specified by:
      reset in interface Behavior
      Specified by:
      reset in interface Goal
      reset in class Composite
    • retryChildren

      public boolean retryChildren()
    • run

      public BehaviorStatus run()
      Description copied from interface: Behavior
      Runs the behavior for one 'tick', optionally changing the state that it is in.
      The new state
    • toString

      public String toString()
      toString in class Object
    • selecting

      public static Selector.Builder selecting(Behavior... behaviors)
    • selecting

      public static Selector.Builder selecting(Collection<Behavior> behaviors)