-
Notifications
You must be signed in to change notification settings - Fork 1
/
Task.java
36 lines (33 loc) · 1.25 KB
/
Task.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.ag.common.task;
import org.ag.common.agent.Agent;
/**
* A task for the framework is not a unit of work like a task is in Java concurrent programming, in this framework a
* task is more like a process to achieve something, for example, one could create a task to find food sources. Tasks
* can even use another tasks to achieve their goals.
*
* The execute(Agent) method executed by agents when they wish to achieve some goal and the task would help them with
* that.
*
* @author Luiz Filipe Abrahao <[email protected]>
*
*/
public interface Task {
/**
* Each task type has a name, an identifier that is unique and is used to
* tell one task to another when it is needed.
*
* @return String task type identifier.
*/
String getName();
/**
* Executes a set of instruction that defines the agent's behaviour when
* executing the task.
*
* <p>The parameter <em>agent</em> might seem a bit awkward at first, but it
* is necessary because the task need to have access to the agent's context
* when executing, for example: the agent's current node.</p>
*
* @param agent Agent that will perform the task.
*/
void execute(final Agent agent);
}