source: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskBuilder.java @ 1294

Last change on this file since 1294 was 1294, checked in by pharms, 11 years ago
  • rework of task model to move event instance stuff to task instances
  • introduction of sequence, selection, iteration and optional instances
  • Property svn:executable set to *
File size: 8.4 KB
Line 
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
15package de.ugoe.cs.autoquest.tasktrees.treeifc;
16
17/**
18 * <p>
19 * Builder for task models. Can be used to create and edit task models. May perform integrity
20 * checks, though they may be incomplete as the integrity of a task model can not be ensured during
21 * creation.
22 * </p>
23 */
24public interface ITaskBuilder {
25
26    /**
27     * <p>
28     * adds a child to a sequence instance. May ensure, that the child is a valid child considering
29     * the task model of the parent. In that case, an IllegalArgumentException is thrown.
30     * </p>
31     *
32     * @param instance the instance of add the child to
33     * @param child    the child to be added
34     *
35     * @throws IllegalArgumentException as described
36     */
37    void addChild(ISequenceInstance instance, ITaskInstance child) throws IllegalArgumentException;
38
39    /**
40     * <p>
41     * adds a child to an iteration instance. May ensure, that the child is a valid child
42     * considering the task model of the parent. In that case, an IllegalArgumentException is
43     * thrown.
44     * </p>
45     *
46     * @param instance the instance of add the child to
47     * @param child    the child to be added
48     *
49     * @throws IllegalArgumentException as described
50     */
51    void addChild(IIterationInstance instance, ITaskInstance child) throws IllegalArgumentException;
52
53    /**
54     * <p>
55     * sets the child of a selection instance. May ensure, that the child is a valid child
56     * considering the task model of the parent. In that case, an IllegalArgumentException is
57     * thrown.
58     * </p>
59     *
60     * @param instance the instance of add the child to
61     * @param child    the child to be added
62     *
63     * @throws IllegalArgumentException as described
64     */
65    void setChild(ISelectionInstance instance, ITaskInstance child) throws IllegalArgumentException;
66
67    /**
68     * <p>
69     * sets the child of an optional instance. May ensure, that the child is a valid child
70     * considering the task model of the parent. In that case, an IllegalArgumentException is
71     * thrown.
72     * </p>
73     *
74     * @param instance the instance of add the child to
75     * @param child    the child to be added
76     *
77     * @throws IllegalArgumentException as described
78     */
79    void setChild(IOptionalInstance instance, ITaskInstance child) throws IllegalArgumentException;
80
81    /**
82     * <p>
83     * adds a task instance to a user session
84     * </p>
85     *
86     * @param session      the session to add the task instance to
87     * @param taskInstance the task instance to add
88     */
89    void addExecutedTask(IUserSession session, ITaskInstance taskInstance);
90
91    /**
92     * <p>
93     * adds a task instance to a task instance list
94     * </p>
95     *
96     * @param taskInstanceList the list to add the task instance to
97     * @param taskInstance     the task instance to add
98     */
99    void addTaskInstance(ITaskInstanceList taskInstanceList, ITaskInstance taskInstance);
100
101    /**
102     * <p>
103     * adds a task instance to a task instance list at a specific position. Subsequent task
104     * instances will be moved one index forward
105     * </p>
106     *
107     * @param taskInstanceList the list to add the task instance to
108     * @param index            the index of the task instance to add
109     * @param taskInstance     the task instance to add
110     *
111     * @throws IndexOutOfBoundsException if the index is invalid
112     */
113    void addTaskInstance(ITaskInstanceList taskInstanceList, int index, ITaskInstance taskInstance)
114        throws IndexOutOfBoundsException;
115
116    /**
117     * <p>
118     * sets a task instance in a task instance list at a specific position
119     * </p>
120     *
121     * @param taskInstanceList the list to set the task instance in
122     * @param index            the index of the task instance to replace
123     * @param taskInstance     the replacement for the task instance at the index
124     *
125     * @throws IndexOutOfBoundsException if the index is invalid
126     */
127    void setTaskInstance(ITaskInstanceList taskInstanceList, int index, ITaskInstance taskInstance)
128        throws IndexOutOfBoundsException;
129
130    /**
131     * <p>
132     * sets the task model of a task instance
133     * </p>
134     *
135     * @param taskInstance the task instance to set the task model for
136     * @param task         the task model of the instance
137     */
138    void setTask(ITaskInstance taskInstance, ITask task);
139
140    /**
141     * <p>
142     * adds a child task to the end of a sequence
143     * </p>
144     *
145     * @param parent the sequence to add the child to
146     * @param child  the child to be added
147     */
148    void addChild(ISequence parent, ITask child);
149
150    /**
151     * <p>
152     * adds a child task to a specific index of a sequence
153     * </p>
154     *
155     * @param parent the sequence to add the child to
156     * @param index  the index to set the child at
157     * @param child  the child to be added
158     *
159     * @throws IndexOutOfBoundsException if the index is invalid
160     */
161    void addChild(ISequence parent, int index, ITask child)
162        throws IndexOutOfBoundsException;
163
164    /**
165     * <p>
166     * replaces the child task of a sequence at a specific position
167     * </p>
168     *
169     * @param parent the sequence to replace the child in
170     * @param index  the index to replace the child at
171     * @param child  the child to be added
172     *
173     * @throws IndexOutOfBoundsException if the index is invalid
174     */
175    void setChild(ISequence parent, int index, ITask child)
176        throws IndexOutOfBoundsException;
177
178    /**
179     * <p>
180     * adds a child task to a selection
181     * </p>
182     *
183     * @param parent the selection to add the child to
184     * @param child  the child to be added
185     */
186    void addChild(ISelection parent, ITask child);
187
188    /**
189     * <p>
190     * sets the child task of an iteration
191     * </p>
192     *
193     * @param iteration the iteration to set the child of
194     * @param child     the child to be set
195     */
196    void setMarkedTask(IIteration iteration, ITask child);
197
198    /**
199     * <p>
200     * sets the child task of an optional
201     * </p>
202     *
203     * @param optional the optional to set the child of
204     * @param child    the child to be set
205     */
206    void setMarkedTask(IOptional optional, ITask child);
207
208    /**
209     * <p>
210     * removes the child of a sequence at a specific position
211     * </p>
212     *
213     * @param parent the sequence of which the child must be removed
214     * @param index  the index of the child to be removed
215     *
216     * @throws IndexOutOfBoundsException if the index is invalid
217     */
218    void removeChild(ISequence parent, int index)
219        throws IndexOutOfBoundsException;
220
221    /**
222     * <p>
223     * removes a child of a selection. Ignores the call, if the child is not found
224     * (comparison using equals).
225     * </p>
226     *
227     * @param parent the selection of which the child must be removed
228     * @param child  the child to be removes
229     */
230    void removeChild(ISelection parent, ITask child);
231
232    /**
233     * <p>
234     * removes the entry of a task instance list at a specific position
235     * </p>
236     *
237     * @param taskInstanceList the task instance list of which the entry must be removed
238     * @param index            the index of the entry to be removed
239     *
240     * @throws IndexOutOfBoundsException if the index is invalid
241     */
242    void removeTaskInstance(ITaskInstanceList taskInstanceList, int index)
243        throws IndexOutOfBoundsException;
244
245    /**
246     * <p>
247     * replaces a child of a selection. Throws an IllegalArgumentException if the child is not
248     * found (comparison using equals).
249     * </p>
250     *
251     * @param parent   the selection of which the child must be replace
252     * @param oldChild the child to replace
253     * @param newChild the replacement for the child
254     *
255     * @throws as described
256     */
257    void replaceChild(ISelection parent, ITask oldChild, ITask newChild);
258
259}
Note: See TracBrowser for help on using the repository browser.