public class BehaviorTreeLibrary extends Object
BehaviorTreeLibrary is a repository of behavior tree archetypes. Behavior tree archetypes never run. Indeed, they are
only cloned to create behavior tree instances that can run.| Modifier and Type | Field and Description |
|---|---|
protected BehaviorTreeParser<?> |
parser |
protected ObjectMap<String,BehaviorTree<?>> |
repository |
| Constructor and Description |
|---|
BehaviorTreeLibrary() |
| Modifier and Type | Method and Description |
|---|---|
<T> BehaviorTree<T> |
createBehaviorTree(String treeReference)
Creates the
BehaviorTree for the specified reference. |
<T> BehaviorTree<T> |
createBehaviorTree(String treeReference,
T blackboard)
Creates the
BehaviorTree for the specified reference and blackboard object. |
<T> Task<T> |
createRootTask(String treeReference)
Creates the root task of
BehaviorTree for the specified reference. |
boolean |
hasArchetypeTree(String treeReference)
Returns
true if an archetype tree with the specified reference is registered in this library. |
void |
registerArchetypeTree(String treeReference,
BehaviorTree<?> archetypeTree)
Registers the
BehaviorTree archetypeTree with the specified reference. |
protected BehaviorTree<?> |
retrieveArchetypeTree(String treeReference)
Retrieves the archetype tree from the library.
|
protected ObjectMap<String,BehaviorTree<?>> repository
protected BehaviorTreeParser<?> parser
public <T> Task<T> createRootTask(String treeReference)
BehaviorTree for the specified reference.treeReference - the tree identifier, typically a pathRuntimeException - if the reference cannot be successfully parsed.TaskCloneException - if the archetype cannot be successfully parsed.public <T> BehaviorTree<T> createBehaviorTree(String treeReference)
BehaviorTree for the specified reference.treeReference - the tree identifier, typically a pathRuntimeException - if the reference cannot be successfully parsed.TaskCloneException - if the archetype cannot be successfully parsed.public <T> BehaviorTree<T> createBehaviorTree(String treeReference, T blackboard)
BehaviorTree for the specified reference and blackboard object.treeReference - the tree identifier, typically a pathblackboard - the blackboard object (it can be null).RuntimeException - if the reference cannot be successfully parsed.TaskCloneException - if the archetype cannot be successfully parsed.protected BehaviorTree<?> retrieveArchetypeTree(String treeReference)
treeReference - the tree identifier, typically a pathRuntimeException - if the reference cannot be successfully parsed.public void registerArchetypeTree(String treeReference, BehaviorTree<?> archetypeTree)
BehaviorTree archetypeTree with the specified reference. Existing archetypes in the repository with
the same treeReference will be replaced.treeReference - the tree identifier, typically a path.archetypeTree - the archetype tree.IllegalArgumentException - if the archetypeTree is nullpublic boolean hasArchetypeTree(String treeReference)
true if an archetype tree with the specified reference is registered in this library.treeReference - the tree identifier, typically a path.true if the archetype is registered already; false otherwise.Copyright © 2017. All rights reserved.