Interface Behavior
- All Known Implementing Classes:
FlockingBehavior
public interface Behavior
Represents a specific task or behavior exhibited by an
Agent.
Behaviors can be simple (one-shot actions) or complex (finite state machines, cyclic tasks).
- Since:
- 2.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionvoidaction()Execution logic of the behavior.booleandone()Checks if the behavior has completed its task.getAgent()Gets the agent this behavior belongs to.default voidonEnd()Lifecycle method called when the behavior ends.default voidonStart()Lifecycle method called when the behavior starts.voidSets the agent this behavior belongs to.
-
Method Details
-
action
void action()Execution logic of the behavior. This method is called repeatedly by the agent scheduler untildone()returns true. -
done
boolean done()Checks if the behavior has completed its task.- Returns:
- true if the behavior is finished, false otherwise.
-
onStart
default void onStart()Lifecycle method called when the behavior starts. -
onEnd
default void onEnd()Lifecycle method called when the behavior ends. -
setAgent
Sets the agent this behavior belongs to.- Parameters:
agent- the owner agent.
-
getAgent
-