Showing preview only (1,092K chars total). Download the full file or copy to clipboard to get everything.
Repository: gaia-ucm/jbt
Branch: master
Commit: 2d1bf37b843b
Files: 170
Total size: 1.0 MB
Directory structure:
gitextract_1wlvd9oh/
├── Documentation/
│ ├── Images/
│ │ └── Source/
│ │ └── Overview.odg
│ ├── JBT.tex
│ └── JBTBib.bib
├── JBTCore/
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── libs/
│ │ ├── jargs.jar
│ │ ├── jdom.jar
│ │ ├── mmpm.jar
│ │ └── sourceformatter.jar
│ └── src/
│ └── jbt/
│ ├── exception/
│ │ ├── IllegalReturnStatusException.java
│ │ ├── NotTickableException.java
│ │ ├── SpawnException.java
│ │ └── TickException.java
│ ├── execution/
│ │ ├── context/
│ │ │ ├── BasicContext.java
│ │ │ ├── GenericBTLibrary.java
│ │ │ ├── HierarchicalContext.java
│ │ │ ├── SafeContext.java
│ │ │ └── SafeOutputContext.java
│ │ ├── core/
│ │ │ ├── BTExecutor.java
│ │ │ ├── BTExecutorFactory.java
│ │ │ ├── BTLibraryFactory.java
│ │ │ ├── ContextFactory.java
│ │ │ ├── ExecutionTask.java
│ │ │ ├── IBTExecutor.java
│ │ │ ├── IBTLibrary.java
│ │ │ ├── IContext.java
│ │ │ ├── ITaskState.java
│ │ │ ├── TaskState.java
│ │ │ ├── TaskStateFactory.java
│ │ │ └── event/
│ │ │ ├── ITaskListener.java
│ │ │ └── TaskEvent.java
│ │ └── task/
│ │ ├── composite/
│ │ │ ├── ExecutionComposite.java
│ │ │ ├── ExecutionDynamicPriorityList.java
│ │ │ ├── ExecutionParallel.java
│ │ │ ├── ExecutionRandomSelector.java
│ │ │ ├── ExecutionRandomSequence.java
│ │ │ ├── ExecutionSelector.java
│ │ │ ├── ExecutionSequence.java
│ │ │ └── ExecutionStaticPriorityList.java
│ │ ├── decorator/
│ │ │ ├── ExecutionDecorator.java
│ │ │ ├── ExecutionHierarchicalContextManager.java
│ │ │ ├── ExecutionInterrupter.java
│ │ │ ├── ExecutionInverter.java
│ │ │ ├── ExecutionLimit.java
│ │ │ ├── ExecutionRepeat.java
│ │ │ ├── ExecutionSafeContextManager.java
│ │ │ ├── ExecutionSafeOutputContextManager.java
│ │ │ ├── ExecutionSucceeder.java
│ │ │ └── ExecutionUntilFail.java
│ │ └── leaf/
│ │ ├── ExecutionFailure.java
│ │ ├── ExecutionLeaf.java
│ │ ├── ExecutionPerformInterruption.java
│ │ ├── ExecutionSubtreeLookup.java
│ │ ├── ExecutionSuccess.java
│ │ ├── ExecutionVariableRenamer.java
│ │ ├── ExecutionWait.java
│ │ ├── action/
│ │ │ └── ExecutionAction.java
│ │ └── condition/
│ │ └── ExecutionCondition.java
│ ├── model/
│ │ ├── core/
│ │ │ └── ModelTask.java
│ │ └── task/
│ │ ├── composite/
│ │ │ ├── ModelComposite.java
│ │ │ ├── ModelDynamicPriorityList.java
│ │ │ ├── ModelParallel.java
│ │ │ ├── ModelRandomSelector.java
│ │ │ ├── ModelRandomSequence.java
│ │ │ ├── ModelSelector.java
│ │ │ ├── ModelSequence.java
│ │ │ └── ModelStaticPriorityList.java
│ │ ├── decorator/
│ │ │ ├── ModelDecorator.java
│ │ │ ├── ModelHierarchicalContextManager.java
│ │ │ ├── ModelInterrupter.java
│ │ │ ├── ModelInverter.java
│ │ │ ├── ModelLimit.java
│ │ │ ├── ModelRepeat.java
│ │ │ ├── ModelSafeContextManager.java
│ │ │ ├── ModelSafeOutputContextManager.java
│ │ │ ├── ModelSucceeder.java
│ │ │ └── ModelUntilFail.java
│ │ └── leaf/
│ │ ├── ModelFailure.java
│ │ ├── ModelLeaf.java
│ │ ├── ModelPerformInterruption.java
│ │ ├── ModelSubtreeLookup.java
│ │ ├── ModelSuccess.java
│ │ ├── ModelVariableRenamer.java
│ │ ├── ModelWait.java
│ │ ├── action/
│ │ │ └── ModelAction.java
│ │ └── condition/
│ │ └── ModelCondition.java
│ ├── tools/
│ │ └── btlibrarygenerator/
│ │ ├── ActionsAndConditionsGenerator.java
│ │ ├── BTLibraryGenerator.java
│ │ ├── librarygenerator/
│ │ │ ├── BTLibraryGenerationException.java
│ │ │ └── BTLibraryGenerator.java
│ │ ├── lowlevelgenerator/
│ │ │ ├── ActionsGenerator.java
│ │ │ ├── CommonCodeGenerationUtilities.java
│ │ │ └── ConditionsGenerator.java
│ │ ├── modelbtgenerator/
│ │ │ ├── ModelBTGenerationException.java
│ │ │ └── ModelBTGenerator.java
│ │ └── util/
│ │ └── Util.java
│ └── util/
│ └── Pair.java
├── JBTEditor/
│ ├── jbt.tools.bteditor/
│ │ ├── .classpath
│ │ ├── .gitignore
│ │ ├── .project
│ │ ├── .settings/
│ │ │ └── org.eclipse.jdt.core.prefs
│ │ ├── META-INF/
│ │ │ └── MANIFEST.MF
│ │ ├── bteditor.product
│ │ ├── build.properties
│ │ ├── files/
│ │ │ └── standardNodes.xml
│ │ ├── icons/
│ │ │ ├── jbt.icns
│ │ │ └── jbt.xpm
│ │ ├── libs/
│ │ │ ├── jdom.jar
│ │ │ └── mmpm.jar
│ │ ├── plugin.xml
│ │ ├── plugin_customization.ini
│ │ └── src/
│ │ └── jbt/
│ │ └── tools/
│ │ └── bteditor/
│ │ ├── Activator.java
│ │ ├── Application.java
│ │ ├── ApplicationActionBarAdvisor.java
│ │ ├── ApplicationIcons.java
│ │ ├── ApplicationWorkbenchAdvisor.java
│ │ ├── ApplicationWorkbenchWindowAdvisor.java
│ │ ├── BTCPPManager.java
│ │ ├── BTXMLManager.java
│ │ ├── DisableNewEditorHandler.java
│ │ ├── NodesLoader.java
│ │ ├── Perspective.java
│ │ ├── actions/
│ │ │ ├── CheckErrorsAction.java
│ │ │ ├── ClearErrorsAction.java
│ │ │ ├── CollapseTreeAction.java
│ │ │ ├── DialogExportAsCppAction.java
│ │ │ ├── DialogLoadMMPMDomainAction.java
│ │ │ ├── DialogOpenBTAction.java
│ │ │ ├── EditorActionDelegate.java
│ │ │ ├── ExpandTreeAction.java
│ │ │ ├── ExportToCppAction.java
│ │ │ ├── LoadMMPMDomainAction.java
│ │ │ ├── NewBTAction.java
│ │ │ ├── OpenBTAction.java
│ │ │ ├── SaveBTAction.java
│ │ │ └── SaveBTAsAction.java
│ │ ├── editor/
│ │ │ ├── BTEditor.java
│ │ │ ├── BTEditorCopyAndPasteManager.java
│ │ │ ├── BTEditorIDGenerator.java
│ │ │ └── BTEditorInput.java
│ │ ├── event/
│ │ │ ├── ITreeModifierListener.java
│ │ │ └── TreeModifiedEvent.java
│ │ ├── model/
│ │ │ ├── BT.java
│ │ │ ├── BTNode.java
│ │ │ ├── ConceptualBTNode.java
│ │ │ └── ConceptualNodesTree.java
│ │ ├── util/
│ │ │ ├── DetailsDialog.java
│ │ │ ├── Extensions.java
│ │ │ ├── IconsPaths.java
│ │ │ ├── OverlayImageIcon.java
│ │ │ ├── Pair.java
│ │ │ ├── StandardDialogs.java
│ │ │ └── Utilities.java
│ │ ├── viewers/
│ │ │ ├── BTNodeIndentifierTransfer.java
│ │ │ ├── ConceptualBTNodeTransfer.java
│ │ │ ├── ConceptualNodesTreeViewer.java
│ │ │ └── NodeInfoViewer.java
│ │ └── views/
│ │ ├── NodeInfo.java
│ │ ├── NodesNavigator.java
│ │ └── NodesSearcher.java
│ └── jbt.tools.bteditor.feature/
│ ├── .project
│ ├── build.properties
│ └── feature.xml
├── LICENSE.txt
├── README.txt
└── UserGuide/
├── Images/
│ └── Source/
│ └── Overview.odg
├── UserGuide.tex
├── UserGuideBib.bib
└── userguide.kilepr
================================================
FILE CONTENTS
================================================
================================================
FILE: Documentation/JBT.tex
================================================
\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{minted}
%opening
\title{\textit{Java Behaviour Trees}, a Java Framework for Creating and Running Behaviour Trees}
\author{Ricardo Juan Palma Dur\'an}
\begin{document}
\maketitle
\begin{abstract}
Behaviour Trees (BTs) have gained popularity over the past few years as a tool for defining the behaviour of video games' characters. However, to the best of our knowledge, currently there is no open Java implementation of BTs. Here we present \textit{Java Behaviour Trees} (JBT), a GNU framework in Java for defining and running BTs.
\end{abstract}
\section{Introduction}
We assume that the reader is familiar with the concept of BT. Here we are not going to explain all the details about what a BT is or how it conceptually works. Some authors have spent a lot of effort doing so, so we will just refer the reader to \cite{Millington09} for an introduction.
The model we have implemented is a hybrid one, since it combines ideas from several sources. The basic underlying model is that of \cite{Millington09}, including all the task that the authors propose as well as the concept of context and libraries of behaviour trees. However, we have also added \textit{guards} to our implementation. Guards act like conditions that in some scenarios are checked in order to decide whether a task is run or not.
We have also taken some ideas from \cite{AIGameDev}, specially that of having trees whose nodes are ticked only when necessary so that CPU time does not get wasted.
\subsection{Model overview description}
In this section we describe the JBT architecture as well as the main features that BTs have.
\subsubsection{Model driven by ticks}
JBT implements a BT model driven by ticks. A BT must be evaluated through ticks, so every game cycle an external caller \textit{ticks} the tree in order for the tree to update its status. A tick is just a way of giving the tree some CPU time to update their status; in particular, ticks are used to give the nodes of the tree some time to evaluate whether they have finished or not, and consequently make the tree evolve.
The simplest approach to BTs driven by ticks is that of ticking the root node and then letting each node recursively tick its children according to its semantics. However, this is a very inefficient process, since in general the major part of the nodes of the tree are just waiting for their children to finish. Therefore, they should not receive ticks, since unless their children are done they will do nothing useful when receiving the tick. Therefore, in general only very few nodes should be ticked at a game cycle, and as a result JBT implements a model in which there is a list of \textit{tickable} nodes. Only the nodes in the list can be ticked.
\subsubsection{Model independent from execution}
When running a BT, there should be a clear distinction between the tree that is being run (the model) and how it is actually being run (the execution). For each particular behaviour, we distinguish between the \textit{Model BT} that defines it and how it is being run. The \textit{how} is what the \textit{BT Executor} does. Basically, for every entity in the game that wants to run a behaviour (Model BT), there is a BT Executor. The BT Executor takes the Model BT and processes it (without modifying it), simulating the behaviour that is represented by the Model BT. This choice implies that, apart from the Model BT, there is another type of tree, the \textit{Execution BT}. When an entity wants to execute a behaviour, the BT Executor takes the Model BT and creates an Execution BT to execute the behaviour. The BT Executor along with the Execution BT know how to run the behaviour that the Model BT represents.
\subsubsection{Architecture}
Figure \ref{fig:Overview} shows an overview of the proposed architecture for BTs. There is a Model BT that represents a particular behaviour. Also, there is a BT Executor for every entity that wants to run the Model BT. Each BT Executor makes use of the Model BT and builds an Execution BT that actually runs the behaviour conceptualized by the Model BT. An external Game AI ticks the BT Executors, in order for them to update the trees that they are running.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{./Images/Overview.pdf}
\caption{Overview of the BT architecture}
\label{fig:Overview}
\end{figure}
\section{Lists of nodes}
At all times, the BT Executor receives ticks from an external Game AI. As a consequence, the BT Executor makes the tree it contains evolve.
Not all the nodes of the tree should receive ticks. In general, the evolution of the tree depends on a very small set of nodes, which, in general, is mainly composed of leaves of the tree. In general, intermediate nodes, such as sequences or selectors, should do nothing unless they are notified by their children after finishing. As a consequence, it is obvious that only a few nodes should receive ticks. The rest should be somehow \textit{asleep}, waiting for some events to take place in order to be awakened.
We have implemented an architecture where, for each BT being run, there is a list of \textit{tickable nodes} (\textit{Tickable Nodes List} from now on). Whenever the external Game AI ticks the BT Executor, the BT Executor will only tick the nodes in the Tickable Nodes List. This list is modified through out the execution of the tree, so nodes enter and leave the list depending on whether they are useful with respect to the evolution of the tree or not.
Also, at all times the BT Executor knows which nodes are open (or active). A node is active if it belongs to a path from the root node to an active leaf node. Therefore, open nodes represent those that are actively involved in the current execution of the tree. They may not be tickable nodes, but the fact that they belong to a path from the root to an active leaf node means that they may receive ticks soon.
This list is called the \textit{Open Nodes List}.
\section{Model BT, guards and context}
A Model BT is a BT that conceptually represents a behaviour. A Model BT does not have running capabilities, that is, it is just a way of defining a behaviour. An external interpreter, the BT Executor, uses the Model BT as a base to run the behaviour it embodies. A Model BT is shared by all the entities that want to run such a behaviour. By following this model, there is only one tree even though it is being actually run by several entities.
The main functionality of a Model BT is very simple. The base class for a node (also called \textit{task}) is mainly as follows:
\begin{minted}{java}
public abstract class ModelTask{
/* The list of children of the task. */
private List<ModelTask> children;
/* The guard of the task, which may be null. */
private ModelTask guard;
public ModelTask(ModelTask guard, ModelTask... children){
this.children = new Vector<ModelTask>();
for(int i=0;i<children.lenght;i++){
this.children.add(children[i]);
}
this.guard = guard;
}
public List<ModelTask> getChildren(){
return this.children;
}
public ModelTask getGuard(){
return this.guard;
}
...
}
\end{minted}
That is, a task is just a container of other tasks, with no running capabilities. A task's children can be accessed, as well as its guard. In this model, a behaviour tree is equivalent to a ModelTask object, that is, a ModelTask can be interpreted as the behaviour tree whose root is the ModelTask itself. There can be as many ModelTask subclasses as supported by the underlying BT model being implemented, but none of them should define running methods.
A guard is represented by an ModelTask object. Initially, we defined guards as objects implementing the \textit{IGuard} interface:
\begin{minted}{java}
public interface IGuard{
/* Evaluates the guard within a context. */
public boolean evaluate(IContext);
}
\end{minted}
That is, a guard was just an entity capable of being evaluated within a context, issuing a boolean value as a result. However, a more general approach is that of considering a ModelTask to be a guard. By doing so, \textit{conditions} (ModelTasks that evaluate certain attributes of the world) can be used as guards. What is more, any behaviour tree can be used as a guard. As long as the behaviour tree succeeds, the guard evaluation is interpreted as \textit{true}; if the behaviour tree fails, the guard evaluation is interpreted as \textit{false}.
In general, guards will be implemented by single ModelTask nodes. For instance, if a guard has to check if the current player has enough resources to build a particular type of unit, then a subclass of ModelTask may represent such condition. This conditions may be used, not only as a guard, but also as a condition node along the tree.
The main advantage of this method is that of reusability, since predefined tasks can also be used as guards.
A context is defined by the \textit{IContext} interface:
\begin{minted}{java}
public interface IContext{
/* Sets the value of a variable. */
public void setVariable(String name, Object value);
/* Gets the value of a variable (null if not found). */
public Object getVariable(String name);
...
}
\end{minted}
We will extend this interface further in following sections. However, the previous two methods define the core of what a context should be in a behaviour tree: an large repository of variables that can be modified an accessed by tasks.
\section{Execution BT and BT Executor}\label{Sub:ExecutionBTAndBTExecutor}
An Execution BT is a BT capable of running a particular BT Model. The idea behind this whole architecture is that, for each ModelTask, there must be another task knowing how to run it. For instance, there could be an ExecutionSequenceTask knowing how a ModelSequenceTask behaves, or an ExecutionParallelTask knowing how to run a ModelParallelTask.
\textit{ExecutionTask} is the base class for all the tasks with the ability to run. An ExecutionTask has a reference to the ModelTask it represents, so it knows what the structure of the conceptual tree is like. An ExecutionTask also has a reference to the BT Executor in charge of it.
The BT Executor contains the Tickable Nodes List and the Open Nodes List. Both lists store ExecutionTasks.
Initially, the BT Executor receives the Model BT it should execute. It then creates an ExecutionTask for the root node of the tree, and \textit{spawns} it. When an ExecutionTask is spawned, it recursively spawns its children according to the semantics of the particular task. The idea is that, when \textit{spawn()} is called, the path(s) containing all the tasks from the root to the active leaf nodes must be created and stored. When a task is spawned, it has to decide whether it enters the list of tickable nodes or not. Also, when a task is spawned, it is inserted into the \textit{Open Nodes List}.
From then on, the BT Executor just ticks the list of tickables nodes it contains. At every tick, the tickable nodes analyse their current situation to check whether they have or have not finished. For an intermediate node, this decision in general depends on whether its children have finished or not. For leaf nodes, this decision usually depends on an external process that has to be checked for termination.
When a task (intermediate or not) has finished, it should notify its parent. In general, parent (intermediate) nodes will not usually be tickables; therefore, they will not be in the Tickable Nodes List, and as a result, the only way for them to notice that they have to be updated is by being explicitly told so. Thus, when a tickable finishes, a TaskEvent is fired. Parents register as TaskEventListeners of their children (at spawning time), so whenever a child is done, the parent will immediately realize and will be able to act as a consequence. By following this pattern, only very few tasks must stay in the Tickable Nodes List: in general, only leaf nodes will receive ticks. When they are done, they will automatically fire a TaskEvent. Parents, on the other hand, will usually register as TaskEventListeners of their children, so they will receive such events and will be able to have a chance to react to the termination of their children. If the parent finishes as a consequence of the child's termination, then the parent will fire a TaskEvent to notify its parent too, and so on.
The BT Executor has a very simple interface:
\begin{minted}{java}
public class BTExecutor{
/* The Model BT being run. */
private ModelTask modelBT;
/* The list of tickable nodes. */
private List<ExecutionTask> tickableList;
/* The list of open nodes. */
private List<ExecutionTask> openList;
/* Updates the tree being run. */
public void tick();
/* Terminates the execution of the tree. */
public void terminate();
/* Returns the status of the tree being run. */
public Status getStatus();
...
}
\end{minted}
An ExecutionTask mainly contains a reference to the ModelTask it is running, the BTExecutor and the context (IContext), as follows:
\begin{minted}{java}
public abstract ExecutionTask implements ITaskListener{
/* Reference to the corresponding ModelTask. */
private ModelTask modelTask;
/* The BTExecutor that is running this ExecutionTask. */
private BTExecutor executor;
/* The context of the task. */
private IContext context;
/* List of all the listeners of this task. */
private List<ITaskListener> listeners;
/* Current status of the task. */
private Status currentStatus;
/* Spawns the task and its children. */
public final void spawn(IContext context){...};
/* Ticks the task. */
public final void tick(){...}
/* Terminates the task. */
public final void terminate(){...}
/* Returns the current status of the task. */
public Status getCurrentStatus(){
return this.currentStatus;
}
/*
* Adds a task listener to this task. The
* task listener will be notified when an important
* change in the status of this task occurs.
*/
public void addTaskListener(ITaskListener listener){
if(listener != null){
this.listener.add(listener);
}
}
/* Called to fire the TaskEvent on all the listeners. */
private void fireTaskEvent(Status s){
for(ITaskListener t:this.listeners){
t.taskFinished(new TaskEvent(s));
}
}
...
}
\end{minted}
An ExecutionTask has three main methods, \textit{spawn()}, \textit{tick()} and \textit{terminate()}. These three methods define the main functionality of an ExecutionTask. They have a base definition that cannot be overriden by subclasses, and their internal implementation relies upon three abstract methods, \textit{internalSpawn()}, \textit{internalTick()} and \textit{internalTerminate()} respectively. Subclasses define their specific behaviour by implementing these abstract methods.
As stated before, the standard behaviour of all ExecutionTask is implemented in the \textit{spawn()}, \textit{tick()} and \textit{terminate()} methods. Their definition is as follows:
\begin{minted}{java}
/* Spawn. */
public final void spawn(IContext context){
/*
* Store the context.
*/
this.context = context;
/* Set the current status of the task to Status.RUNNING. */
this.status = Status.RUNNING;
/*
* Request to be inserted into the list of open tasks.
*/
this.executor.requestInsertionIntoOpenList(this);
/*
* Carry out the actual spawn.
*/
internalSpawn();
}
/* Tick. */
public final Status tick(){
Status newStatus = internalTick();
this.currentStatus = newStatus;
if(this.currentStatus != RUNNING){
this.executor.requestRemovalFromTickableList(this);
this.executor.requestRemovalFromOpenList(this);
fireTaskEvent(newStatus);
}
return newStatus;
}
\end{minted}
With respect to the \textit{terminate()} method, see section \ref{Sub:TerminatingTasks} for further explanation. As we can see, the main purpose of \textit{spawn()} is to store the context (so that in is accessible later on, when the task actually needs it) and request that the task be inserted into the list of open nodes. Finally, it calls \textit{internalSpawn()}, where the task will carry out the spawning process according to its semantics (for instance, a parallel task would spawn all of its children, while a selector would spawn just one child). This method is in charge of the following:
\begin{itemize}
\item It decides whether it should enter the Tickable Nodes List or not\footnote{See Section \ref{Sub:ManagingLists} for further explanation.}. For instance, an ExecutionSequenceTask should not enter the list, because the fact that it evolves or not depends on the termination of its children (therefore, only its children should enter the list). However, low level actions or tasks such as DynamicPriorotyList should. It is very important to note that if the spawning process of a task fails, it should enter the Tickable Nodes List in order for it to notify its parent at the next AI cycle. A DynamicPriorityList, for instance, may fail in case no valid guard is found, in which case it should be ticked at the next AI cycle so as to notify its parent.
\item According to the semantics of the node, it recursively spawns none, one or several of its children. For instance, an ExecutionSequenceTask should spawn the very first node of its list of children. An ExecutionParallelTask should spawn all of its children. On the contrary, a low level task (leaf node) cannot spawn any child since it has none.
\item In case of a low level task, \textit{internalSpawn()} should start the execution of the process associated to the node. Keep in mind that low level tasks may perform long processes that require several ticks in order to complete. It is in this method that those processes start (maybe in independent threads). It should be noted, however, that many processes may be \textit{instantaneous}, so they may complete even within the \textit{internalSpawn()} method. Nevertheless, in these cases the tree should not evolve, reason why the termination notification to its parent should be carried out in the \textit{tick()} method, in the next AI cycle. If \textit{internalSpawn()} were allowed to notify parents when the node terminated, then a single call to \textit{spawn()} may take too long to complete due to the uninterrupted evolution of the tree, which is something that has to be avoided.
\end{itemize}
On the other hand, \textit{tick()} calls the \textit{internalTick()} method, where the task will carry out the actual ticking process. Then, if the task has finished after calling it, a TaskEvent will be fired to notify all the listeners that are registered with the task, and it requests to be removed from the Tickable Nodes List and the Open Nodes List. It is by this mechanism that parents are notified about their children termination, and can act accordingly.
\textit{internalTick()} is the method that actually performs the tick. In general, this method will analyse the current status of the children of the task (\textit{ExecutionTask.getStatus()}), and will evolve accordingly. For instance, when an ExecutionSequenceTask receives a TaskEvent from its currently active child, its \textit{tick()} method gets called, and the following is done (in \textit{internalTick()}):
\begin{itemize}
\item If the child has succeeded, the ExecutionSequenceTask will spawn the next child in case there is one, and will return RUNNING. In case it is the last child, it will return SUCCESS.
\item If the child has failed, the ExecutionSequenceTask will also fail, returning FAILURE.
\end{itemize}
The ITaskListener interface represents an interface for listening to events fired when there are important changes in the status of a task.
\begin{minted}{java}
public interface ITaskListener{
/*
* Called whenever there is a change in
* the status of a task.
*/
public void statusChanged(TaskEvent e);
}
\end{minted}
In general, the method \textit{statusChanged()} will just call \textit{tick()} on the node itself. By doing so, the node will be able to advance, either by spawning other children or by firing a TaskEvent to its parent to make it go on too.
\section{Creating ExecutionTasks from ModelTasks}
ExecutionTasks must be created for ModelTasks. In order to make this process easier, it can be delegated to ModelTasks. When an ExecutionTask needs to create the ExecutionTask of one of its children, it can ask the corresponding ModelTask to do so. Therefore, ModelTasks define a new method,
\begin{minted}{java}
/*
* Creates an ExecutionTask that is able to run
* this ModelTask. "executor" is the BTExecutor
* managing the ExecutionTask that will be created.
*/
public abstract ExecutionTask createExecutor(BTExecutor executor);
\end{minted}
This method should return an ExecutionTask capable of running the corresponding ModelTask. Keep in mind that the returned ExecutionTask must have a reference to the ModelTask that created it. For instance, in case of a ModelSequenceTask, it should do something like:
\begin{minted}{java}
public ExecutionTask createExecutor(BTExecutor executor){
return new ExecutionSequenceTask(this, executor);
}
\end{minted}
By following this pattern, it would be ModelTasks that would be in charge of creating ExecutionTasks through \textit{createExecutor()}.
\section{Managing the Tickable Nodes List and the Open Nodes List}\label{Sub:ManagingLists}
When tasks are being ticked, there may be a problem accessing the Tickable Nodes List. The algorithm followed by the BTExecutor is pretty simple:
\begin{minted}{java}
public class BTExecutor{
...
public void tick(){
if(this.firstTimeCalled){
ExecutionTask root = this.modelBT.createExecutor();
root.spawn();
this.firstTimeCalled = false;
}
else{
for(ExecutionTask t:this.tickableList){
t.tick();
}
}
...
}
...
}
\end{minted}
That is, it just ticks all the nodes in the Tickable Nodes List. However, while the list is being ticked, some nodes may need to leave the list, so the iteration through its elements may be left in an inconsistent state. Therefore, when a node wants to enter or leave the list, it does not \textit{immediately} do it. Instead, it \textit{requests} to be inserted or removed. When the BTExecutor has ticked all the nodes, it processes these requests, so the code above should finally be something like:
\begin{minted}{java}
public class BTExecutor{
...
public void tick(){
if(this.firstTimeCalled){
ExecutionTask root = this.modelBT.createExecutor();
root.spawn();
this.firstTimeCalled = false;
}
else{
for(ExecutionTask t:this.tickableList){
t.tick();
}
}
processRemovalsAndInsertions();
}
...
}
\end{minted}
In order to prevent the Open Nodes List from failing the same way, insertions and removals from it are also requested and delayed instead of being immediately carried out.
\section{Terminating tasks}\label{Sub:TerminatingTasks}
In certain cases, tasks must be abruptly terminated. This happens, for instance, when a parallel task realizes that one of its children has failed. In such a case, it has to immediately stop the other children. Another example is when a whole tree needs to be terminated, because it just does not make sense to run it any more. As we can see, there are several scenarios in which it is necessary to have the ability to stop individual tasks or branches of a tree. This is the purpose of the method \textit{terminate()}, first introduced in the section \ref{Sub:ExecutionBTAndBTExecutor}.
As a consequence of these requirements, BTExecutor and ExecutionTask need to be extended, so both include a \textit{terminate()} method. In the case of the BTExecutor, its implementation is trivial: it will just terminate the tree that it is running. However, the \textit{terminate()} method in the ExecutionTask class is more complicated. Since the termination process of an ExecutionTask varies according to the specific type, it is an final method whose implementation relies on the abstract \textit{internalTerminate()} method, which carries out the actual termination process.
What \textit{terminate()} does is to request that the task be removed from both the list of tickable and open nodes, sets the status of the task to \textit{terminated}, and finally calls \textit{internalTerminate()}. For non-leaf tasks, \textit{internalTerminate()} usually calls \textit{terminate()} on their active children, in a recursive manner. For leaf tasks, it will stop and free all the processes and resources belonging to the task.
The problem about terminating tasks is that they must not leave the list of tickable nodes until the next game AI cycle (that is, until \textit{BTExecutor.tick()}) is called again. This is due to the fact that the list of tickable nodes may be being ticked just when a task is terminated. If the terminated task(s) were removed from the list, then it would be left in an inconsistent state and the BTExecutor would have problems ticking all of its tasks. It is for this reason that when a task is requested to terminate itself, the task does not immediately remove itself from the Tickable Nodes List, but requests it. Now, the problem is that the BTExecutor could tick tasks that have been terminated, since they are not removed from the Tickable Nodes List until the current AI cycle finishes.In order to prevent from any problem, the \textit{ExecutionTask.tick()} method is modified so that, if the task has been terminated, it does nothing.
\begin{minted}{java}
public abstract ExecutionTask implements ITaskListener{
...
public Status tick(){
if(!this.terminated){
Status newStatus = internalTick();
this.currentStatus = newStatus;
if(this.currentStatus != RUNNING){
requestRemovalFromTickableList(this);
requestRemovalFromOpenList(this);
fireTaskEvent(newStatus);
}
return newStatus;
}
else{
return Status.TERMINATED;
}
}
...
\end{minted}
The \textit{ExecutionTask.terminate()} method is mainly implemented like this:
\begin{minted}{java}
public abstract ExecutionTask implements ITaskListener{
...
public void terminate(){
if(!this.terminated){
requestRemovalFromOpenList();
requestRemovalFromTickableList();
this.terminated = true;
this.currentStatus = Status.TERMINATED;
internalTerminate();
}
}
...
}
\end{minted}
That is, the \textit{terminate()} method requests to remove the task from both the Open Nodes List and the Tickable Nodes List. Also, it activates a flag to indicate that the task has been terminated. Finally, it calls the abstract method \textit{ExecutionTask.internalTerminate()} which will actually terminate the task.
\textbf{It must be noted that the termination process must be carefully handled}. When a task is terminated, it immediately becomes totally unresponsive, so ticking it will have no effect; also, at the next game AI cycle, it will be removed from the list of tickable nodes. As a result, its parent will never be notified about its child termination -it will not receive a TaskEvent-, and it will never be able to evolve.
Therefore, when a task is terminated, its parent should enter the list of tickable nodes so that at the next game AI cycle it can receive ticks and realizes that its child has finished (been terminated). This is for example what the ExecutionInterrupter does when it is interrupted: it terminates its child and then requests to be inserted into the list of tickable nodes. Even though it may not be necessary to always insert the parent task into the list of tickable nodes, it should be kept in mind that terminating tasks is a very delicate process that must be properly handled.
\section{General process}
So far we have described a general architecture to model and run behaviour trees. Despite the fact that there are still many details to be taken care of, we can give an overview of the whole process of managing a behaviour tree:
\begin{itemize}
\item A Model BT is created. The Model BT represents the behaviour that must be run, but it cannot be executed by itself. The tree would be implemented by a ModelTask.
\item A BTExecutor is created. The BTExecutor will contain a reference to the ModelTask that must be run.
\item From then on, \textit{BTExecutor.tick()} is called in order to run the tree. At every game cycle, \textit{tick()} is called. The external caller should not worry about anything else; it will be the BTExecutor that will handle the execution of the BT.
\begin{itemize}
\item The very first time \textit{tick()} is called, the BTExecutor takes the root node of the Model BT, and creates the corresponding ExecutionTask node, which is spawned. This is done by calling \textit{ModelTask.createExecutor()}, and then calling \textit{ExecutionTask.spawn()} on the returned ExecutionTask.
\item From then on, every time \textit{BTExecutor.tick()} is called, the BTExecutor will just tick the nodes in the Tickable Nodes List.
\end{itemize}
\item Whenever a task finishes, it fires an event to inform its parent. The parent will then either report success or failure (depending on whether the child failed or succeeded) or spawn a new child. If the parent also finishes, it will fire a new event to its parent, in a recursive manner.
\end{itemize}
\section{Actions and conditions (leaf nodes)}
Actions and conditions, that is, leaf nodes in the BT, must be somehow specified. At design level, the BT is designed including all the low level actions and conditions that the tree is supposed to run, but in an abstract manner.
On the implementation side, however, there must be an ExecutionTask that knows how to run each leaf node. Since these tasks are outside the framework, a way of defining their behaviour must be provided. The framework provides two abstract classes, \textit{ModelAction} and \textit{ModelCondition}, so every low level action and condition must subclass them,
\begin{minted}{java}
public abstract class ModelAction extends ModelTask{
...
}
\end{minted}
\begin{minted}{java}
public abstract class ModelCondition extends ModelTask{
...
}
\end{minted}
For instance, a low level action \textit{MoveTo} would be defined like this:
\begin{minted}{java}
public class MoveTo extends ModelAction{
...
}
\end{minted}
ModelTasks and ModelConditions also define a \textit{createExecutor()} method that must return the corresponding ExecutionTask to run the action or condition. The designer should define the \textit{internalSpawn()}, \textit{internalTick()} and \textit{internalTerminate()} methods for these ExecutionTasks. For instance, lets suppose that the designer has created a BT with a low level action called \textit{MoveTo}. Such action would be represented by two classes:
\begin{minted}{java}
public class ModelMoveTo extends ModelAction{
...
public ExecutionTask createExecutor(BTExecutor executor){
return new ExecutionMoveTo(this, executor);
}
}
\end{minted}
\begin{minted}{java}
public class ExecutionMoveTo extends ExecutionAction{
...
public void internalSpawn(){
/* TODO: designer should implement this method! */
}
public Status internalTick(){
/* TODO: designer should implement this method! */
return Status.SUCCESS;
}
public void internalTerminate(){
/* TODO: designer should implement this method! */
}
}
\end{minted}
So the designer should only implement the \textit{internalSpawn()}, \textit{internalTick()} and \textit{internalTerminate()} methods. In the case of the MoveTo action, \textit{internalSpawn()} would send the unit the move order through the game engine. \textit{internalTick()} would check whether the unit has arrived at its destination. If so, it would return \textit{Status.SUCCESS}; otherwise, it would return \textit{Status.RUNNING}.
\section{Evaluation order}
The problem with having a Tickable Nodes List is that the order in which nodes are ticked does not necessarily correspond to that of an ideal BT. Suppose for example that we have a BT with a DynamicPriorotyList (DPL) task, and some of its children are currently running. Suppose an scenario in which, if the active child is ticked, it finishes successfully, but at the same time, if the DPL is ticked, it realizes there is a child with higher priority that must be run.
Ideally, the DPL is ticked first, so it terminates the currently active child and spawns the child with higher priority. However, if in the Tickable Nodes List the currently active child is placed before the DPL node, it will receive a tick first. In the presented scenario, the child would finish with success, the DPL would be informed, and as a result, it would terminate without spawning the child with higher priority. Moreover, the child task would succeeds while in the ideal BT it would not.
This problem can be fixed by forcing an order in the Tickable Nodes List. In particular, if parent nodes always precede their children at ticking time, then this problem is fixed, since by doing so the ideal evaluation order of a BT is emulated.
\section{Subtree Lookup and IContext}\label{sec:SubtreeLookupAndIContext}
One of the most important features of behaviour trees is that of reusability. In the context of behaviour trees it is very important to notice the way that parent tasks interact with their children: parents do not care about what their children are; in JBT, on the conceptual side, this can be seen in the fact that ModelTasks always have other ModelTasks as children, and it is through its interface that they interact, no matter the particular subtype. On the execution side, ExecutionTasks always have other ExecutionTasks as their children, and it is also through its interface that they interact, no matter the particular subtype.
A behaviour tree is represented by its root ModelTask (with its corresponding ExecutionTask). As a consequence, a behaviour tree task interacts with a single child task just the same way it interacts with a complete behaviour tree (that is, with the root of the tree). This property is specially important with respect to reusability: the designer labels trees with a name, and then at some point in whatever tree he is building, decides to reuse a particular tree -identifier by its name-. By following this philosophy, the effort of creating trees decreases dramatically.
The ability to reuse trees by name is implemented by the Subtree Lookup task. The ModelSubtreeLookup task receives, as an input argument in its constructor, the name of the subtree that it has to emulate. When it gets spawned, it will emulate the behaviour of the tree it is expected to emulate.
The ExecutionTask that is able to run a ModelSubtreeLookup is the ExecutionSubtreeLookup class. This class, however, faces a problem when it tries to emulate the tree whose name was initially given: even though it knows the name that identifies the tree to emulate, it does not know where to find such tree (that is, it does not know where the root ModelTask of such tree is). Thus, there must be a mechanism through which the ExecutionSubtreeLookup can find the tree it is expected to emulate. This mechanism is implemented via the IContext interface. The IContext interface
is extended with a new method:
\begin{minted}{java}
/* Returns a behavior tree by name. */
public ModelTask getBT(String name);
\end{minted}
Given the name of the tree to retrieve, \textit{getBT()} returns the root of such tree. Note that users of the IContext interface do not care about where the trees it provides come from; it only cares about retrieving trees by name, which is exactly that the IContext interface exposes.
\section{Behaviour trees libraries}
Behaviour trees are identified by names that somehow summarize what they do. Take for example a character that is expected to behave aggressively. Such character could use a behaviour tree with name ``AggressiveBehaviour''.
In general, behaviour trees are identified by name, so there must be a way of retrieving behaviour trees given a name. This is what a behaviour tree library represents: a repository of trees that can be accessed.
In JBT, a behaviour trees library is represented by the \textit{IBTLibrary} interface. The IBTLibrary interface defines a single method that returns a tree with a given name. It is defined as follows:
\begin{minted}{java}
public interface IBTLibrary extends
Iterable<Pair<String, ModelTask>> {
/* Returns a behaviour tree given its name. */
public ModelTask getBT(String name);
}
\end{minted}
One important detail about the IBTLibrary is that it implements the \textit{Iterable} interface. By doing so, it allows its users to retrieve all the trees it contains. In particular, for each tree, it retrieves both the tree itself (the root ModelTask of the tree) and its name (as a String).
\section{Persistent tasks}
Some tasks in BTs are persistent in the sense that, after finishing, if they are spawned again, they remember past information. Take for example the Limit task. A Limit task allows to run its child node only a certain number of times (for example, 5). After being spawned, it has to remember how many times it has been run so far, so that, once the threshold is exceeded, it fails.
In the simple model of BT there is no problem about it, because nodes are objects that exist from the beginning to the end, so they can remember whatever information they want. However, in the model we propose, nodes (ExecutionTask objects) are destroyed once they finish (they leave the Tickable Nodes List and whatever other lists they may be in), so a new mechanism must be implemented for keeping past information.
We propose to use the BTExecutor with that purpose. For instance, if a Limit task needs to know that it has been run 3 times so far, just before being destroyed it may write into the BTExecutor that number (3). The next time it is spawned, it may read, from the BTExecutor, that information.
All the persistent information of a task is saved into a \textit{ITaskState} object. The ITaskState interface represents a collection of variables that can be accessed:
\begin{minted}{java}
public interface ITaskState {
/* Returns the value of a state variable by its name. */
public Object getStateVariable(String name);
}
\end{minted}
When the tasks needs to store its state for future use, it will have to create an ITaskState object containing all the information it wishes to keep. On the other hand, when the task needs to restore its previous state, it will receive an ITaskState object from which it will have to retrieve the needed information. We will see this in a moment, but first we have to address an important problem: who is in charge of storing the ITaskState objects of the tasks of a tree? Moreover, by what mechanism can we unambiguously assign an ITaskState to a node of the tree, so that the proper ITaskState object is delivered to the proper ExecutionTask? Both questions are in fact related.
An effective mechanism to assign ITaskState objects to tasks is by using the position of the task in the tree. Each ExecutionTask in the tree has got a position that is constant all over the execution of the tree, no matter how the tree evolves. Thanks to this we can assign ITaskState objects to positions in the tree; since a position in the tree corresponds to one, and only one ExecutionTask, such ITaskState will be that of the ExecutionTask pointed by the position.
The first question is a tricky one. Initially it could be thought that the context may be used; however, the fact that one context can also be used by guards (which are actually behaviour trees run each one by its own BTExecutor), makes it impossible to do so, because it could lead to clashes between positions of the main tree and those of the guards.
Once the context has been discarded, the only alternative left is the BTExecutor. The BTExecutor suffices for this task, since, among other things, it is shared by all the nodes of the tree except for those of guards' trees, thus avoiding position clashes.
As a result, the BTExecutor class is extended to support the storage of ITaskState objects:
\begin{minted}{java}
/*
* Sets the state of the task placed at a particular
* position in the tree.
*/
public boolean setTaskState(Position taskPosition,
ITaskState state);
/*
* Retrieves the state of the task placed at a particular
* position in the tree.
*/
public ITaskState getTaskState(Position taskPosition);
/*
* Clears the state of the task placed at a particular
* position in the tree.
*/
public boolean clearTaskState(Position taskPosition);
\end{minted}
In order to facilitate the persistence of tasks to the designer, we can modify both the \textit{spawn()} and \textit{tick()} method so that they automatize this process.
\begin{minted}{java}
public final void spawn(IContext context){
/*
* Store the context.
*/
this.context = context;
/* Set the current status of the task to Status.RUNNING. */
this.status = Status.RUNNING;
/*
* Request to be inserted into the list of open tasks.
*/
this.executor.requestInsertionIntoOpenList(this);
/* Restore the previous state. */
ITaskState previousState = this.executor.getTaskState();
restoreState(previousState);
/*
* Carry out the actual spawn.
*/
internalSpawn();
}
\end{minted}
Where it must be noted the new \textit{restoreState(ITaskState)} method. This is an abstract method that must be implemented by subclasses, and its purpose is to restore the state of an ExecutionTask given the set of persistent information (ITaskState object) that was previously issued by the task. For the major part of tasks, this method will do nothing, so it will have an empty implementation. However, for tasks such as Limit, it will retrieve past information from the ITaskState object to properly restore the task. If the ITaskState object is null, it means that there is no past information, so the method should do nothing. For instance, the very first time that a Limit task is spawned it cannot retrieve past information, so \textit{restoreState()} should do nothing.
The \textit{tick()} method should also be modified to automatically store into the BTExecutor the persistent state information that \textit{restoreStatus()} needs to restore the task:
\begin{minted}{java}
/* Tick. */
public Status tick(){
if(!this.terminated){
Status newStatus = internalTick();
this.currentStatus = newStatus;
if(this.currentStatus != RUNNING){
ITaskState taskState = storeState();
this.executor.setTaskState(getPosition(), taskState);
requestRemovalFromTickableList(this);
requestRemovalFromOpenList(this);
fireTaskEvent(newStatus);
}
return newStatus;
}
else{
return Status.TERMINATED;
}
}
\end{minted}
Also here must be noted the new abstract method \textit{storeState()}. This method is implemented by each subclass, and it returns an ITaskState object containing all the information that must be made persistent for future use. This method must issue an ITaskState object compatible with the \textit{restoreState()} method, so that the ITaskState objects that the former issues can be understood by the latter. If no persistent information had to be stored for the task, null should be returned.
The \textit{terminate()} method is also extended with a call to the \textit{storeTerminationState()}, which is a method equivalent to \textit{storeState()} but that is called only when the task is terminated.
In short, \textit{storeState()} creates an ITaskState object that contains all the persistent information that the task may want to use in the future. That information is read by the \textit{restoreState()} method.
\section{Native tasks}\label{sec:NativeTasks}
JBT offers a wide range of tasks that can be used to build behaviour trees. JBT basically implements the BT model described in \cite{Millington09}, but extended with guards.
JBT supports the following tasks:
\begin{itemize}
\item Composite tasks: tasks with one or more children, whose execution depends on the execution of their children. The task's children are ordered.
\begin{itemize}
\item Sequence: task that sequentially executes all its children in order. If one fails, the Sequence task fails. If all succeeds, the Sequence task succeeds.
\item Selector: task that sequentially executes all its children in order. If one succeeds, the Selector task succeeds. If all fail, the Selector task fails.
\item Parallel: task that concurrently executes all its children. A Parallel task does have a \textit{parallel policy}. If the parallel task's policy is \textit{sequence}, the parallel fails if one child fails; if all succeed, then the parallel succeed. If the parallel task's policy is \textit{selector}, the parallel fails if all its children fail. If one succeeds, then the parallel also succeeds.
\item Random Selector: task that executes all its children in a random order. If one fails, the Sequence task fails. If all succeeds, the Sequence task succeeds.
\item Random Sequence: task that sequentially executes all its children in random order. If one succeeds, the Selector task succeeds. If all fail, the Selector task fails.
\item Dynamic Priority List: task that executes the child with the highest priority whose guard is evaluated to true. At every AI cycle, the children's guards are re-evaluated, so if the guard of the running child is evaluated to false, it is terminated, and the child with the highest priority starts running. The Dynamic Priority List task finishes when no guard is evaluated to true (thus failing) or when its active child finishes (returning the active child's termination status).
\item Static Priority List: task that executes the child with the highest priority whose guard is evaluated to true. Unlike the Dynamic Priority List, the Static Priority List does not keep evaluating its children's guards once a child is spawned. The Static Priority List task finishes when no guard is evaluated to true (thus failing) or when its active child finishes (returning the active child's termination status).
\end{itemize}
\item Decorator tasks: tasks with one child whose purpose is to alter the way other tasks behave.
\begin{itemize}
\item Interrupter: task that controls the termination of its child task. An Interrupter simply lets its child task run normally. If the child returns a result, the Interrupter will return it. However, the Interrupter can be asked to terminate the child task and return an specified status when done so.
\item Inverter: task used to invert the status code returned by its child. When the decorated task finishes, its status code gets inverted.
\item Limit: task that limits the number of times a task can be executed. This decorator is used when a task (the child of the decorator) must be run a maximum number of times. When the maximum number of times is exceeded, the decorator will fail forever on.
\item Repeat: task that runs its child task forever. When its child task finishes, it runs it once more.
\item Until Fail: task that runs its child as long as it does not fail. When the child task fails, Until Fail succeeds.
\item Hierarchical Context Manager: task that creates a new context for its child. The context that it creates is a Hierarchical Context.
\item Safe Output Context Manager: task that creates a new context for its child. The context that it creates is a Safe Output Context.
\item Safe Context Manager: task that creates a new context for its child. The context that it creates is a Safe Context.
\end{itemize}
\item Leaf tasks: tasks with no children.
\begin{itemize}
\item Wait: task that keeps running for a period of time, and then succeeds. The user can specify for how long the Wait task should be running.
\item Subtree Lookup: the Subtree Lookup described in section \ref{sec:SubtreeLookupAndIContext}.
\item Perform Interruption: task that interrupts an Interrupter task.
\item Variable Renamer: task that renames a variable in the context.
\item Success: task that immediately succeeds.
\item Failure: task that immediately fails.
\item Action: generic action that is executed in the game engine.
\item Condition: generic condition that is executed in the game engine.
\end{itemize}
\end{itemize}
\section{Automatic behaviour trees generation}
So far, JBT offers the main classes for building and executing behaviour trees. The user needs to construct a ModelTask object representing the tree that he wants to run, and then create a BTExecutor to run it.
This philosophy of creating behaviour trees, however, lacks of reusability, and can be very time consuming.
First of all, the user must explicitly create the Java structure of all the behaviour trees, which can be very time consuming for very complex ones. It would be nice for the user to be able to define behaviour trees in a standard XML format that then may be directly translated into the corresponding JBT Java classes. By doing so, the user should not have to deal directly with the JBT Java classes, and as a result it would be much easier for him to define behaviour trees.
On the other hand, the user must create and implement all the classes that represent low level actions and conditions. These are classes that extend the \textit{ModelAction}, \textit{ExecutionAction}, \textit{ModelCondition} and \textit{ExecutionCondition} classes. To ease this task, the user may define actions and conditions in a standard XML format so that they may be directly translated into the corresponding JBT Java classes. However, since the way a low level action and condition works is not known by JBT, the programmer would still be in charge of defining their abstract methods so that JBT could run them as expected.
JBT offers two tools that do these two tasks.
\subsection{Low level actions and conditions generation}
JBT lets the user define, in a XML format, the set of actions and conditions that will be used to generate the skeleton of the corresponding JBT Java classes.
The XML format that JBT understand is an extension of that of Make Me Play Me (MMPM) domain files\footnote{MMPM does support several action parameter types; our extension just adds the type "OBJECT", which represents a generic Java Object.}. A MMPM domain file contains a set of actions, sensors, goals and entities. As far as JBT is concerned, it only needs the set of actions and sensors. For each action in the domain file, JBT is able to generate the corresponding ModelAction and ExecutionAction classes. Also, for each boolean sensor in the domain file, JBT is able to generate the corresponding ModelCondition and ExecutionCondition classes.
The generated ModelAction and ModelCondition classes are complete, so they do not need to be modified. However, the ExecutionAction and ExecutionCondition generated classes contain a set of abstract method that must be implemented according to the semantics of the respective actions and conditions, so that they do what they are expected to do.
In particular, the abstract methods that must be implemented are:
\begin{minted}{java}
protected void internalSpawn();
protected Status internalTick();
protected void internaTerminate();
protected void restoreState(ITaskState state);
protected ITaskState storeState();
protected ITaskState storeTerminationState();
\end{minted}
MMPM domain files also let the designer specify input parameters for actions and sensors. These are parameters that actions and sensors are supposed to use when running. The generated JBT ExecutionAction and ExecutionCondition classes include \textit{getter} methods for such input parameters. As a result, the programmer will be able to access the value of the input parameters in the abstract methods he has to implement, by using the getter methods. The value for the input parameters are either retrieved from the execution context(IContext) or directly provided at construction time, but these details are hidden from the programmer that implements the action or condition (he should just use the getter methods to retrieve whatever input parameters may be needed).
The class \textit{ActionsAndConditionsGenerator.java} implements the program that performs this generation process.
\subsection{Behaviour trees libraries generation}
JBT lets the user define behaviour trees in a standard XML format. Once he has defined several trees in different files, JBT can parse these files and produce a behaviour tree library class (class implementing the IBTLibrary interface) that the programmer can use to retrieve the corresponding behaviour trees and run them.
The class \textit{BTLibraryGenerator.java} implements the program the performs this generation process.
\subsubsection{Behaviour tree XML format}
In this section we explain the format the user must follow to define behaviour trees in XML files.
A behaviour tree has a root tag, $<Tree>$, within which all the tree is defined. The $<Tree>$ element has only one child, which is the root node of the tree.
\begin{minted}{xml}
<Tree>
<Node>
...
</Node>
</Tree>
\end{minted}
A $<Node>$ has three attributes, an "id", a "name" and a "type". "id" and "type" are mandatory for all nodes. "name", however, is not. There cannot be two nodes with the same "id" in the same tree\footnote{This is not totally true. Guards are an exception. Keep reading for a further explanation.}. The root node of the tree has type "Root". For instance:
\begin{minted}{xml}
<Tree>
<Node id="Node_0" name="MyRoot" type="Root">
...
</Node>
</Tree>
\end{minted}
A $<Node>$ has three types of child element. One of them is the $<Children>$ element, which stores the list of children of the node. $<Children>$ just contains a sequence of $<Node>$ elements. For instance:
\begin{minted}{xml}
<Tree>
<Node id="Node_0" name="MyRoot" type="Root">
<Children>
<Node>
...
</Node>
<Node>
...
</Node>
...
</Children>
</Node>
</Tree>
\end{minted}
Leaf tasks of the tree do not have any child task, so $<Children>$ is not use there.
The second type of child of $<Node>$ is the $<Paramenters>$ element. $<Paramenters>$ just stores the list of parameters of the task, as well as their value. Each parameter "name" and its value is stored in a $<Paramenter>$ element. For instance, this is the set of parameters of a particular task:
\begin{minted}{xml}
<Parameters>
<Parameter name="preFailureTime" fromcontext="false">34</Parameter>
<Parameter name="failureTime" fromcontext="false">434</Parameter>
<Parameter name="target" fromcontext="false">HydraliskID</Parameter>
</Parameters>
\end{minted}
Where we can see three parameters, "preFailureTime", "failureTime" and "target" and their corresponding values, "34", "434" and "HydraliskID".
A $<Parameter>$ element also has an attribute, "fromcontext", that can be either "true" or "false". If "false", the value of the parameter is read directly from the $<Parameter>$ element. If "true", the value in the $<Parameter>$ element represents the location, in the context, where the value of the parameter can be found.
For instance, a parameter like this:
\begin{minted}{xml}
<Parameter name="preFailureTime" fromcontext="false">34</Parameter>
\end{minted}
means that the value of the parameter "preFailureTime" is 34, while this:
\begin{minted}{xml}
<Parameter name="preFailureTime" fromcontext="true">
preFailureTimeLocation</Parameter>
\end{minted}
means that the value of the parameter "preFailureTime" can be found in the context, in the place referenced by the string "preFailureTimeLocation".
Among other things, the "fromcontext" attribute determines the way that the getter methods of the automatically generated low level actions and conditions behave. If "true", the getter method will retrieve the parameter from the context (\textit{IContext}). Otherwise, its value will be known in advance, so it will be easily retrieved.
The $<Parameters>$ child of $<Node>$ is optional, depending on whether the respective task does or does not have parameters. For instance, a Sequence node does not have parameters, but a Wait node does.
The third type of child of $<Node>$ is the $<Guard>$ element. A $<Guard>$ only contains one $<Node>$ element, which represents the guard. A $<Node>$ may have no guard, in which case the $<Guard>$ element is not used.
With respect to guards, there is an important detail about their identifiers that must be noted. In general, there cannot be two different nodes with the same ID in the same tree. However, guards are an exception. Guards are actually considered independent trees, so the ID of a guard's node can match the ID of a node of the tree that contains the guard. For instance, if a tree $A$ has a node with ID $ID\_1$, a node of a guard of an $A$'s node may have $ID\_1$ as ID, and there would be no conflict at all, since $A$ and any of $A$'s guards are considered to be independent trees.
This somehow restricts the way that nodes can interact with each other. For instance, if a node in $A$ refers to a node with ID $ID\_23$, the node with $ID\_23$ must be placed in $A$ and not in any of the guards that the nodes of $A$ may have. The Perform Interruption is a good example of this, since it has a parameter that stores the ID of the node that it has to interrupt. This restriction may be fixed in the future.
There are several standard types of node that are used when building a behaviour tree (one for each native task supported by JBT -see section \ref{sec:NativeTasks}-). These nodes have a fixed syntax and well established semantics. They are:
\begin{itemize}
\item Sequence:
\begin{itemize}
\item "type" attribute has value "Sequence".
\item It does not have parameters.
\item It does have children.
\end{itemize}
\item Selector:
\begin{itemize}
\item "type" attribute has value "Selector".
\item It does not have parameters.
\item It does have children.
\end{itemize}
\item Random Sequence:
\begin{itemize}
\item "type" attribute has value "RandomSequence".
\item It does not have parameters.
\item It does have children.
\end{itemize}
\item Random Selector:
\begin{itemize}
\item "type" attribute has value "RandomSelector".
\item It does not have parameters.
\item It does have children.
\end{itemize}
\item Parallel:
\begin{itemize}
\item "type" attribute has value "Parallel".
\item It does have one parameter, named "policy", whose value may be either "selector" or "sequence". Its value cannot be retrieved from the context. For instance:
\begin{minted}{xml}
<Node id="Node_XXX" type="Parallel">
<Parameters>
<Parameter name="policy" fromcontext="false">
selector</Parameter>
</Parameters>
<Children>
...
</Children>
</Node>
\end{minted}
\item It does have children.
\end{itemize}
\item Dynamic Priority List:
\begin{itemize}
\item "type" attribute has value "DynamicPriorityList".
\item It does not have parameters.
\item It does have children.
\end{itemize}
\item Static Priority List:
\begin{itemize}
\item "type" attribute has value "StaticPriorityList".
\item It does not have parameters.
\item It does have children.
\end{itemize}
\item Hierarchical Context Manager:
\begin{itemize}
\item "type" attribute has value "HierarchicalContextManager".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Safe Output Context Manager:
\begin{itemize}
\item "type" attribute has value "SafeOutputContextManager".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Safe Context Manager:
\begin{itemize}
\item "type" attribute has value "SafeContextManager".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Interrupter:
\begin{itemize}
\item "type" attribute has value "Interrupter".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Inverter:
\begin{itemize}
\item "type" attribute has value "Inverter".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Limit:
\begin{itemize}
\item "type" attribute has value "Limit".
\item It does have one parameter, named "runs", whose value can be any integer greater than 0. Its value cannot be retrieved from the context:
\begin{minted}{xml}
<Node id="Node_XXX" type="Limit">
<Parameters>
<Parameter name="runs" fromcontext="false">12</Parameter>
</Parameters>
<Children>
...
</Children>
</Node>
\end{minted}
\item It does have one child.
\end{itemize}
\item Repeat:
\begin{itemize}
\item "type" attribute has value "Repeat".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Until Fail:
\begin{itemize}
\item "type" attribute has value "UntilFail".
\item It does not have parameters.
\item It does have one child.
\end{itemize}
\item Perform Interruption:
\begin{itemize}
\item "type" attribute has value "PerformInterruption".
\item It does have two parameters:
\begin{itemize}
\item One is named "expectedresult", and its value can be either "success" or "failure". Its value cannot be retrieved from the context.
\item The other one's name is "nodeid", and its value must be the identifier of a node in the tree. Its value cannot be retrieved from the context.
\begin{minted}{xml}
<Node id="Node_XXX" type="PerformInterruption">
<Parameters>
<Parameter name="expectedresult" fromcontext="false">
failure</Parameter>
<Parameter name="nodeid" fromcontext="false">
NODE_YYY</Parameter>
</Parameters>
</Node>
\end{minted}
\end{itemize}
\item It does not have any children.
\end{itemize}
\item Subtree Lookup:
\begin{itemize}
\item "type" attribute has value "SubtreeLookup".
\item It does have one parameter, named "subtreename", whose value is any string. Its value cannot be retrieved from the context:
\begin{minted}{xml}
<Node id="Node_XXX" type="SubtreeLookup">
<Parameters>
<Parameter name="subtreename" fromcontext="false">
MoveTo</Parameter>
</Parameters>
<Children>
...
</Children>
</Node>
\end{minted}
\item It does not have any children.
\end{itemize}
\item Wait:
\begin{itemize}
\item "type" attribute has value "Wait".
\item It does have one parameter, named "duration", whose value must be an integer greater or equal than 0. Its value cannot be retrieved from the context:
\begin{minted}{xml}
<Node id="Node_XXX" type="Wait">
<Parameters>
<Parameter name="duration" fromcontext="false">
1500</Parameter>
</Parameters>
</Node>
\end{minted}
\item It does not have any children.
\end{itemize}
\item Variable Renamer:
\begin{itemize}
\item "type" attribute has value "VariableRenamer".
\item It does have two parameters:
\begin{itemize}
\item One is named "variableName", whose value must be a string. Its value cannot be retrieved from the context.
\item The other one's name is "newVariableName", and its value is a string. Its value cannot be retrieved from the context.
\begin{minted}{xml}
<Node id="Node_XXX" type="VariableRenamer">
<Parameters>
<Parameter name="variableName" fromcontext="false">
VariableToRename</Parameter>
<Parameter name="newVariableName" fromcontext="false">
NewName</Parameter>
</Parameters>
</Node>
\end{minted}
\end{itemize}
\item It does not have any children.
\end{itemize}
\item Success:
\begin{itemize}
\item "type" attribute has value "Success".
\item It does not have parameters.
\item It does not have any children.
\end{itemize}
\item Failure:
\begin{itemize}
\item "type" attribute has value "Failure".
\item It does not have parameters.
\item It does not have any children.
\end{itemize}
\end{itemize}
With respect to low level actions and conditions, they are represented by $<Node>$ elements whose "type" attribute is "Action" and "Condition" respectively, and whose parameter "name" specifies the concrete type of action and condition.
\subsection{JBT Editor}
Even though JBT is able to parse behaviour trees in the XML format defined above and generate the corresponding Java classes that can be run, for the user it is still a complicated task to define complex behaviour trees in such a format.
JBT provides the \textit{JBT Editor} (see a screenshot in figure \ref{fig:JBTEditor}), a program that can be used to define behaviour trees through a graphical user interface in a very user-friendly way. These behaviour trees can be then exported into the XML format defined above, so that they can be parsed by JBT to create the corresponding behaviour trees libraries. By using the JBT Editor, the user does not have to deal with XML files directly; also, it checks the correctness of the trees, so whatever trees are stored into XML files, they are correct and can be parsed by JBT with no problems. JBT also lets the user load MMPM domain files and use its actions and conditions in the trees the user creates, as well as specify values for their input parameters and check their correctness.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{./Images/JBTEditor.png}
% JBTEditor.png: 1365x730 pixel, 72dpi, 48.15x25.75 cm, bb=
\caption{JBT Editor}
\label{fig:JBTEditor}
\end{figure}
\bibliographystyle{plain}
\bibliography{JBTBib}
\end{document}
================================================
FILE: Documentation/JBTBib.bib
================================================
@Book{Millington09,
author = {Ian Millington and John Funge},
title = {Artificial Intelligence for Games},
publisher = {Morgan Kaufmann},
year = {2009},
edition = {Second}
}
@misc{AIGameDev,
author = {Alex J. Champandard},
title = {http://aigamedev.com}
}
================================================
FILE: JBTCore/.classpath
================================================
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="libs/jdom.jar" sourcepath="libs/jdomsrc.zip"/>
<classpathentry kind="lib" path="libs/jargs.jar"/>
<classpathentry kind="lib" path="libs/sourceformatter.jar"/>
<classpathentry kind="lib" path="libs/mmpm.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
================================================
FILE: JBTCore/.gitignore
================================================
/bin
================================================
FILE: JBTCore/.project
================================================
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JBT</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
================================================
FILE: JBTCore/src/jbt/exception/IllegalReturnStatusException.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.exception;
import jbt.execution.core.ExecutionTask;
/**
* Exception thrown when {@link ExecutionTask#internalTick()} returns a Status
* that is not allowed.
*
* @author Ricardo Juan Palma Durán
*
*/
public class IllegalReturnStatusException extends TickException {
private static final long serialVersionUID = 1L;
public IllegalReturnStatusException(){
super();
}
public IllegalReturnStatusException(String msg){
super(msg);
}
}
================================================
FILE: JBTCore/src/jbt/exception/NotTickableException.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.exception;
/**
* Exception thrown when a task that cannot be ticked is ticked.
*
* @author Ricardo Juan Palma Durán
*
*/
public class NotTickableException extends TickException {
private static final long serialVersionUID = 1L;
public NotTickableException(){
super();
}
public NotTickableException(String msg){
super(msg);
}
}
================================================
FILE: JBTCore/src/jbt/exception/SpawnException.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.exception;
/**
* Exception thrown when a task that cannot be spawned is spawned.
*
* @author Ricardo Juan Palma Durán
*
*/
public class SpawnException extends RuntimeException {
private static final long serialVersionUID = 1L;
public SpawnException() {
super();
}
public SpawnException(String msg) {
super(msg);
}
}
================================================
FILE: JBTCore/src/jbt/exception/TickException.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.exception;
/**
* Exception thrown when there is an error in the ticking process of a task.
*
* @author Ricardo Juan Palma Durán
*
*/
public abstract class TickException extends RuntimeException {
private static final long serialVersionUID = 1L;
public TickException() {
super();
}
public TickException(String msg) {
super(msg);
}
}
================================================
FILE: JBTCore/src/jbt/execution/context/BasicContext.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.context;
import java.util.Hashtable;
import java.util.Map;
import jbt.execution.core.IBTLibrary;
import jbt.execution.core.IContext;
import jbt.model.core.ModelTask;
/**
* Basic implementation of the IContext interface. This class uses a Hashtable
* to store the set of variables.
* <p>
* Also, since a context must contain a set of behaviour trees, this class
* defines some methods to add behaviour trees to the context.
*
* @author Ricardo Juan Palma Durán
*
*/
public class BasicContext implements IContext {
/**
* The set of variables that the context consists of.
*/
private Map<String, Object> variables;
/**
* The BT library that is internally used to manage all the trees of the
* context.
*/
private GenericBTLibrary library;
/**
* Default constructor. Constructs an empty BasicContext.
*/
public BasicContext() {
this.variables = new Hashtable<String, Object>();
this.library = new GenericBTLibrary();
}
/**
*
* @see es.ucm.bt.core.IContext#getVariable(java.lang.String)
*/
public Object getVariable(String name) {
return this.variables.get(name);
}
/**
*
* @see es.ucm.bt.core.IContext#setVariable(java.lang.String,
* java.lang.Object)
*/
public boolean setVariable(String name, Object value) {
if (value == null) {
return this.variables.remove(name) == null ? false : true;
}
return this.variables.put(name, value) == null ? false : true;
}
/**
*
* @see es.ucm.bt.core.IContext#clear()
*/
public void clear() {
this.variables.clear();
}
/**
*
* @see jbt.execution.core.IContext#clearVariable(java.lang.String)
*/
public boolean clearVariable(String name) {
return this.variables.remove(name) == null ? false : true;
}
/**
* Adds all the behaviour trees in <code>library</code> to the set of
* behaviour trees stored in the context. If there is already a tree with
* the same name as that of one of the trees in <code>library</code>, it is
* overwritten.
*
* @param library
* the library containing all the behaviour trees to add to this
* context.
* @return true if a previously stored behaviour tree has been overwritten,
* and false otherwise.
*/
public boolean addBTLibrary(IBTLibrary library) {
return this.library.addBTLibrary(library);
}
/**
* Adds the behaviour tree <code>tree</code> to the set of behaviour trees
* stored in the context. If there is already a tree with the name
* <code>name</code>, then it is overwritten by <code>tree</code>.
*
* @param name
* the name that will identify the tree <code>tree</code> in the
* context.
* @param tree
* the tree to insert.
* @return true if there was already a tree with name <code>name</code>, and
* false otherwise.
*/
public boolean addBT(String name, ModelTask tree) {
return this.library.addBT(name, tree);
}
/**
*
* @see jbt.execution.core.IContext#getBT(java.lang.String)
*/
public ModelTask getBT(String name) {
return this.library.getBT(name);
}
}
================================================
FILE: JBTCore/src/jbt/execution/context/GenericBTLibrary.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.context;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map.Entry;
import jbt.execution.core.IBTLibrary;
import jbt.model.core.ModelTask;
import jbt.util.Pair;
/**
* Simple implementation of the {@link IBTLibrary} interface, which internally
* uses a Hashtable to map tree names to actual trees. This class also defines
* methods for adding behaviour trees to the library itself.
*
* @author Ricardo Juan Palma Durán
*
*/
public class GenericBTLibrary implements IBTLibrary {
/**
* The hashtable that stores all the trees of the library.
*/
private Hashtable<String, ModelTask> trees;
/**
* Constructs a GenericBTLibrary containing no trees.
*/
public GenericBTLibrary() {
this.trees = new Hashtable<String, ModelTask>();
}
/**
*
* @see jbt.execution.core.IBTLibrary#getBT(java.lang.String)
*/
public ModelTask getBT(String name) {
return this.trees.get(name);
}
/**
* Returns a read-only iterator through the behaviour trees of the library.
* While this iterator is being used, the library cannot be modified.
* Otherwise, the results are undefined. Note that both trees and their
* names can be accessed through this iterator.
*
* @see java.lang.Iterable#iterator()
*/
public Iterator<Pair<String, ModelTask>> iterator() {
return new GenericBTLibraryIterator();
}
/**
* Adds all the behaviour trees in <code>library</code> to the set of
* behaviour trees stored in this library. If there is already a tree with
* the same name as that of one of the trees in <code>library</code>, it is
* overwritten.
*
* @param library
* the library containing all the behaviour trees to add to this
* library.
* @return true if a previously stored behaviour tree has been overwritten,
* and false otherwise.
*/
public boolean addBTLibrary(IBTLibrary library) {
boolean overwritten = false;
for (Pair<String, ModelTask> tree : library) {
if (this.trees.put(tree.getFirst(), tree.getSecond()) != null) {
overwritten = true;
}
}
return overwritten;
}
/**
* Adds the behaviour tree <code>tree</code> to the set of behaviour trees
* stored in this library. If there is already a tree with the name
* <code>name</code>, then it is overwritten by <code>tree</code>.
*
* @param name
* the name that will identify the tree <code>tree</code> in the
* library.
* @param tree
* the tree to insert.
* @return true if there was already a tree with name <code>name</code>, and
* false otherwise.
*/
public boolean addBT(String name, ModelTask tree) {
if (this.trees.put(name, tree) != null) {
return true;
}
else {
return false;
}
}
/**
* Implementation of the iterator that GenericBTLibrary uses. This is a
* read-only iterator (removal is not supported), and it internally uses an
* iterator through the entry set of the hashtable.
*
* @author Ricardo Juan Palma Durán
*
*/
private class GenericBTLibraryIterator implements Iterator<Pair<String, ModelTask>> {
private Iterator<Entry<String, ModelTask>> internalIterator;
public GenericBTLibraryIterator() {
this.internalIterator = trees.entrySet().iterator();
}
public boolean hasNext() {
return this.internalIterator.hasNext();
}
public Pair<String, ModelTask> next() {
Entry<String, ModelTask> next = this.internalIterator.next();
return new Pair<String, ModelTask>(next.getKey(), next.getValue());
}
public void remove() {
throw new UnsupportedOperationException(
"This iterator cannot be used to remove elements");
}
}
}
================================================
FILE: JBTCore/src/jbt/execution/context/HierarchicalContext.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.context;
import jbt.execution.core.IContext;
/**
* A HierarchicalContext is a context that stores a parent IContext to fall back
* to when it cannot find a particular variable in its own set of variables.
* This class just redefines the method {@link #getVariable(String)} so that if
* the variable name cannot be found, its value is retrieved from the parent
* context.
*
* @author Ricardo Juan Palma Durán
*
*/
public class HierarchicalContext extends BasicContext {
/**
* The parent context. When a variable cannot be retrieved from the current
* context, it will be looked up in the parent context.
*/
private IContext parent;
/**
* Default constructor. Builds an empty HierarchicalContext, with no parent
* context.
*/
public HierarchicalContext() {
super();
}
/**
* Sets the parent context of this HierarchicalContext. May be null, in
* which case no parent context will be used.
*
* @param parent
* the parent context, which may be null.
*/
public void setParent(IContext parent) {
this.parent = parent;
}
/**
* Returns the value of a variable whose name is <code>name</code>. If a
* variable with such a name cannot be found in the current context, and
* there is a parent context set, the variable will be looked up in the
* parent context, and its value returned. If it cannot be found in the
* parent context (or in any other parent contexts through recursion), null
* is returned.
*
* @see es.ucm.bt.context.BasicContext#getVariable(java.lang.String)
*/
public Object getVariable(String name) {
Object result;
result = super.getVariable(name);
if (result == null) {
if (this.parent != null) {
result = this.parent.getVariable(name);
}
}
return result;
}
}
================================================
FILE: JBTCore/src/jbt/execution/context/SafeContext.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.context;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
import jbt.execution.core.IContext;
import jbt.model.core.ModelTask;
/**
* The SafeContext represents a context that can be used to safely controls
* modifications in another context (the <i>input context</i>).
* <p>
* A SafeContext contains an IContext (the <i>input context</i>). Initially, all
* variables are read form the input context. However, when a variable is set or
* cleared, its value is not modified in the input context, but it is locally
* modified instead. From then on, the variable will be locally read instead of
* reading if from the input context. Thus, the input context is never modified.
* <p>
* SafeContext can be used to situations in which an entity should use another
* context (the input context) in read-only mode. If such entity uses a
* SafeContext, it will not modify the input context, but on the other hand will
* interact with the SafeContext in just the same way it would with the input
* context.
*
* @author Ricardo Juan Palma Durán
*
*/
public class SafeContext implements IContext {
/**
* The original input context which the SafeOutputContext is based on.
*/
private IContext inputContext;
/**
* Flag that tells whether the SafeOutputContext has been cleared.
*/
private boolean cleared;
/**
* The set of local variables managed by the SafeOutputContext.
*/
private Map<String, Object> localVariables;
/**
* Set containing the names of those variables whose value has been set or
* cleared by the SafeOutputContext.
*/
private Set<String> localModifiedVariables;
/**
* Constructs a SafeContext whose input context is <code>inputContext</code>
* .
*
* @param inputContext
* the input context.
*/
public SafeContext(IContext inputContext) {
this.inputContext = inputContext;
this.localVariables = new Hashtable<String, Object>();
this.cleared = false;
this.localModifiedVariables = new HashSet<String>();
}
/**
* Retrieves the value of a variable.If the variable has not been modified
* by the SafeContext, its value is retrieved from the input context.
* However, if the variable has been modified (either cleared or set), the
* value will be retrieved from the SafeContext.
*
* @param name
* the name of the variable to retrieve.
*
* @return the value of a variable whose name is <code>name</code>, or null
* if it does not exist.
*
* @see jbt.execution.core.IContext#getVariable(java.lang.String)
*/
public Object getVariable(String name) {
if (this.localModifiedVariables.contains(name) || this.cleared) {
return this.localVariables.get(name);
} else {
Object variable = this.localVariables.get(name);
if (variable != null) {
return variable;
} else {
return this.inputContext.getVariable(name);
}
}
}
/**
* Sets the value of a variable. Its value is not written into the input
* context. Instead, its value is stored into a local variable managed by
* the SafeContext.
*
* @param name
* the name of the variable.
* @param value
* the value for the variable.
* @return true if a variable with the same name already existed, and false
* otherwise.
*
* @see jbt.execution.core.IContext#setVariable(java.lang.String,
* java.lang.Object)
*/
public boolean setVariable(String name, Object value) {
if (!this.localModifiedVariables.contains(name)) {
this.localModifiedVariables.add(name);
}
if (value == null) {
return this.localVariables.remove(name) == null ? false : true;
}
return this.localVariables.put(name, value) == null ? false : true;
}
/**
* Clears the context. Variables are not removed from the input context, but
* from the set of local variables managed by the SafeContext.
*
* @see jbt.execution.core.IContext#clear()
*/
public void clear() {
this.localVariables.clear();
this.cleared = true;
}
/**
* Clears a variable of the context. If it not removed from the input
* context, but from the set of local variables managed by the SafeContext.
*
* @param name
* the name of the variable to clear.
* @return true if a variable was actually cleared, and false in case it did
* not exist.
*
* @see jbt.execution.core.IContext#clearVariable(java.lang.String)
*/
public boolean clearVariable(String name) {
if (!this.localModifiedVariables.contains(name)) {
this.localModifiedVariables.add(name);
}
return this.localVariables.remove(name) == null ? false : true;
}
/**
* Returns the behaviour tree of a particular name, or null in case it
* cannot be found. The behaviour tree is extracted from the input context
* passed at construction time.
*
* @param the
* name of the behaviour tree to retrieve.
* @return the behaviour tree, or null if it cannot be found.
*
* @see jbt.execution.core.IContext#getBT(java.lang.String)
*/
public ModelTask getBT(String name) {
return this.inputContext.getBT(name);
}
}
================================================
FILE: JBTCore/src/jbt/execution/context/SafeOutputContext.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.context;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import jbt.execution.core.IContext;
import jbt.model.core.ModelTask;
/**
* The SafeOutputContext represents a context that can be used to safely
* controls modifications in another context (the <i>input context</i>).
* <p>
* A SafeOutputContext contains an IContext (the <i>input context</i>), and a
* list of <i>output variables</i>. These are the variables that can be written
* into the input context. The rest of variables are stored locally in the
* SafeOutputContext.
* <p>
* Thus, when the SafeOutputContext sets the value of a variable, it will
* normally set its value in a local variable. However, if the variable is one
* of the list of output variables, the value will be set in the input context.
* <p>
* When retrieving variables, a variable in the list of output variables will
* always be retrieved from the input context. A variable that is not in the
* list of output variables will also be retrieved from the input context;
* however, when such variable is modified (either its value is changed or
* cleared), the value will be retrieved from the SafeOutputContext (that is,
* from the moment a variable that is not in the list of output variables is
* modified, it is managed locally).
* <p>
* With respect to clearing variables, output variables are always cleared in
* the input context. However, since only output variables can be modified in
* the input context, any other variable will be cleared in the
* SafeOutputContext.
* <p>
* The SafeOutputContext can be used in situations where an entity must use a
* context (the input context) in a soft-read-only mode. By using the
* SafeOutputContext, such entity will only be able to modify the output
* variables in the input context. On the other hand, it will interact with the
* SafeOutputContext in just the same way it would with the input context.
*
* @author Ricardo Juan Palma Durán
*
*/
public class SafeOutputContext implements IContext {
/**
* The original input context which the SafeOutputContext is based on.
*/
private IContext inputContext;
/**
* The list of output variables. These variables can be written into the
* {@link #inputContext}, unlike the rest, that are stored in
* {@link #localVariables}.
*/
private List<String> outputVariables;
/**
* Set containing the names of those non-output variables whose value has
* been set or cleared by the SafeOutputContext.
*/
private Set<String> localModifiedVariables;
/**
* Flag that tells whether the SafeOutputContext has been cleared.
*/
private boolean cleared;
/**
* The set of local variables managed by the SafeOutputContext.
*/
private Map<String, Object> localVariables;
/**
* Constructs a SafeOutputContext whose input context is
* <code>inputContext</code> and whose list of output variables is
* <code>outputVariables</code>.
*
* @param inputContext
* the input context.
* @param outputVariables
* the list of output variables.
*/
public SafeOutputContext(IContext inputContext, List<String> outputVariables) {
this.inputContext = inputContext;
this.outputVariables = outputVariables;
this.localVariables = new Hashtable<String, Object>();
this.localModifiedVariables = new HashSet<String>();
this.cleared = false;
}
/**
* Retrieves the value of a variable. If it is an output variable, its value
* is retrieved from the input context. Otherwise, if the variable has not
* been modified by the SafeOutputContext, its value is also retrieved from
* the input context. However, if the variable has been modified (either
* cleared or set), the value will be retrieved from the SafeOutputContext.
*
* @param name
* the name of the variable to retrieve.
*
* @return the value of a variable whose name is <code>name</code>, or null
* if it does not exist.
*
* @see jbt.execution.core.IContext#getVariable(java.lang.String)
*/
public Object getVariable(String name) {
if (this.outputVariables.contains(name)) {
return this.inputContext.getVariable(name);
} else {
if (this.localModifiedVariables.contains(name) || this.cleared) {
return this.localVariables.get(name);
} else {
Object variable = this.localVariables.get(name);
if (variable != null) {
return variable;
} else {
return this.inputContext.getVariable(name);
}
}
}
}
/**
* Sets the value of a variable. If it is an output variable, its value is
* written into the input context. Otherwise, its value will be stored into
* a local variable managed by the SafeOutputContext.
*
* @param name
* the name of the variable.
* @param value
* the value for the variable.
* @return true if a variable with the same name already existed, and false
* otherwise.
*
* @see jbt.execution.core.IContext#setVariable(java.lang.String,
* java.lang.Object)
*/
public boolean setVariable(String name, Object value) {
if (this.outputVariables.contains(name)) {
return this.inputContext.setVariable(name, value);
} else {
if (!this.localModifiedVariables.contains(name)) {
this.localModifiedVariables.add(name);
}
if (value == null) {
return this.localVariables.remove(name) == null ? false : true;
}
return this.localVariables.put(name, value) == null ? false : true;
}
}
/**
* Clears the context. Output variables are cleared in the input context.
* The rest are removed from the set of local variables managed by the
* SafeOutputContext.
*
* @see jbt.execution.core.IContext#clear()
*/
public void clear() {
this.localVariables.clear();
for (String outputVariable : this.outputVariables) {
this.inputContext.clearVariable(outputVariable);
}
this.cleared = true;
}
/**
* Clears a variable of the context. If it is an output variable, the value
* is cleared in the input context. Otherwise, the variable is removed from
* the set of local variables managed by the SafeOutputContext.
*
* @param name
* the name of the variable to clear.
* @return true if a variable was actually cleared, and false in case it did
* not exist.
*
* @see jbt.execution.core.IContext#clearVariable(java.lang.String)
*/
public boolean clearVariable(String name) {
if (this.outputVariables.contains(name)) {
return this.inputContext.clearVariable(name);
} else {
if (!this.localModifiedVariables.contains(name)) {
this.localModifiedVariables.add(name);
}
return this.localVariables.remove(name) == null ? false : true;
}
}
/**
* Returns the behaviour tree of a particular name, or null in case it
* cannot be found. The behaviour tree is extracted from the input context
* passed at construction time.
*
* @param the
* name of the behaviour tree to retrieve.
* @return the behaviour tree, or null if it cannot be found.
*
* @see jbt.execution.core.IContext#getBT(java.lang.String)
*/
public ModelTask getBT(String name) {
return this.inputContext.getBT(name);
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/BTExecutor.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import jbt.execution.context.BasicContext;
import jbt.execution.core.ExecutionTask.Status;
import jbt.execution.task.decorator.ExecutionInterrupter;
import jbt.model.core.ModelTask;
import jbt.model.core.ModelTask.Position;
import jbt.model.task.decorator.ModelInterrupter;
/**
* BTExecutor is the implementation of the IBTExecutor interface.
* <p>
* BTs are conceptually modeled by a hierarchy of interconnected ModelTask objects. A BT is
* represented by the root of the tree, which is a single ModelTask object.
* <p>
* Therefore, in order to run a BT, a BTExecutor only needs the root task of the tree (a ModelTask
* object), and the context (IContext) that will be used by the tree. Keep in mind that a BT is
* executed within a context that contains information about the game that leaf tasks (actions and
* conditions) and guards (ModelTask) may need in order to run.
* <p>
* The internal implementation of the BTExecutor is based on using, for each ModelTask of the BT, an
* ExecutionTask obtained by calling the {@link ModelTask#createExecutor(BTExecutor, ExecutionTask)}
* method. The most important feature of the BTExecutor, however, is that it uses a list of
* <i>tickable</i> nodes. When {@link #tick()} is called, not all the nodes of the tree are ticked,
* but only those that are currently relevant to the execution of the tree. By doing so, running the
* tree is a much more efficient process, since only the nodes that can make the tree evolve receive
* CPU time.
* <p>
* The BTExecutor is also in charge of storing the permanent state of tasks (see {@link ITaskState}
* and {@link ExecutionTask#storeState()}). For each BT there is only one BTExecutor that actually
* runs it. Therefore, the BTExecutor can be used as the repository for storing the state of the
* tasks of the tree.
*
* @see ModelTask
* @see ExecutionTask
*
* @author Ricardo Juan Palma Durán
*
*/
public class BTExecutor implements IBTExecutor {
/** The root task of the BT this executor is running. */
private ModelTask modelBT;
/** The ExecutionTask associated to the root ModelTask. */
private ExecutionTask executionBT;
/** List of tickable tasks. */
private List<ExecutionTask> tickableTasks;
/** List of open tasks. */
private List<ExecutionTask> openTasks;
/** The context that will be passed to the root task. */
private IContext context;
/**
* Boolean telling whether this BTExecutor has been ticked ( {@link #tick()} ) before.
*/
private boolean firstTimeTicked = true;
/**
* List of the tasks that must be inserted into the list of tickable nodes.
*/
private List<ExecutionTask> currentTickableInsertions;
/**
* List of the tasks that must be removed from the list of tickable nodes.
*/
/*
* TODO: improve the way requests for insertions and removals are handled. Currently simple
* Lists are used to manage them, but in case there were many requests, this process would not
* be very efficient.
*/
private List<ExecutionTask> currentTickableRemovals;
/**
* List of the tasks that must be inserted into the list of open nodes.
*/
private List<ExecutionTask> currentOpenInsertions;
/**
* List of the tasks that must be removed from the list of open nodes.
*/
private List<ExecutionTask> currentOpenRemovals;
/**
* List of all the ExecutionInterrupter currently active in the behaviour tree. They are indexed
* by their ModelInterrupter in the conceptual tree.
* <p>
* This list is used by ExecutionPerformInterruption, which must have a way of knowing what
* ExecutionInterrupter it is interrupting.
*/
private Map<ModelInterrupter, ExecutionInterrupter> interrupters;
/**
* States of the tasks of the tree that is being run by this BTExecutor. States are indexed by
* Position. These are the positions of the ExecutionTask in the execution tree. These positions
* are unique (they do not necessarily match the position of the corresponding ModelTask), so
* each node in the execution tree can be unambiguously referenced by such position. Note that
* this Map does not store the states of the nodes of the guards of the tree that is being run.
*/
private Map<Position, ITaskState> tasksStates;
/**
* Creates a BTExecutor that handles the execution of a behaviour tree. The behaviour tree is
* represented by a ModelTask (the root of the tree).
* <p>
* A context for the tree must be provided. This context is passed to the root of the tree, and,
* in general, it will be shared by all the nodes in the tree (it will be passed down the
* hierarchy of the tree). Note however that, depending on the semantics of the tree itself,
* some nodes may not use this context.
*
* @param modelBT
* the root of the behaviour tree to run.
* @param context
* the initial context for the tree.
*/
public BTExecutor(ModelTask modelBT, IContext context) {
if (modelBT == null) {
throw new IllegalArgumentException("The input ModelTask cannot be null");
}
if (context == null) {
throw new IllegalArgumentException("The input IContext cannot be null");
}
this.modelBT = modelBT;
this.modelBT.computePositions();
this.context = context;
this.tickableTasks = new LinkedList<ExecutionTask>();
this.openTasks = new LinkedList<ExecutionTask>();
this.currentOpenInsertions = new LinkedList<ExecutionTask>();
this.currentOpenRemovals = new LinkedList<ExecutionTask>();
this.currentTickableInsertions = new LinkedList<ExecutionTask>();
this.currentTickableRemovals = new LinkedList<ExecutionTask>();
this.interrupters = new Hashtable<ModelInterrupter, ExecutionInterrupter>();
this.tasksStates = new Hashtable<ModelTask.Position, ITaskState>();
}
/**
* Creates a BTExecutor that handles the execution of a behaviour tree. The behaviour tree is
* represented by a ModelTask (the root of the tree).
* <p>
* A new empty context for the tree is created. This context is passed to the root of the tree,
* and, in general, it will be shared by all the nodes in the tree (it will be passed down the
* hierarchy of the tree). Note however that, depending on the semantics of the tree itself,
* some nodes may not use the context context.
*
* @param modelBT
* the root of the behaviour tree to run.
*/
public BTExecutor(ModelTask modelBT) {
if (modelBT == null) {
throw new IllegalArgumentException("The input ModelTask cannot be null");
}
this.modelBT = modelBT;
this.modelBT.computePositions();
this.context = new BasicContext();
this.tickableTasks = new LinkedList<ExecutionTask>();
this.openTasks = new LinkedList<ExecutionTask>();
this.currentOpenInsertions = new LinkedList<ExecutionTask>();
this.currentOpenRemovals = new LinkedList<ExecutionTask>();
this.currentTickableInsertions = new LinkedList<ExecutionTask>();
this.currentTickableRemovals = new LinkedList<ExecutionTask>();
this.interrupters = new Hashtable<ModelInterrupter, ExecutionInterrupter>();
this.tasksStates = new Hashtable<ModelTask.Position, ITaskState>();
}
/**
*
* @see jbt.execution.core.IBTExecutor#tick()
*/
public void tick() {
/*
* The ticking algorithm works as follows:
*
* If it is the very first time that this method is called, an ExecutionTask is created from
* the root ModelTask (that is, the root of the behaviour tree that this BTExecutor is going
* to run). Then, that task is spawned.
*
* From then on, tick() will just call tick() on all the ExecutionTasks in the list of
* tickable tasks.
*
* It is important to note that insertions and removals from the list of tickable and open
* tasks are processed at the very beginning and at the very end of this method, but not
* while it is ticking the current list of tickable tasks.
*/
Status currentStatus = this.getStatus();
/* We only tick if the tree has not finished yet or if it has not started running. */
if (currentStatus == Status.RUNNING || currentStatus == Status.UNINITIALIZED) {
processInsertionsAndRemovals();
if (this.firstTimeTicked) {
this.executionBT = this.modelBT.createExecutor(this, null);
this.executionBT.spawn(this.context);
this.firstTimeTicked = false;
} else {
for (ExecutionTask t : tickableTasks) {
t.tick();
}
}
processInsertionsAndRemovals();
}
}
/**
*
* @see jbt.execution.core.IBTExecutor#terminate()
*/
public void terminate() {
if (this.executionBT != null) {
this.executionBT.terminate();
}
}
/**
* Returns the ExecutionInterrupter that is currently active and registered in the BTExecutor (
* {@link #registerInterrupter(ExecutionInterrupter)}) whose associated ModelInterrupter is
* <code>modelInterrupter</code>. Returns null if there is no such an ExecutionInterrupter.
*
* @param modelInterrupter
* the ModelInterrupter associated to the ExecutionInterrupter to retrieve.
* @return the ExecutionInterrupter whose associated ModelInterrupter is
* <code>modelInterrupter</code>.
*/
public ExecutionInterrupter getExecutionInterrupter(ModelInterrupter modelInterrupter) {
return this.interrupters.get(modelInterrupter);
}
/**
* Registers an ExecutionInterrupter with this BTExecutor.
*
* @param interrupter
* the ExecutionInterrupter to register.
*/
public void registerInterrupter(ExecutionInterrupter interrupter) {
this.interrupters.put((ModelInterrupter) interrupter.getModelTask(), interrupter);
}
/**
* Unregisters an ExecutionInterrupter from this BTExecutor.
*
* @param interrupter
* the ExecutionInterrupter to unregister.
*/
public void unregisterInterrupter(ExecutionInterrupter interrupter) {
this.interrupters.remove(interrupter.getModelTask());
}
/**
* Enum defining the relevant lists that the BTExecutor handles.
*
* <ul>
* <li> {@link #OPEN}: the list of open (active) nodes.
* <li> {@link #TICKABLE}: the list of tickable nodes, that is, those that receive ticks every
* time {@link BTExecutor#tick()} is called.
* </ul>
*
* @author Ricardo Juan Palma Durán
*
*/
public static enum BTExecutorList {
/** Enum for the list of open nodes. */
OPEN, /** Enum for the list of tickable nodes. */
TICKABLE
};
/**
* Method used to request the BTExecutor to insert an ExecutionTask into one of the list that it
* handles. The insertion is not performed right away, but delayed until:
*
* <ul>
* <li>Either the current game AI cycle (call to {@link #tick()}) finishes. This happens if the
* insertion is requested in the middle of an AI cycle, that is, if <code>tick()</code> is still
* running.
* <li>Or the next AI cycle starts. This happens if the insertion is requested when the
* BTExecutor is not ticking the underlying BT. In this case, the next time <code>tick()</code>
* is called, the insertion will be processed just before the BT is actually ticked.
* </ul>
*
* @param listType
* the type of the list that the task will be inserted into.
* @param t
* the task that wants to be inserted into the list of type <code>listType</code>.
*/
public void requestInsertionIntoList(BTExecutorList listType, ExecutionTask t) {
if (listType == BTExecutorList.OPEN) {
if (!this.currentOpenInsertions.contains(t)) {
this.currentOpenInsertions.add(t);
}
} else {
if (!this.currentTickableInsertions.contains(t)) {
this.currentTickableInsertions.add(t);
}
}
}
/**
* Method used to request the BTExecutor to remove an ExecutionTask from one of the list that
* the BTExecutor handles. The removal is not performed right away, but delayed until:
*
* <ul>
* <li>Either the current game AI cycle (call to {@link #tick()}) finishes. This happens if the
* removal is requested in the middle of an AI cycle, that is, if <code>tick()</code> is still
* running.
* <li>Or the next AI cycle starts. This happens if the removal is requested when the BTExecutor
* is not ticking the underlying BT. In this case, the next time <code>tick()</code> is called,
* the removal will be processed just before the BT is actually ticked.
* </ul>
*
* @param listType
* the type of the list from which the task will be removed.
* @param t
* the task that wants to be removed from the list of type <code>listType</code>.
*/
public void requestRemovalFromList(BTExecutorList listType, ExecutionTask t) {
if (listType == BTExecutorList.OPEN) {
if (!this.currentOpenRemovals.contains(t)) {
this.currentOpenRemovals.add(t);
}
} else {
if (!this.currentTickableRemovals.contains(t)) {
this.currentTickableRemovals.add(t);
}
}
}
/**
* Cancels a previous request of insertion into one of the lists that the BTExecutor handles. If
* no such insertion request was made, this method does nothing.
*
* @param listType
* the list from which the insertion request will be canceled.
* @param t
* the task whose insertion will be canceled.
*/
public void cancelInsertionRequest(BTExecutorList listType, ExecutionTask t) {
if (listType == BTExecutorList.OPEN) {
this.currentOpenInsertions.remove(t);
} else {
this.currentTickableInsertions.remove(t);
}
}
/**
* Cancels a previous request of removal from one of the lists that the BTExecutor handles. If
* no such removal request was made, this method does nothing.
*
* @param listType
* the list from which the removal request will be canceled.
* @param t
* the task whose removal will be canceled.
*/
public void cancelRemovalRequest(BTExecutorList listType, ExecutionTask t) {
if (listType == BTExecutorList.OPEN) {
this.currentOpenRemovals.remove(t);
} else {
this.currentTickableRemovals.remove(t);
}
}
/**
* Method that processes the insertions and removals into and from the lists of tickable and
* open nodes that have been previously requested via the <code>requestXXX</code> methods.
* <p>
* After calling this method, all pending removals and insertions are processed, so no new
* insertion and removal will be carried out unless new ones are requested.
*/
private void processInsertionsAndRemovals() {
/*
* Process insertions and removals.
*/
for (ExecutionTask t : this.currentTickableInsertions) {
this.tickableTasks.add(t);
}
for (ExecutionTask t : this.currentTickableRemovals) {
this.tickableTasks.remove(t);
}
for (ExecutionTask t : this.currentOpenInsertions) {
this.openTasks.add(t);
}
for (ExecutionTask t : this.currentOpenRemovals) {
this.openTasks.remove(t);
}
/*
* Clear the lists of tasks to insert and remove.
*/
this.currentOpenInsertions.clear();
this.currentOpenRemovals.clear();
this.currentTickableInsertions.clear();
this.currentTickableRemovals.clear();
}
/**
*
* @see jbt.execution.core.IBTExecutor#getBehaviourTree()
*/
public ModelTask getBehaviourTree() {
return this.modelBT;
}
/**
*
* @see jbt.execution.core.IBTExecutor#getStatus()
*/
public Status getStatus() {
if (this.executionBT == null) {
return Status.UNINITIALIZED;
} else {
return this.executionBT.getStatus();
}
}
/**
*
* @see jbt.execution.core.IBTExecutor#getRootContext()
*/
public IContext getRootContext() {
return this.context;
}
/**
* Sets the permanent state of a given task. The task is identified by the position it occupies
* in the execution behaviour tree, which unambiguously identifies it.
*
* @param taskPosition
* the position of the task whose state must be stored.
* @param state
* the state of the task, or null if it should be cleared.
* @return true if there was a previous state for this task in the BTExecutor, or false
* otherwise.
*/
public boolean setTaskState(Position taskPosition, ITaskState state) {
if (state == null) {
return this.tasksStates.remove(taskPosition) == null ? false : true;
}
return this.tasksStates.put(taskPosition, state) == null ? false : true;
}
/**
* Returns the permanent state of a task. The task is identified by the position it occupies in
* the execution behaviour tree, which unambiguously identifies it.
*
* @param taskPosition
* the position of the task whose state must be retrieved.
* @return the state of the task, or null if there is no state stored in the BTExecutor for the
* task.
*/
public ITaskState getTaskState(Position taskPosition) {
return this.tasksStates.get(taskPosition);
}
/**
* Copies the set of all tasks' states stored in <code>executor</code> into this BTExecutor.
* <p>
* <b>After calling this method, the set of all tasks' states is shared by both BTExecutor
* objects (<code>executor</code> and <code>this</code>), so if one modifies it, the other will
* notice the change.</b>
*/
public void copyTasksStates(BTExecutor executor) {
this.tasksStates = executor.tasksStates;
}
/**
* Clears the permanent state of a task. The task is identified by the position it occupies in
* the execution behaviour tree, which unambiguously identifies it.
*
* @param taskPosition
* the position of the task whose state must be cleared.
* @return true if the BTExecutor contained the state of the task before calling this method, or
* false otherwise.
*/
public boolean clearTaskState(Position taskPosition) {
return this.tasksStates.remove(taskPosition) == null ? false : true;
}
/**
*
* @see java.lang.Object#toString()
*/
public String toString() {
return "[Root: " + this.modelBT.getClass().getSimpleName() + ", Status: "
+ this.getStatus() + "]";
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/BTExecutorFactory.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import jbt.model.core.ModelTask;
/**
* The BTExecutorFactory implements the simple factory pattern, and allows
* clients of the framework to create instances of {@link IBTExecutor} objects
* that will run specific behaviour trees.
*
* @author Ricardo Juan Palma Durán
*
*/
public class BTExecutorFactory {
/**
* Creates an IBTExecutor that is able to run a specific behaviour tree. The
* input context is also specified.
*
* @param treeToRun
* the behaviour tree that the returned IBTExecutor will run,
* @param context
* the input context to be used by the behaviour tree.
* @return an IBTExecutor to run the tree <code>treeToRun</code>.
*/
public static IBTExecutor createBTExecutor(ModelTask treeToRun,
IContext context) {
return new BTExecutor(treeToRun, context);
}
/**
* Creates an IBTExecutor that is able to run a specific behaviour tree. A
* new empty context is created for the tree.
*
* @param treeToRun
* the behaviour tree that the returned IBTExecutor will run,
* @return an IBTExecutor to run the tree <code>treeToRun</code>.
*/
public static IBTExecutor createBTExecutor(ModelTask treeToRun) {
return new BTExecutor(treeToRun);
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/BTLibraryFactory.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import java.util.Iterator;
import java.util.List;
import jbt.execution.context.GenericBTLibrary;
import jbt.model.core.ModelTask;
/**
* The BTLibraryFactory implements the simple factory pattern, and allows
* clients of the framework to create instances of {@link IBTLibrary} composed
* of behaviour trees.
*
* @author Ricardo Juan Palma Durán
*
*/
public class BTLibraryFactory {
/**
* Creates a BT library that contains all the BTs contained in the libraries
* of <code>libraries</code>. If several trees are referenced by the same
* name, only the last one (according to its order in the input libraries)
* will remain.
*
* @param libraries
* the list with all the libraries whose BTs will contain the
* returned BT library.
* @return a BT library that contains all the BTs contained in the libraries
* of <code>libraries</code>.
*/
public static IBTLibrary createBTLibrary(List<IBTLibrary> libraries) {
GenericBTLibrary result = new GenericBTLibrary();
for (IBTLibrary library : libraries) {
result.addBTLibrary(library);
}
return result;
}
/**
* Creates a BT library that contains all the behaviour trees in
* <code>behaviourTrees</code>. The name of the trees are specified in
* <code>names</code>, so, for instance, the i-th element in
* <code>names</code> represents the name of the i-th tree in
* <code>behaviourTrees</code>. If several trees are referenced by the same
* name, only the last one (according to its order in the input lists) will
* remain.
*
* @param behaviourTrees
* the list with the trees that the BT library will contain.
* @param names
* the list with the names of the trees.
* @return a BT library that contains all the behaviour trees in the list
* <code>behaviourTrees</code>.
*/
public static IBTLibrary createBTLibrary(List<ModelTask> behaviourTrees, List<String> names) {
GenericBTLibrary result = new GenericBTLibrary();
Iterator<ModelTask> treesIterator = behaviourTrees.iterator();
Iterator<String> namesIterator = names.iterator();
while (treesIterator.hasNext()) {
result.addBT(namesIterator.next(), treesIterator.next());
}
return result;
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/ContextFactory.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import java.util.Iterator;
import java.util.List;
import jbt.execution.context.BasicContext;
import jbt.model.core.ModelTask;
/**
* The ContextFactory implements the simple factory pattern, and allows clients
* of the framework to create instances of {@link IContext} objects that can be
* used when running behaviour trees.
*
* @author Ricardo Juan Palma Durán
*
*/
public class ContextFactory {
/**
* Creates a new empty context (with no variables) that contains all the
* behaviour trees specified in <code>library</code>.
*
* @param library
* the set of behaviour trees that the returned IContext will
* contain.
* @return a new empty context that contains all the behaviour trees
* specified in <code>library</code>.
*/
public static IContext createContext(IBTLibrary library) {
BasicContext result = new BasicContext();
result.addBTLibrary(library);
return result;
}
/**
* Creates a new empty context (with no variables) that contains all the
* behaviour trees in the libraries <code>libraries</code>.
*
* @param libraries
* the list of libraries whose behaviour trees this context will
* contain.
* @return a new empty context that contains all the behaviour trees in the
* libraries <code>libraries</code>.
*/
public static IContext createContext(List<IBTLibrary> libraries) {
BasicContext result = new BasicContext();
for (IBTLibrary library : libraries) {
result.addBTLibrary(library);
}
return result;
}
/**
* Creates a new empty context (with no variables in it) that contains all
* the behaviour trees in <code>behaviourTrees</code>. The name of the trees
* are specified in <code>names</code>, so, for instance, the i-th element
* in <code>names</code> represents the name of the i-th tree in
* <code>behaviourTrees</code>.
*
* @param behaviourTrees
* the list with the trees that the context will contain.
* @param names
* the list with the names of the trees.
* @return a new empty context that contains all the behaviour trees in the
* list <code>behaviourTrees</code>.
*/
public static IContext createContext(List<ModelTask> behaviourTrees, List<String> names) {
BasicContext result = new BasicContext();
Iterator<ModelTask> treesIterator = behaviourTrees.iterator();
Iterator<String> namesIterator = names.iterator();
while (treesIterator.hasNext()) {
result.addBT(namesIterator.next(), treesIterator.next());
}
return result;
}
/**
* Creates a new empty context (with no variables in it).
*
* @return a new empty context.
*/
public static IContext createContext() {
return new BasicContext();
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/ExecutionTask.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import jbt.exception.IllegalReturnStatusException;
import jbt.exception.NotTickableException;
import jbt.exception.SpawnException;
import jbt.exception.TickException;
import jbt.execution.core.BTExecutor.BTExecutorList;
import jbt.execution.core.event.ITaskListener;
import jbt.execution.core.event.TaskEvent;
import jbt.model.core.ModelTask;
import jbt.model.core.ModelTask.Position;
/**
* A behaviour tree is conceptually modeled by the ModelTask class. A ModelTask,
* however, does not know how to run, since it is just a conceptual abstraction.
* <p>
* The ExecutionTask represents a tasks that knows how to run a particular
* ModelTask. For each type of ModelTask, such as ModelSequence or
* ModelParallel, there is an ExecutionTask that knows how to run it (e.g.,
* ExecutionSequence and ExecutionParallel).
* <p>
* ExecutionTask works together with the BTExecutor class to run its
* corresponding ModelTask (an ExecutionTask does have a managing BTExecutor).
* An ExecutionTask defines several methods for the different stages it goes
* through.
* <ul>
* <li>{@link #spawn(IContext)} is initially called when the task needs to
* create the hierarchical structure of ExecutionTask objects that, as a whole,
* are able to run the parent ExecutionTask.
* <li>{@link #tick()} is used from then on, in order to give the ExecutionTask
* some time to think and evolve according to its semantics.
* <li>{@link #terminate()} is used when the task needs to be abruptly
* terminated.
* </ul>
*
* The three methods above depend on the implementation that each subclass makes
* of the {@link #internalSpawn()}, {@link #internalTick()} and
* {@link #internalTerminate()} methods respectively. These three protected
* abstract methods are in charge of carrying out the actual spawning, ticking
* and termination processes. It has to be noted that it is very important the
* way that the ExecutionTask class interacts with other ExecutionTask classes
* as well as with the BTExecutor. With respect to the BTExecutor, the
* ExecutionTask asks to be inserted and removed from both the lists of open and
* tickable nodes of the BTExecutor. Subclasses only have to worry about
* requesting to be inserted into the list of tickable nodes. Other types of
* insertions and removals are automatically handled by the ExecutionTask class.
*
* @see ModelTask
* @see BTExecutor
*
* @author Ricardo Juan Palma Durán
*
*/
public abstract class ExecutionTask implements ITaskListener {
/** The ModelTask this ExecutionTask is running. */
private ModelTask modelTask;
/** The BTExecutor that is managing this ExecutionTask. */
private BTExecutor executor;
/** The context of the task. */
private IContext context;
/**
* List of all the listeners that are listening to TaskEvent from this task.
*/
private List<ITaskListener> listeners;
/** Current status of the task. */
private Status status;
/** Flag telling whether the task can be spawned or not. */
private boolean spawnable;
/** Flag indicating whether the task can ticked or not. */
private boolean tickable;
/** Flag indicating whether the task has been terminated or not. */
private boolean terminated;
/** The parent ExecutionTask. null if this is the root of the tree. */
private ExecutionTask parent;
/**
* The position that the task occupies in the execution tree. Note that this
* position does not necessarily match that of the underlying ModelTask.
* This position is computed from the parent ExecutionTask when the
* ExecutionTask is created.
*/
private Position position;
/**
* Enum defining the possible states of an ExecutionTask. Throughout its
* execution, an ExecutionTask may be in several states:
*
* <ul>
* <li> {@link #FAILURE}: means the task has failed, that is, it could not
* complete successfully.
* <li> {@link #SUCCESS}: means the task has completed successfully.
* <li> {@link #RUNNING}: means the task is still running.
* <li> {@link #TERMINATED}: means the task has been abruptly terminated. It
* is conceptually similar to {@link #FAILURE}, so whenever a task has been
* terminated, it is also considered to have failed.
* <li> {@link #UNINITIALIZED}: means the task has not been spawned yet, that
* is, it has not started executing.
* </ul>
*
* @author Ricardo Juan Palma Durán
*
*/
public static enum Status {
/** Status code meaning the task has failed. */
FAILURE, /** Status code meaning the task has succeeded. */
SUCCESS, /** Status code meaning the task is still running. */
RUNNING, /**
* Status code meaning the task has been abruptly terminated.
* It is conceptually similar to {@link #FAILURE}, so whenever a task
* has been terminated, it is also considered to have failed.
*/
TERMINATED,
/**
* Status code meaning the task has not been spawned yet, that is, it
* has not started executing.
*/
UNINITIALIZED,
}
/**
* Constructs an ExecutionTask with an associated ModelTask and a
* BTExecutor. The ModelTask represents the conceptual task that the
* ExecutionTask is running, and the BTExecutor is that in charge of the
* ExecutionTask. Also, the parent of the ExecutionTask must be provided.
*
* @param modelTask
* the ModelTask this ExecutionTask will run.
* @param executor
* the BTExecutor managing this task.
* @param parent
* the parent ExecutionTask, or null in case this is the root of
* the tree.
*/
public ExecutionTask(ModelTask modelTask, BTExecutor executor, ExecutionTask parent) {
this.modelTask = modelTask;
this.executor = executor;
this.listeners = new LinkedList<ITaskListener>();
this.spawnable = true;
this.tickable = false;
this.terminated = false;
this.status = Status.UNINITIALIZED;
this.parent = parent;
/* Compute the position of this node. */
if (parent == null) {
this.position = new Position();
} else {
this.position = new Position(parent.position);
int nextMove = getMove();
this.position.addMove(nextMove);
}
}
/**
* This method is called the very first time the task has to be executed.
* <p>
* This method is in charge of creating all the structure down the hierarchy
* of the BT that is needed to actually run the task. This process will
* probably include creating and spawning, in a recursive manner, some of
* the children of this task.
* <p>
* <code>spawn()</code> is not an abstract method. In reality, the actual
* spawning process is not carried out by <code>spawn()</code> itself, but
* by the abstract {@link #internalSpawn()} method. What
* <code>spawn()</code> does is to just restore the previous state of the
* task (if any), and then call <code>internalSpawn()</code>.
* <code>internalSpawn()</code> has a different implementation for every
* subclass of ExecutionTask, since it is that method the one that in fact
* carries out the spawning process. <b>Thus, subclasses must define the
* abstract <code>internalSpawn()</code> method</b>.
* <p>
* This method also stores the execution context (<code>context</code>) to
* be used by the task, which will be accessible through
* {@link #getContext()} after calling this method.
*
* @param context
* the context that the task will use.
*/
public final void spawn(IContext context) throws SpawnException {
/* If the task cannot be spawned, throw an exception. */
if (!this.spawnable) {
throw new SpawnException("The task cannot be spawned. It has already been spawned.");
}
/*
* Store the context.
*/
this.context = context;
this.spawnable = false;
this.tickable = true;
/* Set the current status of the task to Status.RUNNING. */
this.status = Status.RUNNING;
/*
* Request to be inserted into the list of open tasks.
*/
this.executor.requestInsertionIntoList(BTExecutorList.OPEN, this);
/*
* Restore the past state of the task in case it has any.
*/
ITaskState previousState = this.executor.getTaskState(getPosition());
restoreState(previousState);
/*
* Carry out the actual spawn.
*/
internalSpawn();
}
/**
* This is the method that carries out the actual spawning process of the
* ExecutionTask. Sublclasses must define it, since the spawning process
* varies depending on the type of the task.
* <p>
* <code>internalSpawn()</code> is called from the {@link #spawn(IContext)}
* method. When <code>internalSpawn()</code> is called, the context of the
* task is already accessible through {@link #getContext()}, so it can be
* used by the task.
* <p>
* <code>internalSpawn()</code> is the method that creates all the structure
* of interconnected tasks (ExecutionTask) that are necessary to run this
* task. Each subclass is spawned in a different way. For instance, when a
* sequence task is spawned, it has to spawn its first child, but when a
* parallel task is spawned, it has to spawn all of its children.
* <p>
* An ExecutionTask contains a reference to a ModelTask which is trying to
* run. When <code>internalSpawn()</code> is called, it has to create,
* according to the semantics of the task, new ExecutionTask objects for the
* children of the ModelTask.
* <p>
* For instance, let us suppose that there is a ModelSequence class
* subclassing ModelTask. The ExecutionTask associated to ModelSequence is
* ExecutionSequence. An ExecutionSequence has a reference to the
* ModelSequence it is running. When ExecutionSequence is spawned, it has to
* create, <i>according to the semantics of the task, new ExecutionTask
* objects for the children of the ModelTask</i>. In this case it means that
* the first child of the sequence should also be spawned (in a recursive
* manner). Therefore, what the ExecutioSequence has to is to take the first
* child of the ModelSequence (let us call it <i>child</i>), which will be a
* ModelTask. Then, it will have to create the appropriate ExecutionTask for
* <i>child</i>, by calling <i>child.createExecutor()</i>. Finally, it will
* have to call the <code>spawn()</code> method recursively on the
* ExecutionTask returned by <i>child.createExecutor()</i>. Other tasks
* would behave differently. For instance, when an ExecutionParallel
* (associated to a ModelParallel) is spawned, it has to create an
* ExecutionTask for all of the children of its ModelParallel, and
* recursively spawn every single one of them.
* <p>
* Leaf tasks (also known as <i>low level task</i>, since they usually -but
* not always- perform a game-dependent process), such as actions and
* conditions, are spawned in a different way. They do not recursively spawn
* any child, since they have none. When a leaf task is spawned, it should
* start the execution of the process associated to the node. Keep in mind
* that low level tasks may perform long processes that require several
* ticks in order to complete. It is in this method that those processes
* start (maybe in independent threads).
* <p>
* It should be noted, however, that many processes may be instantaneous, so
* they may complete even within the <code>internalSpawn()</code> method.
* Nevertheless, in these cases the BT should not evolve, reason why the
* termination notification to its parent is carried out in the
* <code>tick()</code> method, probably in the next AI cycle. If
* <code>spawn()</code> were allowed to notify parents when the task
* terminates, then a single call to <code>spawn()</code> may take too long
* to complete due to the uninterrupted evolution of the tree, which is
* something that has to be avoided.
* <p>
* An important part of the spawning process is to decide if the
* ExecutionTask will enter the list of tickable nodes of the BTExecutor.
* Only tasks that request to be inserted into that list are ticked at every
* game AI cycle (when {@link BTExecutor#tick()} is called). In order to
* request it, the task has to call
* {@link #requestInsertionIntoTickableList()}. In general, all leaf tasks
* should be ticked every cycle, since the progress of parent tasks depends
* on the termination of their children. However, non-leaf tasks may also
* need ticking. For instance, the dynamic priority list task needs to
* constantly receive ticks, since it has to check its children's guards all
* the time -the dynamic priority list can evolve not only because of the
* termination of the currently active child, but also because of the
* reevaluation of guards-. In general, if the only way of making a task
* evolve is through the notification of termination from one or several of
* its children, then the task should not be in the list of tickable nodes.
* On the other hand, if a task can evolve because of factors other than the
* termination of one or several of its children, then it should request to
* be inserted into the list of tickable nodes.
*/
protected abstract void internalSpawn();
/**
* After spawning an ExecutionTask, <code>tick()</code> has to be called in
* order to update it and keep track of its status.
* <p>
* This method is in charge of updating this ExecutionTask according to its
* semantics. This process may include spawning none, one, or several of its
* children depending on their termination status. It may also have to
* terminate some of its children.
* <p>
* <code>tick()</code> is not an abstract method. In reality, the actual
* ticking process is not carried out by <code>tick()</code> itself, but by
* the abstract {@link #internalTick()} method. <b>Thus, subclasses must
* define the abstract <code>internalSpawn()</code> method</b>.
* <p>
* What <code>tick()</code> does is to call <code>internalTick()</code> to
* carry out the actual ticking process. Then, <code>tick()</code> checks
* if, after the tick, the task has finished (that is, it checks if the
* status returned by <code>internalTick()</code> is {@link Status#FAILURE}
* or {@link Status#SUCCESS}). If so, <code>tick()</code> fires a TaskEvent
* to the parent of this ExecutionTask, so the parent does whatever it has
* to do after the termination of its child, and also requests to be removed
* from both the lists of tickable and open nodes of the BTExecutor (because
* this task will not be ticked again unless it is spawned again). Also, if
* the ExecutionTask has finished, <code>tick()</code> stores the current
* state of the task just in case it is spawned again in the future.
* <p>
* <b>It should be noted that when a task has been terminated (
* {@link #terminate()}), <code>tick()</code> does nothing</b>, and it just
* returns {@link Status#TERMINATED} (it does not even fire a TaskEvent).
*
* @return the status of the task after being ticked.
*/
public final Status tick() throws TickException {
/* If the task cannot be ticked, throw an exception. */
if (!this.tickable) {
throw new NotTickableException("The task cannot be ticked. It must be spawned first.");
}
/* If the task has been terminated, do nothing. */
if (!this.terminated) {
/* Otherwise, perform the actual tick by calling "internalTick()". */
Status newStatus = this.internalTick();
/* Check if the value that is returned by "internalTick()" is valid. */
if (!validInternalTickStatus(newStatus)) {
throw new IllegalReturnStatusException(newStatus.toString()
+ " cannot be returned by ExecutionTask.internalTick()");
}
this.status = newStatus;
/*
* If the task has finished (either successfully or in failure), a
* TaskEvent has to be fired in order to notify its parent about the
* termination. Before firing the event, the current state of the
* task has to be stored into the BTExecutor, just in case it needs
* to be restored in the future. The task also requests to be
* removed from both the list of tickable and open nodes.
*
* Otherwise the task has not finished, so nothing in particular is
* done.
*/
if (newStatus != Status.RUNNING) {
ITaskState taskState = storeState();
this.executor.setTaskState(getPosition(), taskState);
this.executor.requestRemovalFromList(BTExecutorList.TICKABLE, this);
this.executor.requestRemovalFromList(BTExecutorList.OPEN, this);
fireTaskEvent(newStatus);
}
return newStatus;
} else {
return Status.TERMINATED;
}
}
/**
* <code>internalTick()</code> is the method that actually carries out the
* ticking process of an ExecutionTask. Subclasses must define it, since the
* ticking process varies depending on the type of the task.
* <p>
* <code>internalTick()</code> is called from the {@link #tick()} method.
* When it is called, it must assume that the task has already been spawned
* ({@link #spawn(IContext)}) and that the context of the task is already
* accessible through {@link #getContext()}.
* <p>
* <code>internalTick()</code> is the method that is used to update an
* ExecutionTask. Behaviour trees are driven by ticks, which means that they
* only evolve when they are ticked (otherwise put, behaviour trees are
* given CPU time only when they are ticked). <code>internalTick()</code> is
* the method that implements the ticking process of the task. Therefore,
* when it is called, and according to the semantics of the task, it will
* have to do some processes to make the task go on. This processes may
* include spawning other children or even terminating currently running
* children.
* <p>
* For instance, let us suppose that there is a ModelSequence class
* subclassing ModelTask. The ExecutionTask associated to ModelSequence is
* ExecutionSequence. An ExecutionSequence has a reference to the
* ModelSequence it is running. When ExecutionSequence is ticked, it has to
* update the task <i>according to the semantics of the task</i>. In this
* case it means that it has to analyze the current status of the current
* active child (through {@link #getStatus()}). If the child is still
* running, the ticking process just does nothing, since the sequence cannot
* go on unless the current child finishes. Nevertheless, if the child has
* successfully finished, the ExecutionSequence will have to spawn the next
* task of the sequence. In order to do so, the ExecutionSequence will
* access it through its ModelSequence. A new ExecutionTask will be created
* for the next child of the ModelSequence (via the
* <code>ModelTask.createExecutor()</code>) method, and then it will be
* spawned (in this case, <code>internalTick()</code> will return
* {@link Status#RUNNING}). However, if the child has not finished
* successfully, the sequence has to be aborted, so the ticking process will
* just return the failure status code {@link Status#FAILURE} (from the
* outside, the <code>tick()</code> method will catch this termination code
* and, as a result, it will fire a TaskEvent to notify the parent of the
* ExecutionSequence).
* <p>
* The ticking process of the ExecutionParallel task is very different. When
* <code>internalTick()</code> is called, the ExecutionParallel has to check
* the current status of all of its children. If one of them has failed,
* then all the children must be terminated, and the failure code
* {@link Status#FAILURE} must be returned. If all of its children have
* successfully finished, then the ExecutionParallel will just return
* {@link Status#SUCCESS}. Otherwise, it will return {@link Status#RUNNING}.
* <p>
* Leaf tasks (<i>low level task</i>), such as actions and conditions, are
* ticked in a different way. They do not have to analyze the termination
* status of any child, since they have none. When a leaf task is ticked, it
* should check the termination status of the process associated to the
* task, and return a termination status accordingly. <b>It should be noted
* that when a task has been terminated ( {@link #terminate()}),
* <code>tick()</code> does nothing</b>.
* <p>
* It should be noted that when a task has been terminated (
* {@link #terminate()}), <code>tick()</code> does nothing. In particular,
* <code>tick()</code> will not call <code>internalTick()</code>.
* <b>Therefore, it can be assumed that if <code>internalTick()</code> is
* called, then this task has not been terminated</b>, so the implementation
* of this method should not even consider other cases.
* <p>
* An important aspect of this method is that, even though it returns an
* Status object, only certain return values are allowed. In particular,
* only {@link Status#SUCCESS}, {@link Status#FAILURE} and
* {@link Status#RUNNING} can be returned.
*
* @return the status of the task after being ticked.
*/
protected abstract Status internalTick();
/**
* This method stores the persistent state of an ExecutionTask. Some tasks
* need to keep some information throughout the execution of the tree.
* <p>
* Some tasks in BTs are persistent in the sense that, after finishing, if
* they are spawned again, they remember past information. Take for example
* the "limit" task. A "limit" task allows to run its child node only a
* certain number of times (for example, 5). After being spawned, it has to
* remember how many times it has been run so far, so that, once the
* threshold is exceeded, it fails.
* <p>
* The problem here is that tasks are destroyed when they leave the list of
* tickable tasks. Thus, if the task needs to be used again, a new instance
* for the task must be created, which, of course, will not remember past
* information since it is a new object. This method is used for storing
* information that needs to be used in the future when the task gets
* created again. In particular, this method is called in the
* {@link #tick()} function just after noticing that the task has finished
* (when <code>internalTick()</code> returns a termination status). By doing
* so, the task stores its state as soon as possible just in case it needs
* to be spawned immediately afterwards.
* <p>
* This method must return the information it needs to remember in a a
* {@link ITaskState} object, which must be comprehensible by the
* {@link #restoreState(ITaskState)}, that is, it is
* <code>restoreState()</code> that knows how to restore the state of the
* task by reading the information that <code>storeState()</code> returns.
* <p>
* This method is called when the task finishes, so its implementation
* should take into account that it will be called only when
* {@link #internalTick()} returns a Status different from
* {@link Status#RUNNING}.
* <p>
* This method may return null if the task does not need to store any state
* information for future use.
*
* @return an ITaskState object with the persistent state information of the
* task, for future use. The returned ITaskState must be readable by
* <code>restoreState()</code>.
*/
protected abstract ITaskState storeState();
/**
* This method follows the same semantics as {@link #storeState()}. However,
* it is called when the task is terminated ( {@link #terminate()} ). When a
* task is abruptly terminated, it may want to store some state information
* for future use. It is in this method where such information should be
* returned.
*
* @return an ITaskState object with the persistent state information of the
* task, for future use. The returned ITaskState must be readable by
* <code>restoreState()</code>.
*/
protected abstract ITaskState storeTerminationState();
/**
* This method restores the persistent state of an ExecutionTask from an
* {@link ITaskState} object. Some tasks need to keep some information
* throughout the execution of the tree.
* <p>
* Some tasks in BTs are persistent in the sense that, after finishing, if
* they are spawned again, they remember past information. Take for example
* the "limit" task. A "limit" task allows to run its child node only a
* certain number of times (for example, 5). After being spawned, it has to
* remember how many times it has been run so far, so that, once the
* threshold is exceeded, it fails.
* <p>
* The problem here is that tasks are destroyed when they leave the list of
* tickable tasks. Thus, if the task needs to be used again, a new instance
* for the task must be created, which, of course, will not remember past
* information since it is a new object. This method is used for retrieving
* from the ITaskState object past information that has previously returned
* by either the {@link #storeState()} or the
* {@link #storeTerminationState()} method. In particular, this method is
* called in the {@link #spawn(IContext)} method, just before
* {@link #internalSpawn()} gets called. By doing so, the task that is
* created is able to restore past information needed to work. Since this
* method is called before the task is spawned (that is, before
* <code>internalSpawn()</code> is called), it must be assumed that the task
* always keeps its past state.
* <p>
* This method reads the information that either <code>storeState()</code>
* or <code>storeTerminationState()</code> has previously returned..
* Therefore, it must follow the same format as that of both methods. It the
* input ITaskState is null, it means that there is no past information to
* retrieve, so the task should be left unchanged.
* <p>
* This method may be left empty if the task does not need to restore any
* past state.
*
* @param state
* an ITaskState object containing past state information that
* should be retrieved, or null in case there is no past
* information to remember.
*/
protected abstract void restoreState(ITaskState state);
/**
* Returns the context of the task.
*
* @return the context of the task.
*/
public IContext getContext() {
return this.context;
}
/**
* Adds a task listener to this task. When there is a relevant change in the
* status of this task, the listener will be notified by calling its
* {@link ITaskListener#statusChanged(TaskEvent)} method.
*
* @param listener
* the listener to add.
*/
public void addTaskListener(ITaskListener listener) {
this.listeners.add(listener);
}
/**
* Removes a listener from this task.
*
* @param listener
* the task listener to remove.
*/
public void removeTaskListener(ITaskListener listener) {
this.listeners.remove(listener);
}
/**
*
* @see jbt.execution.core.event.ITaskListener#statusChanged(jbt.execution.core.event.TaskEvent)
*/
public abstract void statusChanged(TaskEvent e);
/**
* Returns the current status of the task.
*
* @return the current status of the task.
*/
public Status getStatus() {
return this.status;
}
/**
* Returns the BTExecutor of this ExecutionTask.
*
* @return the BTExecutor of this ExecutionTask.
*/
public BTExecutor getExecutor() {
return this.executor;
}
/**
* Returns the ModelTask associated to this ExecutionTask.
*
* @return the ModelTask associated to this ExecutionTask.
*/
public ModelTask getModelTask() {
return this.modelTask;
}
/**
* Returns the position of the ExecutionTask in the execution tree. Note
* that such position is not necessarily that of the underlying ModelTask.
*
* @return the position of the ExecutionTask in the execution tree.
*/
public Position getPosition() {
return this.position;
}
/**
* Returns true if the task has been spawned, and false otherwise.
*
* @return true if the task has been spawned, and false otherwise.
*/
public boolean getSpawned() {
return this.spawnable == false;
}
/**
* Returns true if the task has been terminated, and false otherwise.
*
* @return true if the task has been terminated, and false otherwise.
*/
public boolean getTerminated() {
return this.terminated;
}
/**
* Terminates the execution of this task and all the tasks below it.
* <p>
* When this method is called, the task is marked as terminated. From then
* on, ticking the task will have no effect, and its status will be
* {@link Status#TERMINATED}. Also, when terminating the task, it requests
* to be removed from both the list of tickable and open nodes of the
* BTExecutor. It also stores the task state after being terminated, by
* calling {@link #storeTerminationState()}.
* <p>
* Finally, this method calls the abstract method
* {@link #internalTerminate()}. <code>internalTerminate()</code> is the
* method that actually terminates the execution of the task and all the
* tasks below it, usually by calling <code>terminate()</code> on the active
* children and by stopping any process associated to the task. <b>
* <code>internalTerminate()</code> must be defined for each subclass, since
* their termination processes differ from one another</b>.
* <p>
* This method cannot be called if the task has not been spawned yet (an
* exception is thrown in that case). However, it is valid terminating a
* task that has already been terminated, in which case nothing happens.
*/
public final void terminate() {
if (!this.tickable) {
throw new RuntimeException("Cannot terminate a task that has not been spawned yet.");
}
if (!this.terminated) {
this.terminated = true;
this.status = Status.TERMINATED;
this.executor.requestRemovalFromList(BTExecutorList.TICKABLE, this);
this.executor.requestRemovalFromList(BTExecutorList.OPEN, this);
ITaskState taskState = this.storeTerminationState();
this.executor.setTaskState(getPosition(), taskState);
this.internalTerminate();
}
}
/**
* This method is called form {@link #terminate()}, and it is the one that
* actually terminates the ExecutionTask as well as all the tasks below it.
* <p>
* <code>internalTerminate()</code> has to stop all the processes associated
* to the ExecutionTask. For non-leaf tasks, this usually means that it has
* to terminate all its active children (by recursively calling
* <code>terminate()</code> on them). For leaf tasks, this means that it has
* to terminate the processes associated to them, so that they stop doing
* things.
* <p>
* For instance, an ExecutionParallel task has to call
* <code>terminate</code> on all of its alive (still running) children. An
* ExecutionSequence has to call <code>terminate()</code> on its current
* alive child. A leaf task that, say, is carrying out some process in an
* independent execution thread, should stop the thread.
* <p>
* This method can be called only once, and only once the task has already
* been spawned, so the implementation does not have to even consider what
* happens in other cases.
*/
protected abstract void internalTerminate();
/**
* Fires a TaskEvent in all the listeners of this task. The TaskEvent will
* inform about an important change in the status of the task.
*
* @param newStatus
* the new status of the task.
*/
private void fireTaskEvent(Status newStatus) {
for (ITaskListener l : this.listeners) {
l.statusChanged(new TaskEvent(this, newStatus, this.getStatus()));
}
}
/**
* Returns the index that the ModelTask associated to this ExecutionTask
* occupies in the list of children of its parent's children. Returns 0 if
* the this ExecutionTask's ModelTask cannot be found.
* <p>
* The fact that the 0-case is contemplated is due to the existence of the
* Subtree Lookup operator. The ModelSubtreeLookup does not have any
* children, because it is a leaf node. However, the ExecutionSubtreeLookup
* does have one child, which is the root of the tree that it is going to
* emulate. As a result, the root of the tree emulated by the Subtree Lookup
* cannot find itself as a child of its parent (the parent is the
* ExecutionSubtreeLookup); as a workaround, we can return 0, since it is
* the 0-th child of the ExecutionSubtreeLookup.
*/
private int getMove() {
List<ModelTask> parentsChildren = this.parent.getModelTask().getChildren();
Iterator<ModelTask> iterator = parentsChildren.iterator();
ModelTask thisModelTask = this.getModelTask();
for (int i = 0; i < parentsChildren.size(); i++) {
if (iterator.next() == thisModelTask) {
return i;
}
}
return 0;
}
/**
* Checks if a Status returned by {@link #internalTick()} is valid or not.
* <code>internalTick()</code> can only return {@link Status#SUCCESS},
* {@link Status#FAILURE} and {@link Status#RUNNING}.
*
* @param status
* the status to check.
* @return true if <code>status</code> can be returned by
* <code>internalTick()</code>, and false otherwise.
*/
private static boolean validInternalTickStatus(Status status) {
if (status == Status.TERMINATED || status == Status.UNINITIALIZED) {
return false;
}
return true;
}
/**
*
* @see java.lang.Object#toString()
*/
public String toString() {
return "[" + this.getClass().getSimpleName() + ", Status: " + this.status.toString() + "]";
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/IBTExecutor.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import jbt.execution.core.ExecutionTask.Status;
import jbt.model.core.ModelTask;
/**
* A behaviour tree executor (entity that is able to run a behaviour tree) must
* implement this interface.
* <p>
* This is the part of the behaviour trees execution interface that is exposed
* to clients. The execution process of behaviour trees is driven by ticks,
* which means that they only perform calculations when they are ticked. At
* every tick, they are given a little amount of time to think and evolve as
* expected. If a behaviour tree is not ticked, then it does not go on.
* <p>
* An IBTExecutor defines two main methods, one for ticking the behaviour tree
* it is running, and another one for terminating the tree.
* <p>
* Behaviour trees are represented by the ModelTask class.
*
* @author Ricardo Juan Palma Durán
*
*/
public interface IBTExecutor {
/**
* This method gives the underlying BT a little amount of time to run.
* <p>
* Initially, a IBTExecutor is created to run a particular BT (ModelTask).
* From then on, the <code>tick()</code> method is called to make the tree
* evolve.
* <p>
* Usually the AI of a game is driven by ticks, which means that
* periodically the AI is given some time to update its state (it checks the
* current game state and performs some actions). BTs follow this pattern,
* so whenever they are ticked, they are given a little amount of time to
* think and behave as expected. If BTs are not ticked, they do not consume
* CPU time and they not evolve.
* <p>
* By calling this method, the underlying BT will be ticked, so it will
* think and evolve accordingly.
* <p>
* Note that ticking a tree that has already finished should have no effect
* on the tree.
*/
public void tick();
/**
* Terminates the execution of the behaviour tree. This method can be called
* even if the tree has not started running yet or if it has already been
* terminated.
*/
public void terminate();
/**
* Returns the behaviour tree that this IBTExecutor is running. The
* behaviour tree is represented by its root, which is a single ModelTask
* object.
*
* @return the behaviour tree that this IBTExecutor is running.
*/
public ModelTask getBehaviourTree();
/**
* Returns the execution status of the behaviour tree. It is the status of
* the root of the tree.
*
* @return the execution status of the behaviour tree. It is the status of
* the root of the tree.
*/
public Status getStatus();
/**
* Returns the context that was associated to the root node of the behaviour
* tree, and which is being used to run it.
*
* @return the context that was associated to the root node of the behaviour
* tree, and which is being used to run it.
*/
public IContext getRootContext();
}
================================================
FILE: JBTCore/src/jbt/execution/core/IBTLibrary.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import jbt.model.core.ModelTask;
import jbt.util.Pair;
/**
* Common interface for all behaviour tree libraries. A behaviour tree library
* is just a repository from which behaviour trees can be retrieved by name.
* <p>
* This is an <i>iterable</i> interface (it extends {@link Iterable}) so that
* all the behaviour trees of the library can be easily accessed.
*
* @author Ricardo Juan Palma Durán
*
*/
public interface IBTLibrary extends Iterable<Pair<String, ModelTask>> {
/**
* Returns the behaviour tree whose name is <code>name</code>. This method
* returns the root task of the tree.
*
* @param name
* the name of the tree to retrieve.
* @return the behaviour tree whose name is <code>name</code>, or null in
* case it does not exist.
*/
public ModelTask getBT(String name);
}
================================================
FILE: JBTCore/src/jbt/execution/core/IContext.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import jbt.model.core.ModelTask;
/**
* Interface defining the context of a behavior tree task. The context of a task
* is a set of variables, each one consisting of a name and a value. This
* interface defines some methods for manipulating such variables.
* <p>
* A context also contains a set of behaviour trees that can be accessed by
* tasks using the context. Reusability is very important for behaviour trees.
* In general, a behaviour tree will be made of some tasks of its own as well as
* references to other behaviour trees. When tasks need to retrieve references
* to other behaviour trees, it will be the context that will provide with them.
* Thus, the context defines a method for retrieving behaviour trees by name.
*
* @author Ricardo Juan Palma Durán
*
*/
public interface IContext {
/**
* Returns the value of a variable whose name is <code>name</code>, or null
* if it is not found.
*
* @param name
* the name of the variable to retrieve.
*
* @return the value of a variable whose name is <code>name</code>, or null
* if it does not exist.
*/
public Object getVariable(String name);
/**
* Sets the value of a variable. If the variable already existed, its value
* is overwritten. <code>value</code> may be null in order to clear the
* value of the variable.
*
* @param name
* the name of the variable.
* @param value
* the value for the variable.
* @return true if a variable with the same name already existed, and false
* otherwise.
*/
public boolean setVariable(String name, Object value);
/**
* Clears the set of all the variables of the context.
*/
public void clear();
/**
* Clears the value of a variable. This is equivalent to calling
* {@link #setVariable(String, Object)} with a value of null for the second
* argument.
*
* @param name
* the name of a variable.
* @return true if the variable existed, and false otherwise.
*/
public boolean clearVariable(String name);
/**
* Returns the behaviour tree whose name is <code>name</code>, or null in
* case it does not exist it the context.
*
* @param name
* the name of the tree to retrieve.
* @return the root of the behaviour tree whose name is <code>name</code>,
* or null in case it does not exist in the context.
*/
public ModelTask getBT(String name);
}
================================================
FILE: JBTCore/src/jbt/execution/core/ITaskState.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
/**
* The ITaskState interface represents the persistent state of a task in a
* behaviour tree. This state is represented as a set of variables with name and
* value.
* <p>
* Some tasks in BTs are persistent in the sense that, after finishing, if they
* are spawned again, they remember past information. Take for example the
* "limit" task. A "limit" task allows to run its child node only a certain
* number of times (for example, 5). After being spawned, it has to remember how
* many times it has been run so far, so that, once the threshold is exceeded,
* it fails.
* <p>
* This interface represents the common functionality for classes that represent
* the persistent state of a task. It just defines a method for retrieving the
* value of a variable of the task's state. They way the task's state is
* populated is not defined.
*
* @author Ricardo Juan Palma Durán
*
*/
public interface ITaskState {
/**
* Returns the value of a variable whose name is <code>name</code>, or null
* if it is not found.
*
* @param name
* the name of the variable to retrieve.
*
* @return the value of a variable whose name is <code>name</code>, or null
* if it does not exist.
*/
public Object getStateVariable(String name);
}
================================================
FILE: JBTCore/src/jbt/execution/core/TaskState.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import java.util.Hashtable;
import java.util.Map;
/**
* Default implementation of the {@link ITaskState} interface. It provides
* methods for modifying the set of variables stored by the TaskState.
*
* @author Ricardo Juan Palma Durán
*
*/
public class TaskState implements ITaskState {
/** The set of variables. */
private Map<String, Object> variables;
/**
* Constructs an empty TaskState.
*/
public TaskState() {
this.variables = new Hashtable<String, Object>();
}
/**
*
* @see jbt.execution.core.ITaskState#getStateVariable(java.lang.String)
*/
public Object getStateVariable(String name) {
return this.variables.get(name);
}
/**
* Sets the value of a variable. If the value is null, the variable is
* cleared.
*
* @param name
* the name of the variable.
* @param value
* the value of the variable.
* @return true if there was a variable with name <code>name</code> before
* calling this method (it is therefore been overwritten), and false
* otherwise.
*/
public boolean setStateVariable(String name, Object value) {
if (value == null) {
return this.variables.remove(name) == null ? false : true;
}
return this.variables.put(name, value) == null ? false : true;
}
/**
* Clears all the variables of the TaskState.
*/
public void clear() {
this.variables.clear();
}
/**
* Clears the value of a variable.
*
* @param name
* the name of the variable.
* @return true if the variable existed before calling this method, and
* false otherwise.
*/
public boolean clearStateVariable(String name) {
return this.variables.remove(name) == null ? false : true;
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/TaskStateFactory.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import jbt.util.Pair;
/**
* The TaskStateFactory implements the simple factory pattern, and allows
* clients of the framework to create instances of {@link ITaskState} objects.
* The methods provided by this factory allows the client to specify the set of
* variables that the task state will contain.
*
* @author Ricardo Juan Palma Durán
*
*/
public class TaskStateFactory {
/**
* Creates an ITaskState that contains the set of variables specified by
* <code>variables</code>. Each variable is a Pair whose first element is
* the variable's name and the second element is its value.
*
* @param variables
* the list of variables that the ITaskState will contain.
* @return an ITaskState that contains the set of variables in
* <code>variables</code>.
*/
public static ITaskState createTaskState(List<Pair<String, Object>> variables) {
TaskState taskState = new TaskState();
for (Pair<String, Object> variable : variables) {
taskState.setStateVariable(variable.getFirst(), variable.getSecond());
}
return taskState;
}
/**
* Creates an ITaskState that contains the set of variables specified by
* <code>variables</code>. Variables are stored in a Map whose keys are
* variables' names and whose values are the values of the variables.
*
* @param variables
* the list of variables that the ITaskState will contain.
* @return an ITaskState that contains the set of variables in
* <code>variables</code>.
*/
public static ITaskState createTaskState(Map<String, Object> variables) {
TaskState taskState = new TaskState();
for (Entry<String, Object> variable : variables.entrySet()) {
taskState.setStateVariable(variable.getKey(), variable.getValue());
}
return taskState;
}
}
================================================
FILE: JBTCore/src/jbt/execution/core/event/ITaskListener.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core.event;
import jbt.execution.core.ExecutionTask;
/**
* Interface for an entity that is able to receive events from tasks (
* {@link ExecutionTask}) whose status has changed in a relevant way.
*
* @author Ricardo Juan Palma Durán
*
*/
public interface ITaskListener {
/**
* Method called when an important change in the status of a task has taken
* place.
*
* @param e
* the TaskEvent with all the information about the change in the
* status of the task.
*/
public void statusChanged(TaskEvent e);
}
================================================
FILE: JBTCore/src/jbt/execution/core/event/TaskEvent.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.core.event;
import java.util.EventObject;
import jbt.execution.core.ExecutionTask;
import jbt.execution.core.ExecutionTask.Status;
/**
* A TaskEvent is an event that is generated by tasks ({@link ExecutionTask}) to
* signal that a relevant change in the status of a task has taken place.
*
* @author Ricardo Juan Palma Durán
*
*/
public class TaskEvent extends EventObject {
private static final long serialVersionUID = 1L;
/** The new status of the task. */
private Status newStatus;
/** The previous status of the task. */
private Status previousStatus;
/**
* Creates a TaskEvent with a particular ExcutionTask as source of the
* event. The source (<code>source</code>) is the task whose status has
* changed, and <code>newStatus</code> is the new status of the task.
*
* @param source
* the task whose status has changed.
* @param newStatus
* the new status of the task.
*/
public TaskEvent(ExecutionTask source, Status newStatus, Status previousStatus) {
super(source);
this.newStatus = newStatus;
this.previousStatus = previousStatus;
}
/**
* Returns the new status associated to the task.
*
* @return the new status associated to the task.
*/
public Status getNewStatus() {
return this.newStatus;
}
/**
* Returns the previous status associated to the task.
*
* @return the previous status associated to the task.
*/
public Status getPreviousStatus() {
return this.previousStatus;
}
}
================================================
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionComposite.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.task.composite;
import jbt.execution.core.BTExecutor;
import jbt.execution.core.ExecutionTask;
import jbt.model.core.ModelTask;
import jbt.model.task.composite.ModelComposite;
/**
* Base class for all the ExecutionTask subclasses that are able to run
* composite tasks (that is, classes that inherit from ModelComposite).
*
* @author Ricardo Juan Palma Durán
*
*/
public abstract class ExecutionComposite extends ExecutionTask {
/**
* Creates an ExecutionComposite that is able to run a particular
* ModelComposite task.
*
* @param modelTask
* the ModelComposite task to run.
* @param executor
* the BTExecutor that will manage this ExecutionComposite.
* @param parent
* the parent ExecutionTask of this task.
*/
public ExecutionComposite(ModelTask modelTask, BTExecutor executor, ExecutionTask parent) {
super(modelTask, executor, parent);
if (!(modelTask instanceof ModelComposite)) {
throw new IllegalArgumentException("The ModelTask must subclass "
+ ModelComposite.class.getCanonicalName() + " but it inherits from "
+ modelTask.getClass().getCanonicalName());
}
}
}
================================================
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionDynamicPriorityList.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.task.composite;
import java.util.List;
import java.util.Vector;
import jbt.execution.core.BTExecutor;
import jbt.execution.core.ExecutionTask;
import jbt.execution.core.IBTExecutor;
import jbt.execution.core.BTExecutor.BTExecutorList;
import jbt.execution.core.ITaskState;
import jbt.execution.core.event.TaskEvent;
import jbt.model.core.ModelTask;
import jbt.model.task.composite.ModelDynamicPriorityList;
import jbt.util.Pair;
/**
* ExecutionDynamicPriorityList is the ExecutionTask that knows how to run a
* ModelDynamicPriorityList.
*
* @author Ricardo Juan Palma Durán
*
*/
public class ExecutionDynamicPriorityList extends ExecutionComposite {
/** List of the children (ModelTask) of this task. */
private List<ModelTask> children;
/** Flag telling if the spawning process has failed. */
private boolean spawnFailed;
/** Flag that tells if there is a spawned child. */
private boolean stillNotSpawned;
/** Index of the currently active child. */
private int activeChildIndex;
/** Currently active child. */
private ExecutionTask activeChild;
/**
* List containing the IBTExecutors in charge of running the guards. The i-th element of this
* list manages the guard of the i-th child ( {@link #children}). Note that if a guard is null,
* its corresponding IBTExecutor is also null.
*/
private List<BTExecutor> guardsExecutors;
/**
* This List contains the current evaluation status of all the guards. If a guard is null, its
* corresponding status is {@link Status#SUCCESS} (null guards are evaluated to true).
*/
private List<Status> guardsResults;
/**
* Index of the current most relevant guard. All the guards before it have finished in failure.
* This represents the guard such that, if its status changes to success, then it would be the
* one selected by the dynamic priority list.
*/
private int indexMostRelevantGuard = 0;
/**
* Creates an ExecutionDynamicPriorityList that is able to run a ModelDynamicPriorityList task
* and that is managed by a BTExecutor.
*
* @param modelTask
* the ModelDynamicPriorityList that this ExecutionDynamicPriorityList is going to
* run.
* @param executor
* the BTExecutor in charge of running this ExecutionDynamicPriorityList.
* @param parent
* the parent ExecutionTask of this task.
*/
public ExecutionDynamicPriorityList(ModelTask modelTask, BTExecutor executor,
ExecutionTask parent) {
super(modelTask, executor, parent);
if (!(modelTask instanceof ModelDynamicPriorityList)) {
throw new IllegalArgumentException("The ModelTask must subclass "
+ ModelDynamicPriorityList.class.getCanonicalName() + " but it inherits from "
+ modelTask.getClass().getCanonicalName());
}
}
/**
* Spawns the first child with active guard. It also requests to be inserted into the list of
* tickable nodes of the BTExecutor, since this task has to check its children's guards all the
* time. If there is no active guard, the spawning process is considered to have failed, so
* {@link #internalTick()} will return {@link Status#FAILURE}. If some guards are still running
* the spawning process is not considered to have started yet.
*
* @see jbt.execution.core.ExecutionTask#internalSpawn()
*/
protected void internalSpawn() {
/*
* The dynamic priority list has to be inserted into the list of tickable nodes because it
* has to check its children's guards all the time.
*/
this.getExecutor().requestInsertionIntoList(BTExecutorList.TICKABLE, this);
this.children = this.getModelTask().getChildren();
/* Initialize guard executors. */
this.guardsExecutors = new Vector<BTExecutor>();
this.guardsResults = new Vector<Status>();
for (ModelTask child : this.children) {
if (child.getGuard() != null) {
this.guardsExecutors.add(new BTExecutor(child.getGuard(), this.getContext()));
this.guardsResults.add(Status.RUNNING);
} else {
this.guardsExecutors.add(null);
this.guardsResults.add(Status.SUCCESS);
}
}
/* Evaluate guards. */
resetGuardsEvaluation();
Pair<Status, Integer> activeGuard = evaluateGuards();
/* If all guards have failed, the spawning process has also failed. */
if (activeGuard.getFirst() == Status.FAILURE) {
this.spawnFailed = true;
} else if (activeGuard.getFirst() == Status.RUNNING) {
/*
* If not all the guards have been evaluated yet, the spawning process is not considered
* to have started.
*/
this.stillNotSpawned = true;
} else {
/*
* If all the guards have been evaluated and one succeeded, spawn the corresponding
* child.
*/
this.spawnFailed = false;
this.stillNotSpawned = false;
this.activeChildIndex = activeGuard.getSecond();
this.activeChild = this.children.get(this.activeChildIndex).createExecutor(
this.getExecutor(), this);
this.activeChild.addTaskListener(this);
this.activeChild.spawn(this.getContext());
/* Reset the guards evaluators. */
resetGuardsEvaluation();
}
}
/**
* Just terminates the currently active child (if there is one).
*
* @see jbt.execution.core.ExecutionTask#internalTerminate()
*/
protected void internalTerminate() {
/*
* This null check is necessary. Keep in mind that the dynamic priority list may not have an
* active child, since the spawning process may have failed or not started yet. In such a
* case, if it is terminated, "this.activeChild" will be null.
*/
if (this.activeChild != null) {
this.activeChild.terminate();
}
/* Terminate the guards executors. */
for (IBTExecutor guardExecutor : this.guardsExecutors) {
if (guardExecutor != null) {
guardExecutor.terminate();
}
}
}
/**
* Checks if there is an active guard with a priority higher than that of the active child. If
* there is such a task, it terminates the active child and spawns the child of the guard with
* higher priority, and {@link Status#RUNNING} is returned. If there is no such task, then the
* status of the active child is returned.
* <p>
* If the spawning process failed, this method just returns {@link Status#FAILURE}. If the
* spawning process has not finished yet, this method keeps evaluating the guards, and returns
* {@link Status#RUNNING}.
*
* @see jbt.execution.core.ExecutionTask#internalTick()
*/
protected Status internalTick() {
/* If the spawning process failed, return failure. */
if (this.spawnFailed) {
return Status.FAILURE;
}
/* Evaluate guards. */
Pair<Status, Integer> activeGuard = evaluateGuards();
/*
* If no child has been spawned yet (not all the guards had completed yet in the
* internalSpawn() method)...
*/
if (this.stillNotSpawned) {
/* If all the guards have failed, return failure. */
if (activeGuard.getFirst() == Status.FAILURE) {
return Status.FAILURE;
} else if (activeGuard.getFirst() == Status.RUNNING) {
/*
* If not all the guards have finished, do no nothing (return RUNNING).
*/
} else {
/*
* If all the guards have been evaluated and one succeeded, spawn the child.
*/
this.spawnFailed = false;
this.stillNotSpawned = false;
this.activeChildIndex = activeGuard.getSecond();
this.activeChild = this.children.get(this.activeChildIndex).createExecutor(
this.getExecutor(), this);
this.activeChild.addTaskListener(this);
this.activeChild.spawn(this.getContext());
/* Reset the guards evaluators. */
resetGuardsEvaluation();
}
return Status.RUNNING;
}
/* If this point has been reached, there must be an active child. */
if (activeGuard.getFirst() == Status.FAILURE) {
/* If all the guards have failed, return failure. */
return Status.FAILURE;
} else if (activeGuard.getFirst() == Status.RUNNING) {
/*
* If the guards are being evaluated, return the status of the active child.
*/
return this.activeChild.getStatus();
} else {
if (activeGuard.getSecond() != this.activeChildIndex) {
/*
* If the child with the highest priority guard has changed, terminate the currently
* active child.
*/
this.activeChild.terminate();
this.activeChildIndex = activeGuard.getSecond();
/*
* Spawn the new child.
*/
this.activeChild = this.children.get(this.activeChildIndex).createExecutor(
this.getExecutor(), this);
this.activeChild.addTaskListener(this);
this.activeChild.spawn(this.getContext());
resetGuardsEvaluation();
return Status.RUNNING;
} else {
/*
* If the child with the highest priority guard has not changed, return the status
* of the active child.
*/
resetGuardsEvaluation();
return this.activeChild.getStatus();
}
}
}
/**
* Does nothing.
*
* @see jbt.execution.core.ExecutionTask#restoreState(ITaskState)
*/
protected void restoreState(ITaskState state) {
}
/**
* Just calls {@link #tick()} to make the task evolve.
*
* @see jbt.execution.core.ExecutionTask#statusChanged(jbt.execution.core.event.TaskEvent)
*/
public void statusChanged(TaskEvent e) {
this.tick();
}
/**
* Does nothing.
*
* @see jbt.execution.core.ExecutionTask#storeState()
*/
protected ITaskState storeState() {
return null;
}
/**
* Resets the evaluation of all the guards. This method leaves all the guard executors (
* {@link #guardsExecutors}) ready to start again the evaluation of the guards. It internally
* terminates the IBTExecutor of each guard, creates a new one, and then ticks it.
*/
private void resetGuardsEvaluation() {
for (int i = 0; i < this.guardsExecutors.size(); i++) {
BTExecutor guardExecutor = this.guardsExecutors.get(i);
if (guardExecutor != null) {
guardExecutor.terminate();
this.guardsResults.set(i, Status.RUNNING);
BTExecutor newExecutor = new BTExecutor(guardExecutor.getBehaviourTree(),
this.getContext());
newExecutor.copyTasksStates(guardExecutor);
newExecutor.tick();
this.guardsExecutors.set(i, newExecutor);
}
}
this.indexMostRelevantGuard = 0;
}
/**
* Evaluate all the guards that have not finished yet, that is, those whose result in
* {@link #guardsResults} is {@link Status#RUNNING}, by ticking them.
* <p>
* If all the guards have finished in failure, this method returns a Pair whose first element is
* {@link Status#FAILURE}. If guards' evaluation has not completed yet, the first element of the
* Pair contains {@link Status#RUNNING}. If all the guards have been evaluated and at least one
* has succeeded, the first element of the Pair is {@link Status#SUCCESS}, and the second one is
* the index, over the list of guards ({@link #guardsExecutors}) , of the first guard (that with
* the highest priority) that has succeeded.
*
*/
private Pair<Status, Integer> evaluateGuards() {
/*
* Tick all the guards that are still running. If one changes its status to SUCCESS and it
* matches the guard associated to "indexMostRelevantGuard", then the guards' evaluation is
* over and that is the selected guard.
*/
for (int i = 0; i < this.guardsExecutors.size(); i++) {
IBTExecutor guardExecutor = this.guardsExecutors.get(i);
if (guardExecutor != null) {
if (this.guardsResults.get(i) == Status.RUNNING) {
longTick(guardExecutor);
this.guardsResults.set(i, guardExecutor.getStatus());
if (guardExecutor.getStatus() != Status.RUNNING) {
/*
* If the guard has finished, we check if it matches the
* "most relevant guard".
*/
if (i == this.indexMostRelevantGuard) {
if (guardExecutor.getStatus() == Status.SUCCESS) {
return new Pair<Status, Integer>(Status.SUCCESS, i);
} else {
/*
* If the guard failed, we have to find the next
* "most relevant guard" and update "indexMostRelevantGuard"
* accordingly. For that we check the status of the following
* guards. If we find a successful guard before any running guard,
* then the guards' evaluation is over, and that is the selected
* guard. If we find a running guard before, then that's the new
* "most relevant guard". Otherwise, the evaluation has failed, and
* there is no successful guard.
*/
boolean oneRunning = false;
for (int k = this.indexMostRelevantGuard + 1; k < this.guardsExecutors
.size(); k++) {
if (this.guardsExecutors.get(k) != null) {
Status currentResult = this.guardsExecutors.get(k)
.getStatus();
if (currentResult == Status.RUNNING) {
this.indexMostRelevantGuard = k;
oneRunning = true;
break;
} else if (currentResult == Status.SUCCESS) {
return new Pair<Status, Integer>(Status.SUCCESS, k);
}
} else {
return new Pair<Status, Integer>(Status.SUCCESS, k);
}
}
if (!oneRunning) {
return new Pair<Status, Integer>(Status.FAILURE, -1);
}
}
}
}
}
} else {
/* Remember, null guard means successful evaluation. */
if (i == this.indexMostRelevantGuard) {
return new Pair<Status, Integer>(Status.SUCCESS, i);
}
}
}
return new Pair<Status, Integer>(Status.RUNNING, -1);
}
/**
* Does nothing.
*
* @see jbt.execution.core.ExecutionTask#storeTerminationState()
*/
protected ITaskState storeTerminationState() {
return null;
}
/**
* This method ticks <code>executor</code> {@value #NUM_TICKS_LONG_TICK} times. If the executor
* finishes earlier, it is not ticked anymore, and the ticking process stops.
*
* @param executor
* the IBTExecutor that is ticked.
*/
private void longTick(IBTExecutor executor) {
if (executor.getStatus() == Status.RUNNING || executor.getStatus() == Status.UNINITIALIZED) {
int counter = 0;
do {
executor.tick();
counter++;
} while (executor.getStatus() == Status.RUNNING && counter < NUM_TICKS_LONG_TICK);
}
}
/** Number of ticks performed in each long tick ({@link #longTick(IBTExecutor)}). */
private static final int NUM_TICKS_LONG_TICK = 20;
}
================================================
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionParallel.java
================================================
/*
* Copyright (C) 2012 Ricardo Juan Palma Durán
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jbt.execution.task.composite;
import java.util.LinkedList;
import java.util.List;
import jbt.execution.core.BTExecutor;
import jbt.execution.core.ExecutionTask;
import jbt.execution.core.ITaskState;
import jbt.execution.core.event.TaskEvent;
import jbt.model.core.ModelTask;
import jbt.model.task.composite.ModelParallel;
import jbt.model.task.composite.ModelParallel.ParallelPolicy;
/**
* ExecutionParallel is the ExecutionTask that knows how to run a ModelParallel
* task.
*
* @author Ricardo Juan Palma Durán
*
*/
public class ExecutionParallel extends ExecutionComposite {
/** Policy of the parallel task. */
private ParallelPolicy policy;
/** List of the ModelTask children of this task. */
private List<ModelTask> modelChildren;
/** List of the ExecutionTask children of this task. */
private List<ExecutionTask> executionChildren;
/**
* Creates an ExecutionParallel that is able to run a ModelParallel task and
* that is managed by a BTExecutor.
*
* @param modelTask
* the ModelParallel that this ExecutionParallel is going to run.
* @param executor
* the BTExecutor in charge of running this ExecutionParallel.
* @param parent
* the parent ExecutionTask of this task.
*/
public ExecutionParallel(ModelTask modelTask, BTExecutor executor, ExecutionTask parent) {
super(modelTask, executor, parent);
if (!(modelTask instanceof ModelParallel)) {
throw new IllegalArgumentException("The ModelTask must subclass "
+ ModelParallel.class.getCanonicalName() + " but it inherits from "
+ modelTask.getClass().getCanonicalName());
}
this.policy = ((ModelParallel) modelTask).getPolicy();
this.modelChildren = modelTask.getChildren();
this.executionChildren = new LinkedList<ExecutionTask>();
}
/**
* Spawns every single child of the task.
*
* @see jbt.execution.core.ExecutionTask#internalSpawn()
*/
protected void internalSpawn() {
if (this.policy == ParallelPolicy.SEQUENCE_POLICY) {
sequencePolicySpawn();
}
else {
selectorPolicySpawn();
}
}
/**
* Terminates all of its children.
*
* @see jbt.execution.core.ExecutionTask#internalTerminate()
*/
protected void internalTerminate() {
if (this.policy == ParallelPolicy.SEQUENCE_POLICY) {
sequencePolicyTerminate();
}
else {
selectorPolicyTerminate();
}
}
/**
* Ticks this ExecutionParallel. This process varies depending on the
* policy. that is being followed. See {@link ModelParallel} for more
* information.
*
* @see jbt.execution.core.ExecutionTask#internalTick()
*/
protected Status internalTick() {
if (this.policy == ParallelPolicy.SEQUENCE_POLICY) {
return sequencePolicyTick();
}
else {
return selectorPolicyTick();
}
}
/**
* Carries out the spawning process when the policy is
* {@link ParallelPolicy#SEQUENCE_POLICY}.
*/
private void sequencePolicySpawn() {
/* First, create an ExecutionTask for all of the childre. */
for (ModelTask t : this.modelChildren) {
this.executionChildren.add(t.createExecutor(this.getExecutor(), this));
}
/* Then, spawn them all. */
for (ExecutionTask t : this.executionChildren) {
t.addTaskListener(this);
t.spawn(this.getContext());
}
}
/**
* Carries out the spawning process when the policy is
* {@link ParallelPolicy#SELECTOR_POLICY}.
*/
private void selectorPolicySpawn() {
sequencePolicySpawn();
}
/**
* Carries out the termination process when the policy is
* {@link ParallelPolicy#SEQUENCE_POLICY}.
*/
private void sequencePolicyTerminate() {
/* Just terminate all of its children. */
for (ExecutionTask t : this.executionChildren) {
t.terminate();
}
}
/**
* Carries out the termination process when the policy is
* {@link ParallelPolicy#SELECTOR_POLICY}.
*/
private void selectorPolicyTerminate() {
sequencePolicyTerminate();
}
/**
* Carries out the ticking process when the policy is
* {@link ParallelPolicy#SEQUENCE_POLICY}.
*
* @return the task status afte
gitextract_1wlvd9oh/
├── Documentation/
│ ├── Images/
│ │ └── Source/
│ │ └── Overview.odg
│ ├── JBT.tex
│ └── JBTBib.bib
├── JBTCore/
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── libs/
│ │ ├── jargs.jar
│ │ ├── jdom.jar
│ │ ├── mmpm.jar
│ │ └── sourceformatter.jar
│ └── src/
│ └── jbt/
│ ├── exception/
│ │ ├── IllegalReturnStatusException.java
│ │ ├── NotTickableException.java
│ │ ├── SpawnException.java
│ │ └── TickException.java
│ ├── execution/
│ │ ├── context/
│ │ │ ├── BasicContext.java
│ │ │ ├── GenericBTLibrary.java
│ │ │ ├── HierarchicalContext.java
│ │ │ ├── SafeContext.java
│ │ │ └── SafeOutputContext.java
│ │ ├── core/
│ │ │ ├── BTExecutor.java
│ │ │ ├── BTExecutorFactory.java
│ │ │ ├── BTLibraryFactory.java
│ │ │ ├── ContextFactory.java
│ │ │ ├── ExecutionTask.java
│ │ │ ├── IBTExecutor.java
│ │ │ ├── IBTLibrary.java
│ │ │ ├── IContext.java
│ │ │ ├── ITaskState.java
│ │ │ ├── TaskState.java
│ │ │ ├── TaskStateFactory.java
│ │ │ └── event/
│ │ │ ├── ITaskListener.java
│ │ │ └── TaskEvent.java
│ │ └── task/
│ │ ├── composite/
│ │ │ ├── ExecutionComposite.java
│ │ │ ├── ExecutionDynamicPriorityList.java
│ │ │ ├── ExecutionParallel.java
│ │ │ ├── ExecutionRandomSelector.java
│ │ │ ├── ExecutionRandomSequence.java
│ │ │ ├── ExecutionSelector.java
│ │ │ ├── ExecutionSequence.java
│ │ │ └── ExecutionStaticPriorityList.java
│ │ ├── decorator/
│ │ │ ├── ExecutionDecorator.java
│ │ │ ├── ExecutionHierarchicalContextManager.java
│ │ │ ├── ExecutionInterrupter.java
│ │ │ ├── ExecutionInverter.java
│ │ │ ├── ExecutionLimit.java
│ │ │ ├── ExecutionRepeat.java
│ │ │ ├── ExecutionSafeContextManager.java
│ │ │ ├── ExecutionSafeOutputContextManager.java
│ │ │ ├── ExecutionSucceeder.java
│ │ │ └── ExecutionUntilFail.java
│ │ └── leaf/
│ │ ├── ExecutionFailure.java
│ │ ├── ExecutionLeaf.java
│ │ ├── ExecutionPerformInterruption.java
│ │ ├── ExecutionSubtreeLookup.java
│ │ ├── ExecutionSuccess.java
│ │ ├── ExecutionVariableRenamer.java
│ │ ├── ExecutionWait.java
│ │ ├── action/
│ │ │ └── ExecutionAction.java
│ │ └── condition/
│ │ └── ExecutionCondition.java
│ ├── model/
│ │ ├── core/
│ │ │ └── ModelTask.java
│ │ └── task/
│ │ ├── composite/
│ │ │ ├── ModelComposite.java
│ │ │ ├── ModelDynamicPriorityList.java
│ │ │ ├── ModelParallel.java
│ │ │ ├── ModelRandomSelector.java
│ │ │ ├── ModelRandomSequence.java
│ │ │ ├── ModelSelector.java
│ │ │ ├── ModelSequence.java
│ │ │ └── ModelStaticPriorityList.java
│ │ ├── decorator/
│ │ │ ├── ModelDecorator.java
│ │ │ ├── ModelHierarchicalContextManager.java
│ │ │ ├── ModelInterrupter.java
│ │ │ ├── ModelInverter.java
│ │ │ ├── ModelLimit.java
│ │ │ ├── ModelRepeat.java
│ │ │ ├── ModelSafeContextManager.java
│ │ │ ├── ModelSafeOutputContextManager.java
│ │ │ ├── ModelSucceeder.java
│ │ │ └── ModelUntilFail.java
│ │ └── leaf/
│ │ ├── ModelFailure.java
│ │ ├── ModelLeaf.java
│ │ ├── ModelPerformInterruption.java
│ │ ├── ModelSubtreeLookup.java
│ │ ├── ModelSuccess.java
│ │ ├── ModelVariableRenamer.java
│ │ ├── ModelWait.java
│ │ ├── action/
│ │ │ └── ModelAction.java
│ │ └── condition/
│ │ └── ModelCondition.java
│ ├── tools/
│ │ └── btlibrarygenerator/
│ │ ├── ActionsAndConditionsGenerator.java
│ │ ├── BTLibraryGenerator.java
│ │ ├── librarygenerator/
│ │ │ ├── BTLibraryGenerationException.java
│ │ │ └── BTLibraryGenerator.java
│ │ ├── lowlevelgenerator/
│ │ │ ├── ActionsGenerator.java
│ │ │ ├── CommonCodeGenerationUtilities.java
│ │ │ └── ConditionsGenerator.java
│ │ ├── modelbtgenerator/
│ │ │ ├── ModelBTGenerationException.java
│ │ │ └── ModelBTGenerator.java
│ │ └── util/
│ │ └── Util.java
│ └── util/
│ └── Pair.java
├── JBTEditor/
│ ├── jbt.tools.bteditor/
│ │ ├── .classpath
│ │ ├── .gitignore
│ │ ├── .project
│ │ ├── .settings/
│ │ │ └── org.eclipse.jdt.core.prefs
│ │ ├── META-INF/
│ │ │ └── MANIFEST.MF
│ │ ├── bteditor.product
│ │ ├── build.properties
│ │ ├── files/
│ │ │ └── standardNodes.xml
│ │ ├── icons/
│ │ │ ├── jbt.icns
│ │ │ └── jbt.xpm
│ │ ├── libs/
│ │ │ ├── jdom.jar
│ │ │ └── mmpm.jar
│ │ ├── plugin.xml
│ │ ├── plugin_customization.ini
│ │ └── src/
│ │ └── jbt/
│ │ └── tools/
│ │ └── bteditor/
│ │ ├── Activator.java
│ │ ├── Application.java
│ │ ├── ApplicationActionBarAdvisor.java
│ │ ├── ApplicationIcons.java
│ │ ├── ApplicationWorkbenchAdvisor.java
│ │ ├── ApplicationWorkbenchWindowAdvisor.java
│ │ ├── BTCPPManager.java
│ │ ├── BTXMLManager.java
│ │ ├── DisableNewEditorHandler.java
│ │ ├── NodesLoader.java
│ │ ├── Perspective.java
│ │ ├── actions/
│ │ │ ├── CheckErrorsAction.java
│ │ │ ├── ClearErrorsAction.java
│ │ │ ├── CollapseTreeAction.java
│ │ │ ├── DialogExportAsCppAction.java
│ │ │ ├── DialogLoadMMPMDomainAction.java
│ │ │ ├── DialogOpenBTAction.java
│ │ │ ├── EditorActionDelegate.java
│ │ │ ├── ExpandTreeAction.java
│ │ │ ├── ExportToCppAction.java
│ │ │ ├── LoadMMPMDomainAction.java
│ │ │ ├── NewBTAction.java
│ │ │ ├── OpenBTAction.java
│ │ │ ├── SaveBTAction.java
│ │ │ └── SaveBTAsAction.java
│ │ ├── editor/
│ │ │ ├── BTEditor.java
│ │ │ ├── BTEditorCopyAndPasteManager.java
│ │ │ ├── BTEditorIDGenerator.java
│ │ │ └── BTEditorInput.java
│ │ ├── event/
│ │ │ ├── ITreeModifierListener.java
│ │ │ └── TreeModifiedEvent.java
│ │ ├── model/
│ │ │ ├── BT.java
│ │ │ ├── BTNode.java
│ │ │ ├── ConceptualBTNode.java
│ │ │ └── ConceptualNodesTree.java
│ │ ├── util/
│ │ │ ├── DetailsDialog.java
│ │ │ ├── Extensions.java
│ │ │ ├── IconsPaths.java
│ │ │ ├── OverlayImageIcon.java
│ │ │ ├── Pair.java
│ │ │ ├── StandardDialogs.java
│ │ │ └── Utilities.java
│ │ ├── viewers/
│ │ │ ├── BTNodeIndentifierTransfer.java
│ │ │ ├── ConceptualBTNodeTransfer.java
│ │ │ ├── ConceptualNodesTreeViewer.java
│ │ │ └── NodeInfoViewer.java
│ │ └── views/
│ │ ├── NodeInfo.java
│ │ ├── NodesNavigator.java
│ │ └── NodesSearcher.java
│ └── jbt.tools.bteditor.feature/
│ ├── .project
│ ├── build.properties
│ └── feature.xml
├── LICENSE.txt
├── README.txt
└── UserGuide/
├── Images/
│ └── Source/
│ └── Overview.odg
├── UserGuide.tex
├── UserGuideBib.bib
└── userguide.kilepr
SYMBOL INDEX (1119 symbols across 137 files)
FILE: JBTCore/src/jbt/exception/IllegalReturnStatusException.java
class IllegalReturnStatusException (line 27) | public class IllegalReturnStatusException extends TickException {
method IllegalReturnStatusException (line 30) | public IllegalReturnStatusException(){
method IllegalReturnStatusException (line 34) | public IllegalReturnStatusException(String msg){
FILE: JBTCore/src/jbt/exception/NotTickableException.java
class NotTickableException (line 24) | public class NotTickableException extends TickException {
method NotTickableException (line 27) | public NotTickableException(){
method NotTickableException (line 31) | public NotTickableException(String msg){
FILE: JBTCore/src/jbt/exception/SpawnException.java
class SpawnException (line 24) | public class SpawnException extends RuntimeException {
method SpawnException (line 27) | public SpawnException() {
method SpawnException (line 31) | public SpawnException(String msg) {
FILE: JBTCore/src/jbt/exception/TickException.java
class TickException (line 24) | public abstract class TickException extends RuntimeException {
method TickException (line 27) | public TickException() {
method TickException (line 31) | public TickException(String msg) {
FILE: JBTCore/src/jbt/execution/context/BasicContext.java
class BasicContext (line 35) | public class BasicContext implements IContext {
method BasicContext (line 49) | public BasicContext() {
method getVariable (line 58) | public Object getVariable(String name) {
method setVariable (line 67) | public boolean setVariable(String name, Object value) {
method clear (line 78) | public void clear() {
method clearVariable (line 86) | public boolean clearVariable(String name) {
method addBTLibrary (line 102) | public boolean addBTLibrary(IBTLibrary library) {
method addBT (line 119) | public boolean addBT(String name, ModelTask tree) {
method getBT (line 127) | public ModelTask getBT(String name) {
FILE: JBTCore/src/jbt/execution/context/GenericBTLibrary.java
class GenericBTLibrary (line 34) | public class GenericBTLibrary implements IBTLibrary {
method GenericBTLibrary (line 43) | public GenericBTLibrary() {
method getBT (line 51) | public ModelTask getBT(String name) {
method iterator (line 63) | public Iterator<Pair<String, ModelTask>> iterator() {
method addBTLibrary (line 79) | public boolean addBTLibrary(IBTLibrary library) {
method addBT (line 104) | public boolean addBT(String name, ModelTask tree) {
class GenericBTLibraryIterator (line 121) | private class GenericBTLibraryIterator implements Iterator<Pair<String...
method GenericBTLibraryIterator (line 124) | public GenericBTLibraryIterator() {
method hasNext (line 128) | public boolean hasNext() {
method next (line 132) | public Pair<String, ModelTask> next() {
method remove (line 137) | public void remove() {
FILE: JBTCore/src/jbt/execution/context/HierarchicalContext.java
class HierarchicalContext (line 30) | public class HierarchicalContext extends BasicContext {
method HierarchicalContext (line 41) | public HierarchicalContext() {
method setParent (line 52) | public void setParent(IContext parent) {
method getVariable (line 66) | public Object getVariable(String name) {
FILE: JBTCore/src/jbt/execution/context/SafeContext.java
class SafeContext (line 45) | public class SafeContext implements IContext {
method SafeContext (line 71) | public SafeContext(IContext inputContext) {
method getVariable (line 92) | public Object getVariable(String name) {
method setVariable (line 120) | public boolean setVariable(String name, Object value) {
method clear (line 136) | public void clear() {
method clearVariable (line 152) | public boolean clearVariable(String name) {
method getBT (line 170) | public ModelTask getBT(String name) {
FILE: JBTCore/src/jbt/execution/context/SafeOutputContext.java
class SafeOutputContext (line 62) | public class SafeOutputContext implements IContext {
method SafeOutputContext (line 97) | public SafeOutputContext(IContext inputContext, List<String> outputVar...
method getVariable (line 120) | public Object getVariable(String name) {
method setVariable (line 152) | public boolean setVariable(String name, Object value) {
method clear (line 173) | public void clear() {
method clearVariable (line 193) | public boolean clearVariable(String name) {
method getBT (line 215) | public ModelTask getBT(String name) {
FILE: JBTCore/src/jbt/execution/core/BTExecutor.java
class BTExecutor (line 60) | public class BTExecutor implements IBTExecutor {
method BTExecutor (line 127) | public BTExecutor(ModelTask modelBT, IContext context) {
method BTExecutor (line 161) | public BTExecutor(ModelTask modelBT) {
method tick (line 183) | public void tick() {
method terminate (line 222) | public void terminate() {
method getExecutionInterrupter (line 238) | public ExecutionInterrupter getExecutionInterrupter(ModelInterrupter m...
method registerInterrupter (line 248) | public void registerInterrupter(ExecutionInterrupter interrupter) {
method unregisterInterrupter (line 258) | public void unregisterInterrupter(ExecutionInterrupter interrupter) {
type BTExecutorList (line 274) | public static enum BTExecutorList {
method requestInsertionIntoList (line 298) | public void requestInsertionIntoList(BTExecutorList listType, Executio...
method requestRemovalFromList (line 328) | public void requestRemovalFromList(BTExecutorList listType, ExecutionT...
method cancelInsertionRequest (line 349) | public void cancelInsertionRequest(BTExecutorList listType, ExecutionT...
method cancelRemovalRequest (line 366) | public void cancelRemovalRequest(BTExecutorList listType, ExecutionTas...
method processInsertionsAndRemovals (line 381) | private void processInsertionsAndRemovals() {
method getBehaviourTree (line 410) | public ModelTask getBehaviourTree() {
method getStatus (line 418) | public Status getStatus() {
method getRootContext (line 430) | public IContext getRootContext() {
method setTaskState (line 445) | public boolean setTaskState(Position taskPosition, ITaskState state) {
method getTaskState (line 461) | public ITaskState getTaskState(Position taskPosition) {
method copyTasksStates (line 472) | public void copyTasksStates(BTExecutor executor) {
method clearTaskState (line 485) | public boolean clearTaskState(Position taskPosition) {
method toString (line 493) | public String toString() {
FILE: JBTCore/src/jbt/execution/core/BTExecutorFactory.java
class BTExecutorFactory (line 28) | public class BTExecutorFactory {
method createBTExecutor (line 39) | public static IBTExecutor createBTExecutor(ModelTask treeToRun,
method createBTExecutor (line 52) | public static IBTExecutor createBTExecutor(ModelTask treeToRun) {
FILE: JBTCore/src/jbt/execution/core/BTLibraryFactory.java
class BTLibraryFactory (line 32) | public class BTLibraryFactory {
method createBTLibrary (line 45) | public static IBTLibrary createBTLibrary(List<IBTLibrary> libraries) {
method createBTLibrary (line 71) | public static IBTLibrary createBTLibrary(List<ModelTask> behaviourTree...
FILE: JBTCore/src/jbt/execution/core/ContextFactory.java
class ContextFactory (line 32) | public class ContextFactory {
method createContext (line 43) | public static IContext createContext(IBTLibrary library) {
method createContext (line 59) | public static IContext createContext(List<IBTLibrary> libraries) {
method createContext (line 83) | public static IContext createContext(List<ModelTask> behaviourTrees, L...
method createContext (line 101) | public static IContext createContext() {
FILE: JBTCore/src/jbt/execution/core/ExecutionTask.java
class ExecutionTask (line 73) | public abstract class ExecutionTask implements ITaskListener {
type Status (line 121) | public static enum Status {
method ExecutionTask (line 152) | public ExecutionTask(ModelTask modelTask, BTExecutor executor, Executi...
method spawn (line 197) | public final void spawn(IContext context) throws SpawnException {
method internalSpawn (line 308) | protected abstract void internalSpawn();
method tick (line 342) | public final Status tick() throws TickException {
method internalTick (line 459) | protected abstract Status internalTick();
method storeState (line 501) | protected abstract ITaskState storeState();
method storeTerminationState (line 514) | protected abstract ITaskState storeTerminationState();
method restoreState (line 556) | protected abstract void restoreState(ITaskState state);
method getContext (line 563) | public IContext getContext() {
method addTaskListener (line 575) | public void addTaskListener(ITaskListener listener) {
method removeTaskListener (line 585) | public void removeTaskListener(ITaskListener listener) {
method statusChanged (line 593) | public abstract void statusChanged(TaskEvent e);
method getStatus (line 600) | public Status getStatus() {
method getExecutor (line 609) | public BTExecutor getExecutor() {
method getModelTask (line 618) | public ModelTask getModelTask() {
method getPosition (line 628) | public Position getPosition() {
method getSpawned (line 637) | public boolean getSpawned() {
method getTerminated (line 646) | public boolean getTerminated() {
method terminate (line 672) | public final void terminate() {
method internalTerminate (line 708) | protected abstract void internalTerminate();
method fireTaskEvent (line 717) | private void fireTaskEvent(Status newStatus) {
method getMove (line 737) | private int getMove() {
method validInternalTickStatus (line 761) | private static boolean validInternalTickStatus(Status status) {
method toString (line 773) | public String toString() {
FILE: JBTCore/src/jbt/execution/core/IBTExecutor.java
type IBTExecutor (line 39) | public interface IBTExecutor {
method tick (line 60) | public void tick();
method terminate (line 67) | public void terminate();
method getBehaviourTree (line 76) | public ModelTask getBehaviourTree();
method getStatus (line 85) | public Status getStatus();
method getRootContext (line 94) | public IContext getRootContext();
FILE: JBTCore/src/jbt/execution/core/IBTLibrary.java
type IBTLibrary (line 31) | public interface IBTLibrary extends Iterable<Pair<String, ModelTask>> {
method getBT (line 41) | public ModelTask getBT(String name);
FILE: JBTCore/src/jbt/execution/core/IContext.java
type IContext (line 35) | public interface IContext {
method getVariable (line 46) | public Object getVariable(String name);
method setVariable (line 60) | public boolean setVariable(String name, Object value);
method clear (line 65) | public void clear();
method clearVariable (line 76) | public boolean clearVariable(String name);
method getBT (line 87) | public ModelTask getBT(String name);
FILE: JBTCore/src/jbt/execution/core/ITaskState.java
type ITaskState (line 38) | public interface ITaskState {
method getStateVariable (line 49) | public Object getStateVariable(String name);
FILE: JBTCore/src/jbt/execution/core/TaskState.java
class TaskState (line 28) | public class TaskState implements ITaskState {
method TaskState (line 35) | public TaskState() {
method getStateVariable (line 43) | public Object getStateVariable(String name) {
method setStateVariable (line 59) | public boolean setStateVariable(String name, Object value) {
method clear (line 69) | public void clear() {
method clearStateVariable (line 81) | public boolean clearStateVariable(String name) {
FILE: JBTCore/src/jbt/execution/core/TaskStateFactory.java
class TaskStateFactory (line 33) | public class TaskStateFactory {
method createTaskState (line 44) | public static ITaskState createTaskState(List<Pair<String, Object>> va...
method createTaskState (line 64) | public static ITaskState createTaskState(Map<String, Object> variables) {
FILE: JBTCore/src/jbt/execution/core/event/ITaskListener.java
type ITaskListener (line 27) | public interface ITaskListener {
method statusChanged (line 36) | public void statusChanged(TaskEvent e);
FILE: JBTCore/src/jbt/execution/core/event/TaskEvent.java
class TaskEvent (line 30) | public class TaskEvent extends EventObject {
method TaskEvent (line 48) | public TaskEvent(ExecutionTask source, Status newStatus, Status previo...
method getNewStatus (line 59) | public Status getNewStatus() {
method getPreviousStatus (line 68) | public Status getPreviousStatus() {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionComposite.java
class ExecutionComposite (line 30) | public abstract class ExecutionComposite extends ExecutionTask {
method ExecutionComposite (line 42) | public ExecutionComposite(ModelTask modelTask, BTExecutor executor, Ex...
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionDynamicPriorityList.java
class ExecutionDynamicPriorityList (line 38) | public class ExecutionDynamicPriorityList extends ExecutionComposite {
method ExecutionDynamicPriorityList (line 79) | public ExecutionDynamicPriorityList(ModelTask modelTask, BTExecutor ex...
method internalSpawn (line 98) | protected void internalSpawn() {
method internalTerminate (line 156) | protected void internalTerminate() {
method internalTick (line 186) | protected Status internalTick() {
method restoreState (line 270) | protected void restoreState(ITaskState state) {
method statusChanged (line 278) | public void statusChanged(TaskEvent e) {
method storeState (line 287) | protected ITaskState storeState() {
method resetGuardsEvaluation (line 296) | private void resetGuardsEvaluation() {
method evaluateGuards (line 326) | private Pair<Status, Integer> evaluateGuards() {
method storeTerminationState (line 402) | protected ITaskState storeTerminationState() {
method longTick (line 413) | private void longTick(IBTExecutor executor) {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionParallel.java
class ExecutionParallel (line 36) | public class ExecutionParallel extends ExecutionComposite {
method ExecutionParallel (line 55) | public ExecutionParallel(ModelTask modelTask, BTExecutor executor, Exe...
method internalSpawn (line 73) | protected void internalSpawn() {
method internalTerminate (line 87) | protected void internalTerminate() {
method internalTick (line 104) | protected Status internalTick() {
method sequencePolicySpawn (line 117) | private void sequencePolicySpawn() {
method selectorPolicySpawn (line 134) | private void selectorPolicySpawn() {
method sequencePolicyTerminate (line 142) | private void sequencePolicyTerminate() {
method selectorPolicyTerminate (line 153) | private void selectorPolicyTerminate() {
method sequencePolicyTick (line 163) | private Status sequencePolicyTick() {
method selectorPolicyTick (line 196) | private Status selectorPolicyTick() {
method restoreState (line 228) | protected void restoreState(ITaskState state) {}
method statusChanged (line 236) | public void statusChanged(TaskEvent e) {
method storeState (line 251) | protected ITaskState storeState() {
method storeTerminationState (line 260) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionRandomSelector.java
class ExecutionRandomSelector (line 36) | public class ExecutionRandomSelector extends ExecutionComposite {
method ExecutionRandomSelector (line 68) | public ExecutionRandomSelector(ModelTask modelTask, BTExecutor executo...
method internalSpawn (line 82) | protected void internalSpawn() {
method internalTerminate (line 109) | protected void internalTerminate() {
method internalTick (line 122) | protected Status internalTick() {
method restoreState (line 151) | protected void restoreState(ITaskState state) {}
method statusChanged (line 158) | public void statusChanged(TaskEvent e) {
method storeState (line 167) | protected ITaskState storeState() {
method storeTerminationState (line 176) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionRandomSequence.java
class ExecutionRandomSequence (line 37) | public class ExecutionRandomSequence extends ExecutionComposite {
method ExecutionRandomSequence (line 69) | public ExecutionRandomSequence(ModelTask modelTask, BTExecutor executo...
method internalSpawn (line 83) | protected void internalSpawn() {
method internalTerminate (line 110) | protected void internalTerminate() {
method internalTick (line 123) | protected Status internalTick() {
method restoreState (line 152) | protected void restoreState(ITaskState state) {}
method statusChanged (line 159) | public void statusChanged(TaskEvent e) {
method storeState (line 168) | protected ITaskState storeState() {
method storeTerminationState (line 177) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionSelector.java
class ExecutionSelector (line 34) | public class ExecutionSelector extends ExecutionComposite {
method ExecutionSelector (line 53) | public ExecutionSelector(ModelTask modelTask, BTExecutor executor, Exe...
method internalSpawn (line 67) | protected void internalSpawn() {
method internalTerminate (line 81) | protected void internalTerminate() {
method internalTick (line 98) | protected Status internalTick() {
method restoreState (line 135) | protected void restoreState(ITaskState state) {}
method statusChanged (line 142) | public void statusChanged(TaskEvent e) {
method storeState (line 151) | protected ITaskState storeState() {
method storeTerminationState (line 160) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionSequence.java
class ExecutionSequence (line 34) | public class ExecutionSequence extends ExecutionTask {
method ExecutionSequence (line 53) | public ExecutionSequence(ModelTask modelTask, BTExecutor executor, Exe...
method internalSpawn (line 67) | protected void internalSpawn() {
method internalTerminate (line 83) | protected void internalTerminate() {
method internalTick (line 97) | protected Status internalTick() {
method restoreState (line 132) | protected void restoreState(ITaskState state) {}
method statusChanged (line 140) | public void statusChanged(TaskEvent e) {
method storeState (line 149) | protected ITaskState storeState() {
method storeTerminationState (line 158) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/composite/ExecutionStaticPriorityList.java
class ExecutionStaticPriorityList (line 39) | public class ExecutionStaticPriorityList extends ExecutionComposite {
method ExecutionStaticPriorityList (line 77) | public ExecutionStaticPriorityList(ModelTask modelTask, BTExecutor exe...
method internalSpawn (line 96) | protected void internalSpawn() {
method internalTick (line 169) | protected Status internalTick() {
method storeState (line 220) | protected ITaskState storeState() {
method restoreState (line 229) | protected void restoreState(ITaskState state) {
method statusChanged (line 237) | public void statusChanged(TaskEvent e) {
method internalTerminate (line 246) | protected void internalTerminate() {
method resetGuardsEvaluation (line 271) | private void resetGuardsEvaluation() {
method evaluateGuards (line 302) | private Pair<Status, Integer> evaluateGuards() {
method storeTerminationState (line 340) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionDecorator.java
class ExecutionDecorator (line 30) | public abstract class ExecutionDecorator extends ExecutionTask {
method ExecutionDecorator (line 42) | public ExecutionDecorator(ModelTask modelTask, BTExecutor executor, Ex...
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionHierarchicalContextManager.java
class ExecutionHierarchicalContextManager (line 34) | public class ExecutionHierarchicalContextManager extends ExecutionDecora...
method ExecutionHierarchicalContextManager (line 49) | public ExecutionHierarchicalContextManager(ModelTask modelTask, BTExec...
method internalSpawn (line 65) | protected void internalSpawn() {
method internalTerminate (line 79) | protected void internalTerminate() {
method internalTick (line 88) | protected Status internalTick() {
method restoreState (line 97) | protected void restoreState(ITaskState state) {}
method statusChanged (line 104) | public void statusChanged(TaskEvent e) {
method storeState (line 113) | protected ITaskState storeState() {
method storeTerminationState (line 122) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionInterrupter.java
class ExecutionInterrupter (line 34) | public class ExecutionInterrupter extends ExecutionDecorator {
method ExecutionInterrupter (line 61) | public ExecutionInterrupter(ModelTask modelTask, BTExecutor executor, ...
method internalSpawn (line 77) | protected void internalSpawn() {
method internalTerminate (line 95) | protected void internalTerminate() {
method internalTick (line 123) | protected Status internalTick() {
method restoreState (line 151) | protected void restoreState(ITaskState state) {}
method statusChanged (line 158) | public void statusChanged(TaskEvent e) {
method storeState (line 167) | protected ITaskState storeState() {
method interrupt (line 186) | public void interrupt(Status status) {
method storeTerminationState (line 233) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionInverter.java
class ExecutionInverter (line 31) | public class ExecutionInverter extends ExecutionDecorator {
method ExecutionInverter (line 46) | public ExecutionInverter(ModelTask modelTask, BTExecutor executor, Exe...
method internalSpawn (line 60) | protected void internalSpawn() {
method internalTerminate (line 73) | protected void internalTerminate() {
method internalTick (line 84) | protected Status internalTick() {
method restoreState (line 103) | protected void restoreState(ITaskState state) {}
method statusChanged (line 111) | public void statusChanged(TaskEvent e) {
method storeState (line 120) | protected ITaskState storeState() {
method storeTerminationState (line 129) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionLimit.java
class ExecutionLimit (line 37) | public class ExecutionLimit extends ExecutionDecorator {
method ExecutionLimit (line 66) | public ExecutionLimit(ModelTask modelTask, BTExecutor executor, Execut...
method internalSpawn (line 85) | protected void internalSpawn() {
method internalTerminate (line 103) | protected void internalTerminate() {
method internalTick (line 115) | protected Status internalTick() {
method restoreState (line 131) | protected void restoreState(ITaskState state) {
method statusChanged (line 143) | public void statusChanged(TaskEvent e) {
method storeState (line 154) | protected ITaskState storeState() {
method storeTerminationState (line 167) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionRepeat.java
class ExecutionRepeat (line 33) | public class ExecutionRepeat extends ExecutionDecorator {
method ExecutionRepeat (line 47) | public ExecutionRepeat(ModelTask modelTask, BTExecutor executor, Execu...
method internalSpawn (line 61) | protected void internalSpawn() {
method internalTerminate (line 73) | protected void internalTerminate() {
method internalTick (line 83) | protected Status internalTick() {
method restoreState (line 104) | protected void restoreState(ITaskState state) {}
method statusChanged (line 111) | public void statusChanged(TaskEvent e) {
method storeState (line 120) | protected ITaskState storeState() {
method storeTerminationState (line 129) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionSafeContextManager.java
class ExecutionSafeContextManager (line 34) | public class ExecutionSafeContextManager extends ExecutionDecorator {
method ExecutionSafeContextManager (line 50) | public ExecutionSafeContextManager(ModelTask modelTask, BTExecutor exe...
method internalSpawn (line 67) | protected void internalSpawn() {
method internalTerminate (line 80) | protected void internalTerminate() {
method internalTick (line 89) | protected Status internalTick() {
method restoreState (line 98) | protected void restoreState(ITaskState state) {
method statusChanged (line 106) | public void statusChanged(TaskEvent e) {
method storeState (line 115) | protected ITaskState storeState() {
method storeTerminationState (line 124) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionSafeOutputContextManager.java
class ExecutionSafeOutputContextManager (line 34) | public class ExecutionSafeOutputContextManager extends ExecutionDecorator {
method ExecutionSafeOutputContextManager (line 50) | public ExecutionSafeOutputContextManager(ModelTask modelTask, BTExecut...
method internalSpawn (line 69) | protected void internalSpawn() {
method internalTerminate (line 83) | protected void internalTerminate() {
method internalTick (line 92) | protected Status internalTick() {
method restoreState (line 101) | protected void restoreState(ITaskState state) {
method statusChanged (line 109) | public void statusChanged(TaskEvent e) {
method storeState (line 118) | protected ITaskState storeState() {
method storeTerminationState (line 127) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionSucceeder.java
class ExecutionSucceeder (line 31) | public class ExecutionSucceeder extends ExecutionDecorator {
method ExecutionSucceeder (line 45) | public ExecutionSucceeder(ModelTask modelTask, BTExecutor executor, Ex...
method internalSpawn (line 59) | protected void internalSpawn() {
method internalTick (line 72) | protected Status internalTick() {
method storeState (line 87) | protected ITaskState storeState() {
method storeTerminationState (line 96) | protected ITaskState storeTerminationState() {
method restoreState (line 105) | protected void restoreState(ITaskState state) {
method statusChanged (line 113) | public void statusChanged(TaskEvent e) {
method internalTerminate (line 122) | protected void internalTerminate() {
FILE: JBTCore/src/jbt/execution/task/decorator/ExecutionUntilFail.java
class ExecutionUntilFail (line 33) | public class ExecutionUntilFail extends ExecutionDecorator {
method ExecutionUntilFail (line 47) | public ExecutionUntilFail(ModelTask modelTask, BTExecutor executor, Ex...
method internalSpawn (line 61) | protected void internalSpawn() {
method internalTerminate (line 73) | protected void internalTerminate() {
method internalTick (line 84) | protected Status internalTick() {
method restoreState (line 116) | protected void restoreState(ITaskState state) {}
method statusChanged (line 123) | public void statusChanged(TaskEvent e) {
method storeState (line 132) | protected ITaskState storeState() {
method storeTerminationState (line 141) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionFailure.java
class ExecutionFailure (line 32) | public class ExecutionFailure extends ExecutionLeaf {
method ExecutionFailure (line 43) | public ExecutionFailure(ModelTask modelTask, BTExecutor executor, Exec...
method internalSpawn (line 57) | protected void internalSpawn() {
method internalTick (line 66) | protected Status internalTick() {
method storeState (line 75) | protected ITaskState storeState() {
method storeTerminationState (line 84) | protected ITaskState storeTerminationState() {
method restoreState (line 93) | protected void restoreState(ITaskState state) {
method internalTerminate (line 101) | protected void internalTerminate() {
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionLeaf.java
class ExecutionLeaf (line 31) | public abstract class ExecutionLeaf extends ExecutionTask {
method ExecutionLeaf (line 42) | public ExecutionLeaf(ModelTask modelTask, BTExecutor executor, Executi...
method statusChanged (line 56) | public void statusChanged(TaskEvent e) {}
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionPerformInterruption.java
class ExecutionPerformInterruption (line 33) | public class ExecutionPerformInterruption extends ExecutionLeaf {
method ExecutionPerformInterruption (line 47) | public ExecutionPerformInterruption(ModelTask modelTask, BTExecutor ex...
method internalSpawn (line 63) | protected void internalSpawn() {
method internalTerminate (line 84) | protected void internalTerminate() {}
method internalTick (line 91) | protected Status internalTick() {
method restoreState (line 100) | protected void restoreState(ITaskState state) {}
method storeState (line 107) | protected ITaskState storeState() {
method storeTerminationState (line 116) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionSubtreeLookup.java
class ExecutionSubtreeLookup (line 33) | public class ExecutionSubtreeLookup extends ExecutionLeaf {
method ExecutionSubtreeLookup (line 58) | public ExecutionSubtreeLookup(ModelTask modelTask, BTExecutor executor...
method internalSpawn (line 75) | protected void internalSpawn() {
method internalTerminate (line 109) | protected void internalTerminate() {
method internalTick (line 121) | protected Status internalTick() {
method restoreState (line 135) | protected void restoreState(ITaskState state) {}
method statusChanged (line 142) | public void statusChanged(TaskEvent e) {
method storeState (line 151) | protected ITaskState storeState() {
method storeTerminationState (line 160) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionSuccess.java
class ExecutionSuccess (line 32) | public class ExecutionSuccess extends ExecutionLeaf {
method ExecutionSuccess (line 43) | public ExecutionSuccess(ModelTask modelTask, BTExecutor executor, Exec...
method internalSpawn (line 57) | protected void internalSpawn() {
method internalTick (line 66) | protected Status internalTick() {
method storeState (line 75) | protected ITaskState storeState() {
method storeTerminationState (line 84) | protected ITaskState storeTerminationState() {
method restoreState (line 93) | protected void restoreState(ITaskState state) {
method internalTerminate (line 101) | protected void internalTerminate() {
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionVariableRenamer.java
class ExecutionVariableRenamer (line 32) | public class ExecutionVariableRenamer extends ExecutionLeaf {
method ExecutionVariableRenamer (line 50) | public ExecutionVariableRenamer(ModelTask modelTask, BTExecutor execut...
method internalSpawn (line 67) | protected void internalSpawn() {
method internalTick (line 79) | protected Status internalTick() {
method storeState (line 88) | protected ITaskState storeState() {
method storeTerminationState (line 97) | protected ITaskState storeTerminationState() {
method restoreState (line 106) | protected void restoreState(ITaskState state) {}
method internalTerminate (line 113) | protected void internalTerminate() {}
FILE: JBTCore/src/jbt/execution/task/leaf/ExecutionWait.java
class ExecutionWait (line 31) | public class ExecutionWait extends ExecutionLeaf {
method ExecutionWait (line 53) | public ExecutionWait(ModelTask modelTask, BTExecutor executor, Executi...
method internalSpawn (line 69) | protected void internalSpawn() {
method internalTerminate (line 79) | protected void internalTerminate() {}
method internalTick (line 87) | protected Status internalTick() {
method restoreState (line 103) | protected void restoreState(ITaskState state) {
method storeState (line 112) | protected ITaskState storeState() {
method storeTerminationState (line 121) | protected ITaskState storeTerminationState() {
FILE: JBTCore/src/jbt/execution/task/leaf/action/ExecutionAction.java
class ExecutionAction (line 31) | public abstract class ExecutionAction extends ExecutionLeaf {
method ExecutionAction (line 42) | public ExecutionAction(ModelTask modelTask, BTExecutor executor, Execu...
FILE: JBTCore/src/jbt/execution/task/leaf/condition/ExecutionCondition.java
class ExecutionCondition (line 31) | public abstract class ExecutionCondition extends ExecutionLeaf {
method ExecutionCondition (line 42) | public ExecutionCondition(ModelTask modelTask, BTExecutor executor, Ex...
FILE: JBTCore/src/jbt/model/core/ModelTask.java
class ModelTask (line 65) | public abstract class ModelTask {
class Position (line 88) | public static class Position {
method Position (line 99) | public Position(Integer... moves) {
method Position (line 113) | public Position(List<Integer> moves) {
method Position (line 130) | public Position(Position pos) {
method getMoves (line 142) | public List<Integer> getMoves() {
method addMove (line 154) | public Position addMove(Integer move) {
method addMoves (line 167) | public Position addMoves(List<Integer> moves) {
method addMoves (line 182) | public Position addMoves(Position position) {
method toString (line 236) | public String toString() {
method equals (line 255) | public boolean equals(Object o) {
method hashCode (line 292) | public int hashCode() {
method ModelTask (line 307) | public ModelTask(ModelTask guard, ModelTask... children) {
method getChildren (line 328) | public List<ModelTask> getChildren() {
method getGuard (line 337) | public ModelTask getGuard() {
method createExecutor (line 352) | public abstract ExecutionTask createExecutor(BTExecutor executor, Exec...
method getPosition (line 361) | public Position getPosition() {
method computePositions (line 376) | public void computePositions() {
method findNode (line 408) | public ModelTask findNode(Position moves) {
method recursiveComputePositions (line 433) | private void recursiveComputePositions(ModelTask t) {
FILE: JBTCore/src/jbt/model/task/composite/ModelComposite.java
class ModelComposite (line 27) | public abstract class ModelComposite extends ModelTask {
method ModelComposite (line 39) | public ModelComposite(ModelTask guard, ModelTask... children) {
FILE: JBTCore/src/jbt/model/task/composite/ModelDynamicPriorityList.java
class ModelDynamicPriorityList (line 40) | public class ModelDynamicPriorityList extends ModelComposite {
method ModelDynamicPriorityList (line 50) | public ModelDynamicPriorityList(ModelTask guard, ModelTask... children) {
method createExecutor (line 61) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/composite/ModelParallel.java
class ModelParallel (line 41) | public class ModelParallel extends ModelComposite {
type ParallelPolicy (line 61) | public static enum ParallelPolicy {
method ModelParallel (line 87) | public ModelParallel(ModelTask guard, ParallelPolicy policy, ModelTask...
method getPolicy (line 97) | public ParallelPolicy getPolicy() {
method createExecutor (line 107) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/composite/ModelRandomSelector.java
class ModelRandomSelector (line 31) | public class ModelRandomSelector extends ModelComposite {
method ModelRandomSelector (line 41) | public ModelRandomSelector(ModelTask guard, ModelTask... children) {
method createExecutor (line 52) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/composite/ModelRandomSequence.java
class ModelRandomSequence (line 31) | public class ModelRandomSequence extends ModelComposite {
method ModelRandomSequence (line 41) | public ModelRandomSequence(ModelTask guard, ModelTask... children) {
method createExecutor (line 52) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/composite/ModelSelector.java
class ModelSelector (line 36) | public class ModelSelector extends ModelComposite {
method ModelSelector (line 48) | public ModelSelector(ModelTask guard, ModelTask... children) {
method createExecutor (line 58) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/composite/ModelSequence.java
class ModelSequence (line 36) | public class ModelSequence extends ModelComposite {
method ModelSequence (line 48) | public ModelSequence(ModelTask guard, ModelTask... children) {
method createExecutor (line 58) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/composite/ModelStaticPriorityList.java
class ModelStaticPriorityList (line 36) | public class ModelStaticPriorityList extends ModelComposite {
method ModelStaticPriorityList (line 46) | public ModelStaticPriorityList(ModelTask guard, ModelTask... children) {
method createExecutor (line 57) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelDecorator.java
class ModelDecorator (line 43) | public abstract class ModelDecorator extends ModelTask {
method ModelDecorator (line 54) | public ModelDecorator(ModelTask guard, ModelTask child) {
method getChild (line 63) | public ModelTask getChild() {
FILE: JBTCore/src/jbt/model/task/decorator/ModelHierarchicalContextManager.java
class ModelHierarchicalContextManager (line 35) | public class ModelHierarchicalContextManager extends ModelDecorator {
method ModelHierarchicalContextManager (line 44) | public ModelHierarchicalContextManager(ModelTask guard, ModelTask chil...
method createExecutor (line 55) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelInterrupter.java
class ModelInterrupter (line 33) | public class ModelInterrupter extends ModelDecorator {
method ModelInterrupter (line 44) | public ModelInterrupter(ModelTask guard, ModelTask child) {
method createExecutor (line 55) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelInverter.java
class ModelInverter (line 42) | public class ModelInverter extends ModelDecorator {
method ModelInverter (line 51) | public ModelInverter(ModelTask guard, ModelTask child) {
method createExecutor (line 61) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelLimit.java
class ModelLimit (line 32) | public class ModelLimit extends ModelDecorator {
method ModelLimit (line 47) | public ModelLimit(ModelTask guard, int maxNumTimes, ModelTask child) {
method createExecutor (line 58) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
method getMaxNumTimes (line 67) | public int getMaxNumTimes() {
FILE: JBTCore/src/jbt/model/task/decorator/ModelRepeat.java
class ModelRepeat (line 32) | public class ModelRepeat extends ModelDecorator {
method ModelRepeat (line 41) | public ModelRepeat(ModelTask guard, ModelTask child) {
method createExecutor (line 51) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelSafeContextManager.java
class ModelSafeContextManager (line 35) | public class ModelSafeContextManager extends ModelDecorator {
method ModelSafeContextManager (line 44) | public ModelSafeContextManager(ModelTask guard, ModelTask child) {
method createExecutor (line 55) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelSafeOutputContextManager.java
class ModelSafeOutputContextManager (line 37) | public class ModelSafeOutputContextManager extends ModelDecorator {
method ModelSafeOutputContextManager (line 55) | public ModelSafeOutputContextManager(ModelTask guard, List<String> out...
method createExecutor (line 68) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
method getOutputVariables (line 78) | public List<String> getOutputVariables() {
FILE: JBTCore/src/jbt/model/task/decorator/ModelSucceeder.java
class ModelSucceeder (line 29) | public class ModelSucceeder extends ModelDecorator {
method ModelSucceeder (line 38) | public ModelSucceeder(ModelTask guard, ModelTask child) {
method createExecutor (line 48) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/decorator/ModelUntilFail.java
class ModelUntilFail (line 34) | public class ModelUntilFail extends ModelDecorator {
method ModelUntilFail (line 43) | public ModelUntilFail(ModelTask guard, ModelTask child) {
method createExecutor (line 53) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/leaf/ModelFailure.java
class ModelFailure (line 29) | public class ModelFailure extends ModelLeaf {
method ModelFailure (line 36) | public ModelFailure(ModelTask guard) {
method createExecutor (line 47) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/leaf/ModelLeaf.java
class ModelLeaf (line 26) | public abstract class ModelLeaf extends ModelTask {
method ModelLeaf (line 33) | public ModelLeaf(ModelTask guard) {
FILE: JBTCore/src/jbt/model/task/leaf/ModelPerformInterruption.java
class ModelPerformInterruption (line 35) | public class ModelPerformInterruption extends ModelLeaf {
method ModelPerformInterruption (line 59) | public ModelPerformInterruption(ModelTask guard, ModelInterrupter inte...
method createExecutor (line 73) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
method setInterrupter (line 84) | public void setInterrupter(ModelInterrupter interrupter) {
method getInterrupter (line 95) | public ModelInterrupter getInterrupter() {
method getDesiredResult (line 106) | public Status getDesiredResult() {
FILE: JBTCore/src/jbt/model/task/leaf/ModelSubtreeLookup.java
class ModelSubtreeLookup (line 36) | public class ModelSubtreeLookup extends ModelLeaf {
method ModelSubtreeLookup (line 48) | public ModelSubtreeLookup(ModelTask guard, String treeName) {
method createExecutor (line 60) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
method getTreeName (line 69) | public String getTreeName() {
FILE: JBTCore/src/jbt/model/task/leaf/ModelSuccess.java
class ModelSuccess (line 29) | public class ModelSuccess extends ModelLeaf {
method ModelSuccess (line 36) | public ModelSuccess(ModelTask guard) {
method createExecutor (line 47) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
FILE: JBTCore/src/jbt/model/task/leaf/ModelVariableRenamer.java
class ModelVariableRenamer (line 30) | public class ModelVariableRenamer extends ModelLeaf {
method ModelVariableRenamer (line 46) | public ModelVariableRenamer(ModelTask guard, String variableName, Stri...
method createExecutor (line 59) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
method getVariableName (line 68) | public String getVariableName() {
method getNewVariableName (line 77) | public String getNewVariableName() {
FILE: JBTCore/src/jbt/model/task/leaf/ModelWait.java
class ModelWait (line 32) | public class ModelWait extends ModelLeaf {
method ModelWait (line 48) | public ModelWait(ModelTask guard, long duration) {
method createExecutor (line 59) | public ExecutionTask createExecutor(BTExecutor executor, ExecutionTask...
method getDuration (line 68) | public long getDuration() {
FILE: JBTCore/src/jbt/model/task/leaf/action/ModelAction.java
class ModelAction (line 29) | public abstract class ModelAction extends ModelLeaf {
method ModelAction (line 36) | public ModelAction(ModelTask guard) {
FILE: JBTCore/src/jbt/model/task/leaf/condition/ModelCondition.java
class ModelCondition (line 29) | public abstract class ModelCondition extends ModelLeaf {
method ModelCondition (line 36) | public ModelCondition(ModelTask guard) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/ActionsAndConditionsGenerator.java
class ActionsAndConditionsGenerator (line 122) | public class ActionsAndConditionsGenerator {
method main (line 144) | public static void main(String[] args) {
method printUsage (line 520) | private static void printUsage() {
method getModelClassesFileHeader (line 542) | private static String getModelClassesFileHeader() {
method getExecutionClassesFileHeader (line 562) | private static String getExecutionClassesFileHeader() {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/BTLibraryGenerator.java
class BTLibraryGenerator (line 117) | public class BTLibraryGenerator {
method main (line 137) | public static void main(String[] args) {
method printUsage (line 341) | private static void printUsage() {
method getClassFileHeader (line 362) | private static String getClassFileHeader() {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/librarygenerator/BTLibraryGenerationException.java
class BTLibraryGenerationException (line 24) | public class BTLibraryGenerationException extends Exception {
method BTLibraryGenerationException (line 27) | public BTLibraryGenerationException(String message) {
method BTLibraryGenerationException (line 31) | public BTLibraryGenerationException(String message, Throwable cause) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/librarygenerator/BTLibraryGenerator.java
class BTLibraryGenerator (line 44) | public class BTLibraryGenerator {
method getBTLibraryDeclaration (line 101) | public String getBTLibraryDeclaration(String libraryClassName, String ...
method getTreeName (line 192) | private String getTreeName(String treeFileName) throws Exception {
method getGetBTMethod (line 213) | private String getGetBTMethod(List<String> treeNames) {
method getIteratorMethod (line 244) | private String getIteratorMethod(List<String> treeNames) {
method getLibraryIterator (line 270) | private String getLibraryIterator(List<String> treeNames) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/lowlevelgenerator/ActionsGenerator.java
class ActionsGenerator (line 45) | public class ActionsGenerator {
method getModelActionClass (line 96) | public String getModelActionClass(ParsedAction action, String executio...
method getExecutionActionClass (line 175) | public String getExecutionActionClass(ParsedAction action, String mode...
method getModelActionClassHeader (line 209) | private String getModelActionClassHeader(ParsedAction action) {
method getExecutionActionClassHeader (line 214) | private String getExecutionActionClassHeader(ParsedAction action) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/lowlevelgenerator/CommonCodeGenerationUtilities.java
class CommonCodeGenerationUtilities (line 46) | public class CommonCodeGenerationUtilities {
method getClassVariables (line 68) | static String getClassVariables(List<Pair<Class, String>> params) {
method getModelConstructor (line 112) | static String getModelConstructor(String modelClassName, List<Pair<Cla...
method getExecutionConstructor (line 194) | static String getExecutionConstructor(String executionClassName, Strin...
method getCreateExecutorMethod (line 287) | static String getCreateExecutorMethod(String executionClassName,
method getGetters (line 343) | static String getGetters(List<Pair<Class, String>> params) {
method getGetter (line 375) | static String getGetter(Pair<Class, String> param) {
method getAbstractMethods (line 405) | static String getAbstractMethods() {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/lowlevelgenerator/ConditionsGenerator.java
class ConditionsGenerator (line 45) | public class ConditionsGenerator {
method getModelConditionClass (line 97) | public String getModelConditionClass(ParsedMethod condition,
method getExecutionConditionClass (line 178) | public String getExecutionConditionClass(ParsedMethod condition,
method getModelConditionClassHeader (line 214) | private String getModelConditionClassHeader(ParsedMethod condition) {
method getExecutionConditionClassHeader (line 219) | private String getExecutionConditionClassHeader(ParsedMethod condition) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/modelbtgenerator/ModelBTGenerationException.java
class ModelBTGenerationException (line 25) | public class ModelBTGenerationException extends Exception {
method ModelBTGenerationException (line 28) | public ModelBTGenerationException(String message) {
method ModelBTGenerationException (line 32) | public ModelBTGenerationException(String message, Throwable cause) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/modelbtgenerator/ModelBTGenerator.java
class ModelBTGenerator (line 94) | public class ModelBTGenerator {
method getModelBTDeclaration (line 382) | public String getModelBTDeclaration(String treeVariableName, String tr...
method parseBTFile (line 432) | private BTFileParseResult parseBTFile(FileInputStream file, String act...
method completeModelBTDeclaration (line 491) | private String completeModelBTDeclaration(String treeVariableName,
method getInterrupterExpression (line 513) | private String getInterrupterExpression(String treeVariableName, Inter...
method getPositionNewExpression (line 547) | private String getPositionNewExpression(Position pos) {
method processElement (line 582) | private void processElement(List<Position> pathToCurrentTree, Element ...
method parallelPolicyFromString (line 799) | private ParallelPolicy parallelPolicyFromString(String value) {
method statusFromString (line 817) | private Status statusFromString(String value) {
method getActionStaticParameters (line 853) | private String getActionStaticParameters(Element e, ParsedAction actio...
method getConditionStaticParameters (line 926) | private String getConditionStaticParameters(Element e, ParsedMethod co...
method getNewExpression (line 989) | private String getNewExpression(ActionParameterType type, String value) {
method findNode (line 1031) | private Position findNode(Element nodeElement, String nodeID, Position...
class InterrupterMatch (line 1079) | public static class InterrupterMatch {
method InterrupterMatch (line 1098) | public InterrupterMatch(Position interrupterPosition, Position perfo...
method getInterrupterPosition (line 1121) | public Position getInterrupterPosition() {
method getPerformInterruptionPosition (line 1128) | public Position getPerformInterruptionPosition() {
method getPathToTree (line 1136) | public List<Position> getPathToTree() {
class BTFileParseResult (line 1161) | private static class BTFileParseResult {
method BTFileParseResult (line 1178) | public BTFileParseResult(String modelBTExpression,
method getModelBTExpression (line 1195) | public String getModelBTExpression() {
method getInterruptersMatches (line 1203) | public List<InterrupterMatch> getInterruptersMatches() {
method getAction (line 1212) | private ParsedAction getAction(String name) {
method getCondition (line 1223) | private ParsedMethod getCondition(String name) {
method getSafeOutputContextOutputListOfVariables (line 1234) | private String getSafeOutputContextOutputListOfVariables(Element e) {
FILE: JBTCore/src/jbt/tools/btlibrarygenerator/util/Util.java
class Util (line 37) | @SuppressWarnings("unchecked")
method fromMMPMParameterType (line 81) | public static Class fromMMPMParameterType(ActionParameterType type) {
method addDirectorySeparator (line 111) | public static String addDirectorySeparator(String directory) {
method overwrites (line 128) | public static String overwrites(String fileName) {
method removeExtension (line 152) | public static String removeExtension(String fileName) {
method getExtension (line 168) | public static String getExtension(String fileName) {
method removeDirectorySeparator (line 181) | public static String removeDirectorySeparator(String directory) {
method format (line 203) | public static String format(String sourceCode) {
method fileExists (line 222) | public static boolean fileExists(String fileName) {
FILE: JBTCore/src/jbt/util/Pair.java
class Pair (line 29) | public class Pair<T, S> implements Serializable {
method Pair (line 48) | public Pair(T f, S s) {
method getFirst (line 58) | public T getFirst() {
method getSecond (line 67) | public S getSecond() {
method setFirst (line 77) | public void setFirst(T f) {
method setSecond (line 87) | public void setSecond(S s) {
method toString (line 95) | public String toString() {
method equals (line 103) | public boolean equals(Object o) {
method hashCode (line 120) | public int hashCode() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/Activator.java
class Activator (line 25) | public class Activator extends AbstractUIPlugin {
method Activator (line 36) | public Activator() {
method start (line 43) | public void start(BundleContext context) throws Exception {
method stop (line 52) | public void stop(BundleContext context) throws Exception {
method getDefault (line 62) | public static Activator getDefault() {
method getImageDescriptor (line 73) | public static ImageDescriptor getImageDescriptor(String path) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/Application.java
class Application (line 30) | public class Application implements IApplication {
method start (line 39) | public Object start(IApplicationContext context) throws Exception {
method stop (line 78) | public void stop() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationActionBarAdvisor.java
class ApplicationActionBarAdvisor (line 39) | public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
method ApplicationActionBarAdvisor (line 52) | public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
method makeActions (line 56) | protected void makeActions(IWorkbenchWindow window) {
method fillMenuBar (line 74) | protected void fillMenuBar(IMenuManager menuBar) {
method fillCoolBar (line 98) | protected void fillCoolBar(ICoolBarManager coolBar) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationIcons.java
class ApplicationIcons (line 52) | public class ApplicationIcons {
method getIcon (line 66) | public static Image getIcon(String iconLocation) {
method loadIcons (line 76) | public static void loadIcons() throws IOException {
method parseStandardNodesFile (line 91) | private static List<Exception> parseStandardNodesFile(FileInputStream ...
method parseElement (line 108) | private static void parseElement(Element e) {
method loadNonStandardIcons (line 123) | private static void loadNonStandardIcons() {
method loadIcon (line 135) | private static void loadIcon(String iconPath) {
method disposeIcons (line 146) | public static void disposeIcons() {
method ApplicationIcons (line 155) | private ApplicationIcons() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationWorkbenchAdvisor.java
class ApplicationWorkbenchAdvisor (line 22) | public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
method createWorkbenchWindowAdvisor (line 25) | public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchW...
method getInitialWindowPerspectiveId (line 29) | public String getInitialWindowPerspectiveId() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationWorkbenchWindowAdvisor.java
class ApplicationWorkbenchWindowAdvisor (line 23) | public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAd...
method ApplicationWorkbenchWindowAdvisor (line 25) | public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer co...
method createActionBarAdvisor (line 29) | public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer co...
method preWindowOpen (line 33) | public void preWindowOpen() {
method postWindowOpen (line 41) | public void postWindowOpen() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/BTCPPManager.java
class BTCPPManager (line 41) | public class BTCPPManager {
method export (line 46) | public static void export(BT tree, String fileName) throws IOException {
method exportInline (line 67) | public static void exportInline(BT tree, FileOutputStream file) throws...
method export (line 80) | public static void export(BT tree, FileOutputStream file) throws IOExc...
method exportHeader (line 93) | public static void exportHeader(BT tree, FileOutputStream file) throws...
method createCPPFile (line 105) | private static void createCPPFile(BT tree, PrintStream p) {
method createInlineFile (line 143) | private static void createInlineFile(BT tree, PrintStream p) {
method createHeaderFile (line 158) | private static void createHeaderFile(BT tree, PrintStream p) {
method processNode (line 215) | private static void processNode(BTNode node, PrintStream p, String mar...
method processParameters (line 270) | private static void processParameters(BTNode node, PrintStream p, Stri...
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/BTXMLManager.java
class BTXMLManager (line 43) | public class BTXMLManager {
method export (line 47) | public static void export(BT tree, String fileName) throws IOException {
method export (line 56) | public static void export(BT tree, FileOutputStream file) throws IOExc...
method load (line 69) | public static BT load(String fileName) throws IOException {
method load (line 81) | public static BT load(FileInputStream file) throws IOException {
method loadTree (line 96) | private static BT loadTree(Document doc) throws IOException {
method loadNode (line 104) | private static BTNode loadNode(Element e) throws IOException {
method createDocument (line 206) | private static Document createDocument(BT tree) {
method processNode (line 221) | private static Element processNode(BTNode node) {
method processParameters (line 264) | private static Element processParameters(BTNode node) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/DisableNewEditorHandler.java
class DisableNewEditorHandler (line 29) | public class DisableNewEditorHandler extends AbstractHandler {
method execute (line 30) | public Object execute(ExecutionEvent event) throws ExecutionException {
method isEnabled (line 34) | public boolean isEnabled() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/NodesLoader.java
class NodesLoader (line 106) | public class NodesLoader {
type NodeCategories (line 131) | public enum NodeCategories
method loadStandardNodes (line 144) | public static void loadStandardNodes() throws IOException {
method loadNonStandardNodes (line 166) | public static ConceptualNodesTree loadNonStandardNodes(String fileName...
method getStandardNodesTree (line 213) | public static ConceptualNodesTree getStandardNodesTree() {
method getNonStandardNodesTree (line 221) | public static ConceptualNodesTree getNonStandardNodesTree(String fileN...
method getNonStandardNodesTrees (line 229) | public static List<ConceptualNodesTree> getNonStandardNodesTrees() {
method removeNonStandardNodesTree (line 238) | public static void removeNonStandardNodesTree(String fileName) {
method getNonStandardTreeNames (line 246) | public static String[] getNonStandardTreeNames() {
method getStandardNodes (line 253) | public static List<ConceptualBTNode> getStandardNodes() {
method getNonStandardNodes (line 260) | public static List<ConceptualBTNode> getNonStandardNodes() {
method getNode (line 276) | public static ConceptualBTNode getNode(String type, String name) {
method loadNonStandardCondition (line 285) | private static ConceptualBTNode loadNonStandardCondition(ParsedMethod ...
method loadNonStandardAction (line 309) | private static ConceptualBTNode loadNonStandardAction(ParsedAction act...
method fromMMPMParameterType (line 333) | private static ParameterType fromMMPMParameterType(ActionParameterType...
method parseStandardNodesFile (line 359) | private static List<Exception> parseStandardNodesFile(FileInputStream ...
method parseElement (line 376) | private static void parseElement(String currentPath, Element e) {
method getCategoryOf (line 405) | public static NodeCategories getCategoryOf(String type)
method parseParameters (line 429) | private static void parseParameters(ConceptualBTNode node, Element e) {
method parseParameter (line 440) | private static void parseParameter(ConceptualBTNode node, Element e) {
method loadRoot (line 472) | private static void loadRoot() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/Perspective.java
class Perspective (line 26) | public class Perspective implements IPerspectiveFactory {
method createInitialLayout (line 30) | public void createInitialLayout(IPageLayout layout) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/CheckErrorsAction.java
class CheckErrorsAction (line 23) | public class CheckErrorsAction extends EditorActionDelegate{
method CheckErrorsAction (line 24) | public CheckErrorsAction(){
method run (line 29) | public void run(IAction action) {
method selectionChanged (line 34) | public void selectionChanged(IAction action, ISelection selection) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/ClearErrorsAction.java
class ClearErrorsAction (line 23) | public class ClearErrorsAction extends EditorActionDelegate {
method ClearErrorsAction (line 24) | public ClearErrorsAction(){
method run (line 28) | public void run(IAction action) {
method selectionChanged (line 33) | public void selectionChanged(IAction action, ISelection selection) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/CollapseTreeAction.java
class CollapseTreeAction (line 23) | public class CollapseTreeAction extends EditorActionDelegate{
method run (line 24) | public void run(IAction action) {
method selectionChanged (line 28) | public void selectionChanged(IAction action, ISelection selection) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/DialogExportAsCppAction.java
class DialogExportAsCppAction (line 44) | public class DialogExportAsCppAction extends Action implements IWorkbenc...
method DialogExportAsCppAction (line 52) | public DialogExportAsCppAction(IWorkbenchWindow window) {
method run (line 62) | public void run() {
method dispose (line 107) | public void dispose() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/DialogLoadMMPMDomainAction.java
class DialogLoadMMPMDomainAction (line 40) | public class DialogLoadMMPMDomainAction extends Action implements
method DialogLoadMMPMDomainAction (line 50) | public DialogLoadMMPMDomainAction(IWorkbenchWindow window) {
method run (line 61) | public void run() {
method dispose (line 102) | public void dispose() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/DialogOpenBTAction.java
class DialogOpenBTAction (line 40) | public class DialogOpenBTAction extends Action implements IWorkbenchActi...
method DialogOpenBTAction (line 48) | public DialogOpenBTAction(IWorkbenchWindow window) {
method run (line 59) | public void run() {
method dispose (line 100) | public void dispose() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/EditorActionDelegate.java
class EditorActionDelegate (line 22) | public abstract class EditorActionDelegate implements IEditorActionDeleg...
method setActiveEditor (line 26) | public void setActiveEditor(IAction action, IEditorPart targetEditor){
method getEditor (line 31) | public IEditorPart getEditor(){
method getAction (line 35) | public IAction getAction(){
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/ExpandTreeAction.java
class ExpandTreeAction (line 23) | public class ExpandTreeAction extends EditorActionDelegate {
method run (line 24) | public void run(IAction action) {
method selectionChanged (line 28) | public void selectionChanged(IAction action, ISelection selection) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/ExportToCppAction.java
class ExportToCppAction (line 31) | public class ExportToCppAction extends Action {
method ExportToCppAction (line 45) | public ExportToCppAction(BT tree, String fileName) {
method run (line 54) | public void run(){
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/LoadMMPMDomainAction.java
class LoadMMPMDomainAction (line 37) | public class LoadMMPMDomainAction extends Action {
method LoadMMPMDomainAction (line 47) | public LoadMMPMDomainAction(Vector<String> fileNames) {
method run (line 55) | public void run() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/NewBTAction.java
class NewBTAction (line 36) | public class NewBTAction extends Action {
method NewBTAction (line 43) | public NewBTAction() {
method run (line 53) | public void run() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/OpenBTAction.java
class OpenBTAction (line 37) | public class OpenBTAction extends Action {
method OpenBTAction (line 47) | public OpenBTAction(Vector<String> fileNames) {
method run (line 51) | public void run() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/SaveBTAction.java
class SaveBTAction (line 33) | public class SaveBTAction extends Action {
method SaveBTAction (line 47) | public SaveBTAction(BT tree, String fileName) {
method run (line 56) | public void run(){
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/SaveBTAsAction.java
class SaveBTAsAction (line 38) | public class SaveBTAsAction extends Action {
method SaveBTAsAction (line 54) | public SaveBTAsAction(BT tree, String initialFileName) {
method run (line 63) | public void run() {
method getSelectedFile (line 101) | public String getSelectedFile() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditor.java
class BTEditor (line 168) | public class BTEditor extends EditorPart implements ITreeModifierListener {
method doSave (line 203) | public void doSave(IProgressMonitor monitor) {
method doSaveAs (line 254) | public void doSaveAs() {
method init (line 297) | public void init(IEditorSite site, IEditorInput input) throws PartInit...
method isDirty (line 376) | public boolean isDirty() {
method isSaveAsAllowed (line 383) | public boolean isSaveAsAllowed() {
method createPartControl (line 391) | public void createPartControl(Composite parent) {
method setFocus (line 431) | public void setFocus() {
method initializeViewer (line 449) | private void initializeViewer(Composite parent, int style) {
method expandTree (line 535) | public void expandTree(boolean expand) {
method getSelectedElements (line 548) | public List<BTNode> getSelectedElements() {
method treeModified (line 556) | public void treeModified(TreeModifiedEvent event) {
method checkTree (line 567) | public boolean checkTree() {
method getBT (line 584) | public BT getBT() {
method selectNode (line 594) | public void selectNode(BTNode node) {
method selectNode (line 604) | public void selectNode(Identifier nodeID) {
method isFromFile (line 619) | private boolean isFromFile() {
method setIsFromFile (line 629) | private void setIsFromFile(boolean isFromFile) {
method isFromGuard (line 640) | private boolean isFromGuard() {
method setIsFromGuard (line 650) | private void setIsFromGuard(boolean isFromGuard) {
method setErrorColor (line 657) | private void setErrorColor(BTNode node) {
method findNode (line 670) | private TreeItem findNode(TreeItem item, BTNode node) {
method clearErrors (line 688) | public void clearErrors() {
method internalClearErrorColors (line 707) | private void internalClearErrorColors(TreeItem item) {
class BTLabelProvider (line 720) | private static class BTLabelProvider implements ILabelProvider, ILabel...
method addListener (line 723) | public void addListener(ILabelProviderListener listener) {
method dispose (line 726) | public void dispose() {
method isLabelProperty (line 732) | public boolean isLabelProperty(Object element, String property) {
method removeListener (line 736) | public void removeListener(ILabelProviderListener listener) {
method getImage (line 739) | public Image getImage(Object element) {
method getText (line 745) | public String getText(Object element) {
method decorateImage (line 767) | public Image decorateImage(Image image, Object element) {
method decorateText (line 783) | public String decorateText(String text, Object element) {
class BTContentProvider (line 795) | private static class BTContentProvider implements ITreeContentProvider {
method getChildren (line 796) | public Object[] getChildren(Object parentElement) {
method getParent (line 802) | public Object getParent(Object element) {
method hasChildren (line 808) | public boolean hasChildren(Object element) {
method getElements (line 814) | public Object[] getElements(Object inputElement) {
method dispose (line 823) | public void dispose() {
method inputChanged (line 826) | public void inputChanged(Viewer viewer, Object oldInput, Object newI...
class BTEditorCopyNode (line 842) | private class BTEditorCopyNode extends Action implements IAction {
method BTEditorCopyNode (line 845) | public BTEditorCopyNode() {
method run (line 849) | public void run() {
class BTEditorPasteNode (line 885) | private class BTEditorPasteNode extends Action implements IAction {
method BTEditorPasteNode (line 888) | public BTEditorPasteNode() {
method run (line 892) | public void run() {
class CopyNode (line 937) | private class CopyNode extends Action implements IAction {
method CopyNode (line 940) | public CopyNode() {
method run (line 944) | public void run() {
class PasteNode (line 976) | private class PasteNode extends Action implements IAction {
method PasteNode (line 979) | public PasteNode() {
method run (line 983) | public void run() {
class DeleteNode (line 1023) | private class DeleteNode extends Action {
method DeleteNode (line 1026) | public DeleteNode(List<BTNode> selectedNodes) {
method run (line 1031) | public void run() {
class ExpandNodes (line 1082) | private class ExpandNodes extends Action {
method ExpandNodes (line 1085) | public ExpandNodes(List<BTNode> nodesToExpand) {
method run (line 1090) | public void run() {
class EditGuard (line 1097) | private class EditGuard extends Action {
method EditGuard (line 1100) | public EditGuard(BTNode node) {
method run (line 1105) | public void run() {
class CollapseNodes (line 1116) | private class CollapseNodes extends Action {
method CollapseNodes (line 1119) | public CollapseNodes(List<BTNode> nodesToCollapse) {
method run (line 1124) | public void run() {
class GuardEditionDialog (line 1142) | private class GuardEditionDialog extends Dialog {
method GuardEditionDialog (line 1150) | public GuardEditionDialog(Shell parentShell, BTNode node) {
method createContents (line 1164) | protected Control createContents(Composite parent) {
method createDialogArea (line 1174) | protected Control createDialogArea(Composite parent) {
method createAddSimpleGuardButton (line 1234) | private Button createAddSimpleGuardButton(Composite parent) {
method createAddComplexGuardButton (line 1251) | private Button createAddComplexGuardButton(Composite parent) {
method createEditGuardButton (line 1272) | private Button createEditGuardButton(Composite parent) {
method createRemoveGuardButton (line 1299) | private Button createRemoveGuardButton(Composite parent) {
method configureShell (line 1336) | protected void configureShell(Shell shell) {
method createButtonsForButtonBar (line 1347) | protected void createButtonsForButtonBar(Composite parent) {
method buttonPressed (line 1356) | protected void buttonPressed(int buttonId) {
method setGuard (line 1364) | public void setGuard() {
class GuardInsertionDialog (line 1379) | private class GuardInsertionDialog extends Dialog {
method GuardInsertionDialog (line 1384) | public GuardInsertionDialog(Shell parentShell, BTNode node,
method createContents (line 1400) | protected Control createContents(Composite parent) {
method createDialogArea (line 1410) | protected Control createDialogArea(Composite parent) {
class ConceptualBTNodeListContentProvider (line 1518) | private class ConceptualBTNodeListContentProvider implements IStruct...
method getElements (line 1519) | public Object[] getElements(Object inputElement) {
method dispose (line 1523) | public void dispose() {
method inputChanged (line 1526) | public void inputChanged(Viewer viewer, Object oldInput, Object ne...
class ConceptualBTNodeListLabelProvider (line 1536) | private class ConceptualBTNodeListLabelProvider implements ILabelPro...
method getImage (line 1538) | public Image getImage(Object element) {
method getText (line 1544) | public String getText(Object element) {
method addListener (line 1550) | public void addListener(ILabelProviderListener listener) {
method dispose (line 1553) | public void dispose() {
method isLabelProperty (line 1556) | public boolean isLabelProperty(Object element, String property) {
method removeListener (line 1560) | public void removeListener(ILabelProviderListener listener) {
method configureShell (line 1570) | protected void configureShell(Shell shell) {
method createButtonsForButtonBar (line 1581) | protected void createButtonsForButtonBar(Composite parent) {
method buttonPressed (line 1591) | protected void buttonPressed(int buttonId) {
method setGuardFromSelection (line 1602) | private void setGuardFromSelection() {
class NodeParametersDialog (line 1616) | private class NodeParametersDialog extends Dialog {
method NodeParametersDialog (line 1624) | public NodeParametersDialog(Shell shell, BTNode node) {
method createContents (line 1638) | protected Control createContents(Composite parent) {
method createDialogArea (line 1648) | protected Control createDialogArea(Composite parent) {
method configureShell (line 1677) | protected void configureShell(Shell shell) {
method createButtonsForButtonBar (line 1688) | protected void createButtonsForButtonBar(Composite parent) {
method buttonPressed (line 1700) | protected void buttonPressed(int buttonId) {
class NameEditorComposite (line 1746) | private class NameEditorComposite extends Composite {
method NameEditorComposite (line 1755) | public NameEditorComposite(Composite parent, int style, String initi...
method getNodeName (line 1771) | public String getNodeName() throws RuntimeException {
class ParametersEditorComposite (line 1786) | private class ParametersEditorComposite extends Composite {
method ParametersEditorComposite (line 1790) | public ParametersEditorComposite(Composite parent, int style, BTNode...
method getParameters (line 1833) | public List<Parameter> getParameters() throws RuntimeException {
class ParameterComposite (line 1852) | private class ParameterComposite extends Composite {
method ParameterComposite (line 1861) | public ParameterComposite(Composite parent, int style)
method ParameterComposite (line 1868) | public ParameterComposite(Composite parent, int style,
method getParameter (line 1912) | public Parameter getParameter() throws RuntimeException {
method getTooltip (line 1945) | private String getTooltip(
method getCompositeParent (line 1997) | protected Composite getCompositeParent()
class VarParameterComposite (line 2012) | private class VarParameterComposite extends ParameterComposite {
method VarParameterComposite (line 2025) | public VarParameterComposite(Composite parent, int style,
method getParameter (line 2099) | public Parameter getParameter() throws RuntimeException {
method setIsConstant (line 2137) | public void setIsConstant(boolean isConstant)
class BTEditorDragSourceListener (line 2154) | private class BTEditorDragSourceListener implements DragSourceListener {
method dragStart (line 2155) | public void dragStart(DragSourceEvent event) {
method dragSetData (line 2169) | public void dragSetData(DragSourceEvent event) {
method dragFinished (line 2175) | public void dragFinished(DragSourceEvent event) {
class BTEditorDropTargetListener (line 2202) | private class BTEditorDropTargetListener implements DropTargetListener {
method dragEnter (line 2203) | public void dragEnter(DropTargetEvent event) {
method dragLeave (line 2218) | public void dragLeave(DropTargetEvent event) {
method dragOperationChanged (line 2222) | public void dragOperationChanged(DropTargetEvent event) {
method dragOver (line 2226) | public void dragOver(DropTargetEvent event) {
method drop (line 2338) | public void drop(DropTargetEvent event) {
method dropAccept (line 2441) | public void dropAccept(DropTargetEvent event) {
method closeToBottom (line 2453) | private boolean closeToBottom(TreeItem treeItem) {
method treeChanged (line 2485) | private void treeChanged(Object source) {
method openGuardEditor (line 2492) | private void openGuardEditor(final BTNode node) throws PartInitExcepti...
class BTEditorPartListener (line 2522) | private class BTEditorPartListener implements IPartListener {
method partActivated (line 2523) | public void partActivated(IWorkbenchPart part) {
method partBroughtToTop (line 2526) | public void partBroughtToTop(IWorkbenchPart part) {
method partClosed (line 2529) | public void partClosed(IWorkbenchPart part) {
method partDeactivated (line 2579) | public void partDeactivated(IWorkbenchPart part) {
method partOpened (line 2582) | public void partOpened(IWorkbenchPart part) {
method dissociateFromParentTree (line 2596) | private void dissociateFromParentTree() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditorCopyAndPasteManager.java
class BTEditorCopyAndPasteManager (line 36) | public class BTEditorCopyAndPasteManager {
method copy (line 48) | public void copy(BTNode branchToCopy) {
method paste (line 57) | public BTNode paste() {
method getInstance (line 64) | public static BTEditorCopyAndPasteManager getInstance() {
method hasCopy (line 76) | public boolean hasCopy() {
method BTEditorCopyAndPasteManager (line 83) | private BTEditorCopyAndPasteManager() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditorIDGenerator.java
class BTEditorIDGenerator (line 25) | public class BTEditorIDGenerator {
method getInstance (line 34) | public static BTEditorIDGenerator getInstance() {
method getNextID (line 44) | public long getNextID() {
method BTEditorIDGenerator (line 51) | private BTEditorIDGenerator() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditorInput.java
class BTEditorInput (line 52) | public class BTEditorInput implements IEditorInput {
method BTEditorInput (line 105) | public BTEditorInput(String treeName, boolean isFromFile, boolean isFr...
method getTreeName (line 136) | public String getTreeName() {
method setTreeName (line 151) | public void setTreeName(String treeName) {
method isFromFile (line 158) | public boolean isFromFile() {
method setIsFromFile (line 165) | public void setIsFromFile(boolean isFromFile) {
method isFromGuard (line 172) | public boolean isFromGuard() {
method setIsFromGuard (line 179) | public void setIsFromGuard(boolean isFromGuard) {
method getEditorID (line 186) | public long getEditorID() {
method exists (line 194) | public boolean exists() {
method getImageDescriptor (line 202) | public ImageDescriptor getImageDescriptor() {
method getName (line 218) | public String getName() {
method getPersistable (line 233) | public IPersistableElement getPersistable() {
method getToolTipText (line 244) | public String getToolTipText() {
method getAdapter (line 255) | public Object getAdapter(Class adapter) {
method equals (line 263) | public boolean equals(Object o) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/event/ITreeModifierListener.java
type ITreeModifierListener (line 27) | public interface ITreeModifierListener {
method treeModified (line 31) | public void treeModified(TreeModifiedEvent event);
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/event/TreeModifiedEvent.java
class TreeModifiedEvent (line 28) | public class TreeModifiedEvent extends EventObject {
method TreeModifiedEvent (line 35) | public TreeModifiedEvent(Object source, BT tree) {
method getTree (line 43) | public BT getTree() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/BT.java
class BT (line 35) | public class BT {
method BT (line 49) | public BT() {
method BT (line 55) | public BT(BTNode root) {
method setRoot (line 63) | public void setRoot(BTNode root) {
method getRoot (line 71) | public BTNode getRoot() {
method findNode (line 78) | public BTNode findNode(Identifier id) {
method createNode (line 87) | public BTNode createNode(ConceptualBTNode conceptualNode) {
method addTreeModifiedListener (line 98) | public void addTreeModifiedListener(ITreeModifierListener listener) {
method fireTreeChanged (line 106) | public void fireTreeChanged(Object source) {
method checkTree (line 116) | public List<BTNode> checkTree() {
method clearErrors (line 125) | public void clearErrors() {
method recomputeIDs (line 145) | public void recomputeIDs(BTNode node) {
method reassignUnderlyingBT (line 158) | public void reassignUnderlyingBT(BTNode node) {
method reassignIDs (line 174) | private void reassignIDs(BTNode node, long offset) {
method computeLargestID (line 202) | private Identifier computeLargestID(BTNode node) {
method computeLargestID (line 222) | private void computeLargestID(BTNode node, Identifier largestKnownID) {
method computeLowestID (line 243) | private Identifier computeLowestID(BTNode node) {
method computeLowestID (line 263) | private void computeLowestID(BTNode node, Identifier lowestKnownID) {
method internalClearErrors (line 283) | private void internalClearErrors(BTNode node) {
method internalCheckTree (line 294) | private void internalCheckTree(BTNode node, List<BTNode> nodes) {
method internalFindNode (line 308) | private BTNode internalFindNode(BTNode currentNode, Identifier id) {
method updateNodeCounter (line 330) | public void updateNodeCounter() {
method recursiveUpdateNodeCounter (line 340) | private void recursiveUpdateNodeCounter(BTNode currentNode) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/BTNode.java
class BTNode (line 59) | public class BTNode extends Observable implements Serializable {
class Identifier (line 93) | public static class Identifier implements Serializable {
method Identifier (line 104) | public Identifier(long value) {
method Identifier (line 118) | public Identifier(String id) {
method toString (line 142) | public String toString() {
method getValue (line 146) | public long getValue() {
method setValue (line 150) | public void setValue(long value) {
method equals (line 157) | public boolean equals(Object o) {
method clone (line 174) | public Identifier clone() {
class Parameter (line 186) | public static class Parameter implements Serializable {
method getName (line 202) | public String getName() {
method setName (line 209) | public void setName(String name) {
method getValue (line 216) | public String getValue() {
method setValue (line 223) | public void setValue(String value) {
method setFromContext (line 230) | public void setFromContext(boolean fromContext) {
method getFromContext (line 238) | public boolean getFromContext() {
method clone (line 247) | public Parameter clone() {
class VarParameter (line 265) | public static class VarParameter extends Parameter
method VarParameter (line 272) | public VarParameter(Parameter par)
method getIsConstant (line 282) | public boolean getIsConstant() {
method setIsConstant (line 289) | public void setIsConstant(boolean isConstant) {
method getVariableName (line 296) | public String getVariableName() {
method setVariableName (line 300) | public void setVariableName(String value) {
method clone (line 309) | public VarParameter clone()
method BTNode (line 327) | public BTNode() {
method BTNode (line 335) | public BTNode(Identifier id) {
method getBT (line 346) | public BT getBT() {
method setBT (line 356) | public void setBT(BT tree) {
method getConceptualNode (line 363) | public ConceptualBTNode getConceptualNode() {
method setConceptualNode (line 370) | public void setConceptualNode(ConceptualBTNode conceptualNode) {
method getParent (line 380) | public BTNode getParent() {
method setParent (line 387) | public void setParent(BTNode parent) {
method getID (line 396) | public Identifier getID() {
method getName (line 403) | public String getName() {
method setName (line 410) | public void setName(String name) {
method getParameters (line 419) | public List<Parameter> getParameters() {
method setParameters (line 427) | public void setParameters(List<Parameter> parameters) {
method getNumChildren (line 436) | public int getNumChildren() {
method getChildren (line 444) | public List<BTNode> getChildren() {
method getErrorMessage (line 451) | public String getErrorMessage() {
method addChild (line 458) | public void addChild(BTNode child) {
method removeChild (line 467) | public void removeChild(BTNode child) {
method addParameter (line 476) | public void addParameter(Parameter parameter) {
method addAsSibling (line 488) | public void addAsSibling(BTNode other) {
method setID (line 509) | public void setID(Identifier id) {
method setGuard (line 520) | public void setGuard(BTNode guard) {
method getGuard (line 527) | public BTNode getGuard() {
method hasAsDescendant (line 535) | public boolean hasAsDescendant(BTNode other) {
method clearParameters (line 552) | public void clearParameters() {
method clearErrors (line 561) | public void clearErrors() {
method check (line 574) | public boolean check() {
method checkParameter (line 675) | public static boolean checkParameter(
method checkVarParameter (line 798) | public static boolean checkVarParameter(
method clone (line 872) | public BTNode clone() {
method toString (line 923) | public String toString() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/ConceptualBTNode.java
class ConceptualBTNode (line 38) | public class ConceptualBTNode implements Serializable {
type NodeInternalType (line 47) | public static enum NodeInternalType {
method toString (line 49) | public String toString() {
method toString (line 54) | public String toString() {
method toString (line 59) | public String toString() {
method toString (line 64) | public String toString() {
type ParameterType (line 121) | public static enum ParameterType implements Serializable {
method getPossibleValues (line 123) | public String[] getPossibleValues() {
method getReadableType (line 127) | public String getReadableType() {
method getReadableType (line 133) | public String getReadableType() {
method getReadableType (line 138) | public String getReadableType() {
method getReadableType (line 143) | public String getReadableType() {
method getPossibleValues (line 148) | public String[] getPossibleValues() {
method getReadableType (line 152) | public String getReadableType() {
method getReadableType (line 158) | public String getReadableType() {
method getPossibleValues (line 163) | public String[] getPossibleValues() {
method getReadableType (line 167) | public String getReadableType() {
method getReadableType (line 173) | public String getReadableType() {
method getReadableType (line 178) | public String getReadableType() {
method getReadableType (line 189) | public String getReadableType() {
method getReadableType (line 194) | public String getReadableType() {
method getReadableType (line 200) | public String getReadableType() {
method getReadableType (line 206) | public String getReadableType() {
method getReadableType (line 212) | public String getReadableType() {
method getPossibleValues (line 227) | public String[] getPossibleValues() {
method getReadableType (line 234) | public abstract String getReadableType();
method isVariable (line 239) | public static boolean isVariable(ParameterType type)
class Parameter (line 256) | public static class Parameter implements Serializable {
method getNodeClasses (line 282) | public List<String> getNodeClasses() {
method addNodeClass (line 292) | public void addNodeClass(String nodeClass) {
method getName (line 299) | public String getName() {
method setName (line 306) | public void setName(String name) {
method getType (line 313) | public ParameterType getType() {
method setType (line 320) | public void setType(ParameterType type) {
method setContextable (line 327) | public void setContextable(boolean contextable) {
method getContextable (line 335) | public boolean getContextable() {
method clone (line 344) | public Parameter clone() {
method ConceptualBTNode (line 362) | public ConceptualBTNode() {
method getType (line 370) | public String getType() {
method setType (line 377) | public void setType(String type) {
method getParameters (line 385) | public List<Parameter> getParameters() {
method setParameters (line 392) | public void setParameters(List<Parameter> parameters) {
method getNumChildren (line 402) | public int getNumChildren() {
method setNumChildren (line 412) | public void setNumChildren(int numChildren) {
method getIcon (line 420) | public String getIcon() {
method setIcon (line 427) | public void setIcon(String icon) {
method addParameter (line 434) | public void addParameter(Parameter parameter) {
method getReadableType (line 442) | public String getReadableType() {
method setReadableType (line 449) | public void setReadableType(String type) {
method getHasName (line 458) | public boolean getHasName() {
method setHasName (line 467) | public void setHasName(boolean hasName) {
method getName (line 475) | public String getName() {
method setName (line 482) | public void setName(String name) {
method clone (line 491) | public ConceptualBTNode clone() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/ConceptualNodesTree.java
class ConceptualNodesTree (line 42) | public class ConceptualNodesTree {
method ConceptualNodesTree (line 52) | public ConceptualNodesTree() {
method getRoots (line 59) | public List<NodesTreeItem> getRoots() {
method setRoots (line 66) | public void setRoots(List<NodesTreeItem> roots) {
method insertNode (line 84) | public void insertNode(String category, NodesTreeItem node) {
class NodesTreeItem (line 159) | public static abstract class NodesTreeItem {
method getParent (line 162) | public NodesTreeItem getParent() {
method setParent (line 166) | public void setParent(NodesTreeItem parent) {
method getName (line 170) | public abstract String getName();
class CategoryItem (line 179) | public static class CategoryItem extends NodesTreeItem {
method CategoryItem (line 183) | public CategoryItem() {
method addChild (line 187) | public void addChild(NodesTreeItem child) {
method getName (line 191) | public String getName() {
method setName (line 195) | public void setName(String name) {
method getChildren (line 199) | public List<NodesTreeItem> getChildren() {
method getNumChildren (line 203) | public int getNumChildren() {
class ConceptualBTNodeItem (line 214) | public static class ConceptualBTNodeItem extends NodesTreeItem {
method ConceptualBTNodeItem (line 217) | public ConceptualBTNodeItem(ConceptualBTNode nodeModel) {
method getName (line 221) | public String getName() {
method getNodeModel (line 225) | public ConceptualBTNode getNodeModel() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/DetailsDialog.java
class DetailsDialog (line 45) | public class DetailsDialog extends IconAndMessageDialog {
method DetailsDialog (line 110) | public DetailsDialog(String title, String message, String details, int...
method DetailsDialog (line 136) | public DetailsDialog(String title, String message, String details, int...
method createDialogArea (line 166) | protected Control createDialogArea(Composite parent) {
method createButtonsForButtonBar (line 177) | protected void createButtonsForButtonBar(Composite parent) {
method buttonPressed (line 188) | protected void buttonPressed(int buttonId) {
method getImage (line 247) | protected Image getImage() {
method configureShell (line 269) | protected void configureShell(Shell shell) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/Extensions.java
class Extensions (line 25) | public class Extensions {
method getBTFileExtensions (line 44) | public static String[] getBTFileExtensions() {
method getCppFileExtensions (line 52) | public static String[] getCppFileExtensions(){
method getInlFileExtensions (line 61) | public static String[] getInlFileExtensions(){
method getMMPMDomainFileExtensions (line 69) | public static String[] getMMPMDomainFileExtensions() {
method getFiltersFromExtensions (line 77) | public static String[] getFiltersFromExtensions(String[] extensions) {
method getUnifiedFilterFromExtensions (line 89) | public static String getUnifiedFilterFromExtensions(String[] extension...
method joinArrays (line 101) | public static String[] joinArrays(String[] array1, String[] array2) {
method joinFileNameAndExtension (line 113) | public static String joinFileNameAndExtension(String fileName,
method Extensions (line 122) | private Extensions() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/IconsPaths.java
class IconsPaths (line 24) | public class IconsPaths {
method IconsPaths (line 37) | private IconsPaths() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/OverlayImageIcon.java
class OverlayImageIcon (line 29) | public class OverlayImageIcon extends CompositeImageDescriptor {
method OverlayImageIcon (line 48) | public OverlayImageIcon(Image baseImage, Image decoration) {
method drawCompositeImage (line 61) | protected void drawCompositeImage(int arg0, int arg1) {
method getSize (line 74) | protected Point getSize() {
method getImage (line 83) | public Image getImage() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/Pair.java
class Pair (line 29) | public class Pair<T, S> implements Serializable {
method Pair (line 48) | public Pair(T f, S s) {
method getFirst (line 58) | public T getFirst() {
method getSecond (line 67) | public S getSecond() {
method setFirst (line 77) | public void setFirst(T f) {
method setSecond (line 87) | public void setSecond(S s) {
method toString (line 96) | public String toString() {
method equals (line 100) | public boolean equals(Object o){
method hashCode (line 112) | public int hashCode(){
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/StandardDialogs.java
class StandardDialogs (line 32) | public class StandardDialogs {
method StandardDialogs (line 36) | private StandardDialogs() {}
method informationDialog (line 38) | public static void informationDialog(String title, String informationM...
method errorDialog (line 42) | public static void errorDialog(String title, String errorMessage) {
method exceptionDialog (line 46) | public static void exceptionDialog(String title, String errorMessage, ...
method exceptionDialog (line 54) | public static void exceptionDialog(String title, String errorMessage, ...
method warningDialog (line 67) | public static void warningDialog(String title, String warningMessage) {
method confirmationDialog (line 71) | public static boolean confirmationDialog(String title, String confirma...
method questionDialog (line 75) | public static boolean questionDialog(String title, String question) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/Utilities.java
class Utilities (line 46) | public class Utilities {
method getView (line 50) | public static IViewPart getView(Class c) {
method getBTEditors (line 69) | public static List<BTEditor> getBTEditors() {
method getBTEditor (line 92) | public static BTEditor getBTEditor(long btEditorID) {
method getActiveBTEditor (line 107) | public static BTEditor getActiveBTEditor() {
method getMainWindow (line 124) | public static IWorkbenchWindow getMainWindow() {
method getMainWindowActivePage (line 132) | public static IWorkbenchPage getMainWindowActivePage() {
method getDisplay (line 139) | public static Display getDisplay() {
method getShell (line 146) | public static Shell getShell() {
method stackTraceToString (line 156) | public static String stackTraceToString(Throwable t) {
method activateEditor (line 183) | public static void activateEditor(EditorPart editor) {
method Utilities (line 188) | private Utilities() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/BTNodeIndentifierTransfer.java
class BTNodeIndentifierTransfer (line 38) | public class BTNodeIndentifierTransfer extends ByteArrayTransfer {
method BTNodeIndentifierTransfer (line 44) | private BTNodeIndentifierTransfer(){}
method getInstance (line 46) | public static BTNodeIndentifierTransfer getInstance(){
method getTypeNames (line 57) | protected String[] getTypeNames(){
method getTypeIds (line 65) | protected int[] getTypeIds(){
method validate (line 73) | protected boolean validate(Object object){
method javaToNative (line 82) | public void javaToNative(Object object, TransferData transferData){
method nativeToJava (line 115) | public Object nativeToJava(TransferData transferData){
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/ConceptualBTNodeTransfer.java
class ConceptualBTNodeTransfer (line 39) | public class ConceptualBTNodeTransfer extends ByteArrayTransfer {
method ConceptualBTNodeTransfer (line 45) | private ConceptualBTNodeTransfer() {
method getInstance (line 48) | public static ConceptualBTNodeTransfer getInstance() {
method getTypeNames (line 60) | protected String[] getTypeNames() {
method getTypeIds (line 69) | protected int[] getTypeIds() {
method validate (line 78) | protected boolean validate(Object object) {
method javaToNative (line 88) | public void javaToNative(Object object, TransferData transferData) {
method nativeToJava (line 122) | public Object nativeToJava(TransferData transferData) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/ConceptualNodesTreeViewer.java
class ConceptualNodesTreeViewer (line 61) | public class ConceptualNodesTreeViewer extends Composite {
method ConceptualNodesTreeViewer (line 70) | public ConceptualNodesTreeViewer(Composite parent, int style) {
method addTree (line 106) | public void addTree(ConceptualNodesTree tree) {
class NodesTreeViewerDragListener (line 118) | private class NodesTreeViewerDragListener implements DragSourceListener {
method dragFinished (line 119) | public void dragFinished(DragSourceEvent event) {
method dragSetData (line 122) | public void dragSetData(DragSourceEvent event) {
method dragStart (line 129) | public void dragStart(DragSourceEvent event) {
class BTContentProvider (line 151) | private static class BTContentProvider implements ITreeContentProvider {
method getChildren (line 152) | public Object[] getChildren(Object parentElement) {
method getParent (line 161) | public Object getParent(Object element) {
method hasChildren (line 165) | public boolean hasChildren(Object element) {
method getElements (line 174) | public Object[] getElements(Object inputElement) {
method dispose (line 184) | public void dispose() {
method inputChanged (line 187) | public void inputChanged(Viewer viewer, Object oldInput, Object newI...
class BTLabelProvider (line 197) | private static class BTLabelProvider implements ILabelProvider {
method getImage (line 198) | public Image getImage(Object element) {
method getText (line 207) | public String getText(Object element) {
method addListener (line 211) | public void addListener(ILabelProviderListener listener) {
method dispose (line 214) | public void dispose() {
method isLabelProperty (line 217) | public boolean isLabelProperty(Object element, String property) {
method removeListener (line 221) | public void removeListener(ILabelProviderListener listener) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/NodeInfoViewer.java
class NodeInfoViewer (line 50) | public class NodeInfoViewer extends Composite implements Observer {
method NodeInfoViewer (line 68) | public NodeInfoViewer(Composite parent, int style) {
method setNode (line 100) | public void setNode(BTNode node) {
method update (line 115) | public void update(Observable o, Object arg) {
method updateView (line 123) | private void updateView() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/views/NodeInfo.java
class NodeInfo (line 36) | public class NodeInfo extends ViewPart {
method createPartControl (line 40) | public void createPartControl(Composite parent) {
method setFocus (line 54) | public void setFocus() {
method setNode (line 60) | public void setNode(BTNode node) {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/views/NodesNavigator.java
class NodesNavigator (line 37) | public class NodesNavigator extends ViewPart {
method createPartControl (line 41) | public void createPartControl(Composite parent) {
method addTree (line 56) | public void addTree(ConceptualNodesTree tree) {
method setFocus (line 64) | public void setFocus() {
FILE: JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/views/NodesSearcher.java
class NodesSearcher (line 65) | public class NodesSearcher extends ViewPart {
method createPartControl (line 91) | public void createPartControl(Composite parent) {
method setFocus (line 117) | public void setFocus() {
method createBottomComposite (line 127) | private void createBottomComposite(Composite parent) {
method createTopComposite (line 165) | private void createTopComposite(Composite parent) {
method createSearchButton (line 184) | private void createSearchButton(Composite parent) {
method createTextField (line 205) | private Text createTextField(Composite parent) {
class ResultsTableLabelProvider (line 229) | private class ResultsTableLabelProvider implements ITableLabelProvider {
method addListener (line 230) | public void addListener(ILabelProviderListener listener) {
method dispose (line 233) | public void dispose() {
method isLabelProperty (line 236) | public boolean isLabelProperty(Object element, String property) {
method removeListener (line 240) | public void removeListener(ILabelProviderListener listener) {
method getColumnImage (line 243) | public Image getColumnImage(Object element, int columnIndex) {
method getColumnText (line 247) | public String getColumnText(Object element, int columnIndex) {
class ResultsTableContentProvider (line 259) | private class ResultsTableContentProvider implements IStructuredConten...
method dispose (line 260) | public void dispose() {
method inputChanged (line 264) | public void inputChanged(Viewer viewer, Object oldInput, Object newI...
method getElements (line 268) | public Object[] getElements(Object inputElement) {
method performSearch (line 284) | private void performSearch(String text) {
method searchNode (line 304) | private void searchNode(String text, List<Identifier> foundNodes, BTNo...
Condensed preview — 170 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,133K chars).
[
{
"path": "Documentation/JBT.tex",
"chars": 66111,
"preview": "\\documentclass[a4paper,10pt]{article}\n\\usepackage[utf8x]{inputenc}\n\\usepackage{graphicx}\n\\usepackage{minted}\n\n%opening\n\\"
},
{
"path": "Documentation/JBTBib.bib",
"chars": 282,
"preview": "@Book{Millington09,\n author =\t {Ian Millington and John Funge},\n title = \t {Artificial Intelligence for Games},\n publ"
},
{
"path": "JBTCore/.classpath",
"chars": 482,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<classpath>\r\n\t<classpathentry kind=\"src\" path=\"src\"/>\r\n\t<classpathentry kind=\"co"
},
{
"path": "JBTCore/.gitignore",
"chars": 5,
"preview": "/bin\n"
},
{
"path": "JBTCore/.project",
"chars": 362,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>JBT</name>\n\t<comment></comment>\n\t<projects>\n\t</projec"
},
{
"path": "JBTCore/src/jbt/exception/IllegalReturnStatusException.java",
"chars": 1077,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/exception/NotTickableException.java",
"chars": 973,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/exception/SpawnException.java",
"chars": 960,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/exception/TickException.java",
"chars": 976,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/context/BasicContext.java",
"chars": 3713,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/context/GenericBTLibrary.java",
"chars": 4294,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/context/HierarchicalContext.java",
"chars": 2412,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/context/SafeContext.java",
"chars": 5761,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/context/SafeOutputContext.java",
"chars": 7857,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/BTExecutor.java",
"chars": 18538,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/BTExecutorFactory.java",
"chars": 1881,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/BTLibraryFactory.java",
"chars": 2889,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/ContextFactory.java",
"chars": 3388,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/ExecutionTask.java",
"chars": 34033,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/IBTExecutor.java",
"chars": 3465,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/IBTLibrary.java",
"chars": 1475,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/IContext.java",
"chars": 3068,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/ITaskState.java",
"chars": 1919,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/TaskState.java",
"chars": 2357,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/TaskStateFactory.java",
"chars": 2506,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/event/ITaskListener.java",
"chars": 1188,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/core/event/TaskEvent.java",
"chars": 2123,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionComposite.java",
"chars": 1793,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionDynamicPriorityList.java",
"chars": 14850,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionParallel.java",
"chars": 7126,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionRandomSelector.java",
"chars": 5174,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionRandomSequence.java",
"chars": 5259,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionSelector.java",
"chars": 4728,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionSequence.java",
"chars": 4835,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/composite/ExecutionStaticPriorityList.java",
"chars": 11406,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionDecorator.java",
"chars": 1793,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionHierarchicalContextManager.java",
"chars": 3802,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionInterrupter.java",
"chars": 7755,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionInverter.java",
"chars": 3782,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionLimit.java",
"chars": 5445,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionRepeat.java",
"chars": 3675,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionSafeContextManager.java",
"chars": 3680,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionSafeOutputContextManager.java",
"chars": 4001,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionSucceeder.java",
"chars": 3429,
"preview": "/*\r\n * Copyright (C) 2012 Ricardo Juan Palma Durán\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\""
},
{
"path": "JBTCore/src/jbt/execution/task/decorator/ExecutionUntilFail.java",
"chars": 4150,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionFailure.java",
"chars": 2745,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionLeaf.java",
"chars": 1956,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionPerformInterruption.java",
"chars": 3622,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionSubtreeLookup.java",
"chars": 4913,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionSuccess.java",
"chars": 2745,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionVariableRenamer.java",
"chars": 3431,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/ExecutionWait.java",
"chars": 3476,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/action/ExecutionAction.java",
"chars": 1791,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/execution/task/leaf/condition/ExecutionCondition.java",
"chars": 1833,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/core/ModelTask.java",
"chars": 13696,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelComposite.java",
"chars": 1418,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelDynamicPriorityList.java",
"chars": 2526,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelParallel.java",
"chars": 3856,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelRandomSelector.java",
"chars": 1920,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelRandomSequence.java",
"chars": 1920,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelSelector.java",
"chars": 2089,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelSequence.java",
"chars": 2078,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/composite/ModelStaticPriorityList.java",
"chars": 2194,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelDecorator.java",
"chars": 2074,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelHierarchicalContextManager.java",
"chars": 2146,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelInterrupter.java",
"chars": 1947,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelInverter.java",
"chars": 2078,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelLimit.java",
"chars": 2259,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelRepeat.java",
"chars": 1743,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelSafeContextManager.java",
"chars": 1980,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelSafeOutputContextManager.java",
"chars": 2685,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelSucceeder.java",
"chars": 1658,
"preview": "/*\r\n * Copyright (C) 2012 Ricardo Juan Palma Durán\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\""
},
{
"path": "JBTCore/src/jbt/model/task/decorator/ModelUntilFail.java",
"chars": 1855,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelFailure.java",
"chars": 1497,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelLeaf.java",
"chars": 1012,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelPerformInterruption.java",
"chars": 3537,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelSubtreeLookup.java",
"chars": 2378,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelSuccess.java",
"chars": 1500,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelVariableRenamer.java",
"chars": 2479,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/ModelWait.java",
"chars": 2190,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/action/ModelAction.java",
"chars": 1233,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/model/task/leaf/condition/ModelCondition.java",
"chars": 1249,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/ActionsAndConditionsGenerator.java",
"chars": 22074,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/BTLibraryGenerator.java",
"chars": 14081,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/librarygenerator/BTLibraryGenerationException.java",
"chars": 1080,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/librarygenerator/BTLibraryGenerator.java",
"chars": 10822,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/lowlevelgenerator/ActionsGenerator.java",
"chars": 9228,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/lowlevelgenerator/CommonCodeGenerationUtilities.java",
"chars": 18115,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/lowlevelgenerator/ConditionsGenerator.java",
"chars": 9426,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/modelbtgenerator/ModelBTGenerationException.java",
"chars": 1108,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/modelbtgenerator/ModelBTGenerator.java",
"chars": 53185,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/tools/btlibrarygenerator/util/Util.java",
"chars": 8056,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTCore/src/jbt/util/Pair.java",
"chars": 2542,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/.classpath",
"chars": 480,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<classpath>\r\n\t<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CON"
},
{
"path": "JBTEditor/jbt.tools.bteditor/.gitignore",
"chars": 5,
"preview": "/bin\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/.project",
"chars": 651,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>jbt.tools.bteditor</name>\n\t<comment></comment>\n\t<proj"
},
{
"path": "JBTEditor/jbt.tools.bteditor/.settings/org.eclipse.jdt.core.prefs",
"chars": 388,
"preview": "#Thu Jun 10 14:14:01 CEST 2010\neclipse.preferences.version=1\norg.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=ena"
},
{
"path": "JBTEditor/jbt.tools.bteditor/META-INF/MANIFEST.MF",
"chars": 431,
"preview": "Manifest-Version: 1.0\nBundle-ManifestVersion: 2\nBundle-Name: BT Editor\nBundle-SymbolicName: jbt.tools.bteditor; singleto"
},
{
"path": "JBTEditor/jbt.tools.bteditor/bteditor.product",
"chars": 3157,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<?pde version=\"3.5\"?>\r\n\r\n<product name=\"JBT Editor\" id=\"jbt.tools.bteditor.produ"
},
{
"path": "JBTEditor/jbt.tools.bteditor/build.properties",
"chars": 306,
"preview": "source.. = src/\noutput.. = bin/\nbin.includes = plugin.xml,\\\n META-INF/,\\\n libs/jdom.jar,\\\n "
},
{
"path": "JBTEditor/jbt.tools.bteditor/files/standardNodes.xml",
"chars": 6851,
"preview": "<!-- \nThis file defines the nodes that are internal to the application. The format of such nodes is:\n\n<Node>\n\t<Type>Type"
},
{
"path": "JBTEditor/jbt.tools.bteditor/icons/jbt.xpm",
"chars": 130200,
"preview": "/* XPM */\nstatic char *jbt[] = {\n/* columns rows colors chars-per-pixel */\n\"250 250 256 2\",\n\" c #000000\",\n\". c #080B0"
},
{
"path": "JBTEditor/jbt.tools.bteditor/plugin.xml",
"chars": 5375,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?eclipse version=\"3.4\"?>\n<plugin>\n\n <extension\n id=\"application\"\n "
},
{
"path": "JBTEditor/jbt.tools.bteditor/plugin_customization.ini",
"chars": 99,
"preview": "org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false\r\norg.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false\r\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/Activator.java",
"chars": 1957,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/Application.java",
"chars": 2507,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationActionBarAdvisor.java",
"chars": 4080,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationIcons.java",
"chars": 4493,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationWorkbenchAdvisor.java",
"chars": 1208,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/ApplicationWorkbenchWindowAdvisor.java",
"chars": 1543,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/BTCPPManager.java",
"chars": 9401,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/BTXMLManager.java",
"chars": 8756,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/DisableNewEditorHandler.java",
"chars": 1234,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/NodesLoader.java",
"chars": 17617,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/Perspective.java",
"chars": 1632,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/CheckErrorsAction.java",
"chars": 1071,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/ClearErrorsAction.java",
"chars": 1075,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/CollapseTreeAction.java",
"chars": 1008,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/DialogExportAsCppAction.java",
"chars": 3626,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/DialogLoadMMPMDomainAction.java",
"chars": 3212,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/DialogOpenBTAction.java",
"chars": 3192,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/EditorActionDelegate.java",
"chars": 1150,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/ExpandTreeAction.java",
"chars": 1006,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/ExportToCppAction.java",
"chars": 1764,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/LoadMMPMDomainAction.java",
"chars": 2211,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/NewBTAction.java",
"chars": 2086,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/OpenBTAction.java",
"chars": 2163,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/SaveBTAction.java",
"chars": 1734,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/actions/SaveBTAsAction.java",
"chars": 3348,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditor.java",
"chars": 83389,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditorCopyAndPasteManager.java",
"chars": 2650,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditorIDGenerator.java",
"chars": 1438,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/editor/BTEditorInput.java",
"chars": 8683,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/event/ITreeModifierListener.java",
"chars": 1000,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/event/TreeModifiedEvent.java",
"chars": 1206,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/BT.java",
"chars": 11151,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/BTNode.java",
"chars": 23070,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/ConceptualBTNode.java",
"chars": 12713,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/model/ConceptualNodesTree.java",
"chars": 6383,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/DetailsDialog.java",
"chars": 8560,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/Extensions.java",
"chars": 3785,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/IconsPaths.java",
"chars": 1456,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/OverlayImageIcon.java",
"chars": 2308,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/Pair.java",
"chars": 2417,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/StandardDialogs.java",
"chars": 2630,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/util/Utilities.java",
"chars": 4951,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/BTNodeIndentifierTransfer.java",
"chars": 3529,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/ConceptualBTNodeTransfer.java",
"chars": 3857,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/ConceptualNodesTreeViewer.java",
"chars": 7084,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/viewers/NodeInfoViewer.java",
"chars": 6230,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/views/NodeInfo.java",
"chars": 1932,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/views/NodesNavigator.java",
"chars": 2112,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor/src/jbt/tools/bteditor/views/NodesSearcher.java",
"chars": 10143,
"preview": "/*\n * Copyright (C) 2012 Ricardo Juan Palma Durán\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor.feature/.project",
"chars": 381,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>jbt.tools.bteditor.feature</name>\n\t<comment></comment"
},
{
"path": "JBTEditor/jbt.tools.bteditor.feature/build.properties",
"chars": 27,
"preview": "bin.includes = feature.xml\n"
},
{
"path": "JBTEditor/jbt.tools.bteditor.feature/feature.xml",
"chars": 924,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<feature\r\n id=\"jbt.tools.bteditor.feature\"\r\n label=\"JBT Editor\"\r\n "
},
{
"path": "LICENSE.txt",
"chars": 9017,
"preview": "Apache License\n\nVersion 2.0, January 2004\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, repro"
},
{
"path": "README.txt",
"chars": 4425,
"preview": "*******\nLicense\n*******\n\nJBT is released under the Apache License, Version 2.0.\n\n****************************\nWhat's Jav"
},
{
"path": "UserGuide/UserGuide.tex",
"chars": 75814,
"preview": "\\documentclass[a4paper]{article}\n\n\\usepackage{graphicx}\n\\usepackage{minted}\n\\usepackage{xspace}\n\\usepackage{verbatim}\n\n\\"
},
{
"path": "UserGuide/UserGuideBib.bib",
"chars": 907,
"preview": "@Book{Millington09,\n author =\t {Ian Millington and John Funge},\n title = \t {Artificial Intelligence for Games},\n publ"
},
{
"path": "UserGuide/userguide.kilepr",
"chars": 776,
"preview": "[General]\ndef_graphic_ext=eps\nimg_extIsRegExp=false\nimg_extensions=.eps .jpg .jpeg .png .pdf .ps .fig .gif\nkileprversion"
}
]
// ... and 9 more files (download for full content)
About this extraction
This page contains the full source code of the gaia-ucm/jbt GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 170 files (1.0 MB), approximately 297.7k tokens, and a symbol index with 1119 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.