1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.tasktrees.treeifc; |
---|
16 | |
---|
17 | import java.io.Serializable; |
---|
18 | import java.util.Collection; |
---|
19 | |
---|
20 | /** |
---|
21 | * <p> |
---|
22 | * A task represents a model for events that occur if the user interacts with a |
---|
23 | * software for achieving a specific goal. A task can be a single event or a |
---|
24 | * complex structure of events and temporal relationships defining the event |
---|
25 | * order. Tasks may especially refer to other tasks to create task structures |
---|
26 | * similar to trees. These structures fully define in which ways the events that |
---|
27 | * form the task can occur. However, the structure of a task is not necessarily |
---|
28 | * a tree as task structures may be reused several times in larger scale task |
---|
29 | * structures. |
---|
30 | * </p> |
---|
31 | * |
---|
32 | * @author Patrick Harms |
---|
33 | */ |
---|
34 | public interface ITask extends Cloneable, Serializable { |
---|
35 | |
---|
36 | /** |
---|
37 | * <p> |
---|
38 | * implements the visitor pattern to be able to process tasks and their |
---|
39 | * children. |
---|
40 | * </p> |
---|
41 | * |
---|
42 | * @param visitor |
---|
43 | * the visitor used to process the task |
---|
44 | */ |
---|
45 | public void accept(ITaskVisitor visitor); |
---|
46 | |
---|
47 | /** |
---|
48 | * <p> |
---|
49 | * returns an exact copy of this task. The clone has the same id. If the |
---|
50 | * task has children, they are cloned as well. A call on the method |
---|
51 | * {@link #equals(ITask)} with the result of this method must return true. |
---|
52 | * </p> |
---|
53 | * |
---|
54 | * @return as described |
---|
55 | */ |
---|
56 | public ITask clone(); |
---|
57 | |
---|
58 | /** |
---|
59 | * <p> |
---|
60 | * checks whether this task is equal to another one. Task equality is only |
---|
61 | * given, if two tasks have the same id. This means, that this method must |
---|
62 | * only return true if the other task is either the same object or a clone |
---|
63 | * of it. |
---|
64 | * </p> |
---|
65 | * |
---|
66 | * @return as described |
---|
67 | */ |
---|
68 | public boolean equals(ITask task); |
---|
69 | |
---|
70 | /** |
---|
71 | * <p> |
---|
72 | * returns a human readable description for the task. |
---|
73 | * </p> |
---|
74 | * |
---|
75 | * @return as described |
---|
76 | */ |
---|
77 | public String getDescription(); |
---|
78 | |
---|
79 | /** |
---|
80 | * <p> |
---|
81 | * returns a collection of collections of all different execution variants |
---|
82 | * of this task. This is a grouping of all instances where each group |
---|
83 | * contains structurally identical instances. |
---|
84 | * </p> |
---|
85 | * |
---|
86 | * @return as described |
---|
87 | */ |
---|
88 | public Collection<Collection<ITaskInstance>> getExecutionVariants(); |
---|
89 | |
---|
90 | /** |
---|
91 | * <p> |
---|
92 | * every task is assigned a unique id which is returned by this method. The |
---|
93 | * id is unique for the current runtime. |
---|
94 | * </p> |
---|
95 | * |
---|
96 | * @return as described |
---|
97 | */ |
---|
98 | public int getId(); |
---|
99 | |
---|
100 | /** |
---|
101 | * <p> |
---|
102 | * returns a collection of all observed instances of this task |
---|
103 | * </p> |
---|
104 | * |
---|
105 | * @return as described |
---|
106 | */ |
---|
107 | public Collection<ITaskInstance> getInstances(); |
---|
108 | |
---|
109 | /** |
---|
110 | * <p> |
---|
111 | * returns a human readable type for the task. |
---|
112 | * </p> |
---|
113 | * |
---|
114 | * @return as described |
---|
115 | */ |
---|
116 | public String getType(); |
---|
117 | |
---|
118 | /** |
---|
119 | * <p> |
---|
120 | * returns a hash code for the task, which is usually the id returned by |
---|
121 | * {@link #getId()}. |
---|
122 | * </p> |
---|
123 | * |
---|
124 | * @return as described |
---|
125 | */ |
---|
126 | @Override |
---|
127 | public int hashCode(); |
---|
128 | |
---|
129 | } |
---|