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

Last change on this file since 2256 was 2256, checked in by pharms, 7 years ago
  • removed some TODOs
  • Property svn:executable set to *
File size: 8.7 KB
RevLine 
[1113]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
[922]15package de.ugoe.cs.autoquest.tasktrees.treeifc;
[439]16
17/**
[1191]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>
[439]23 */
[1146]24public interface ITaskBuilder {
[439]25
[557]26    /**
[1191]27     * <p>
[1294]28     * adds a child to a sequence instance. May ensure, that the child is a valid child considering
[1191]29     * the task model of the parent. In that case, an IllegalArgumentException is thrown.
30     * </p>
31     *
[1294]32     * @param instance the instance of add the child to
33     * @param child    the child to be added
[1191]34     *
35     * @throws IllegalArgumentException as described
[1146]36     */
[1294]37    void addChild(ISequenceInstance instance, ITaskInstance child) throws IllegalArgumentException;
[1146]38
39    /**
40     * <p>
[1294]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>
[1191]83     * adds a task instance to a user session
[1146]84     * </p>
[1114]85     *
[1191]86     * @param session      the session to add the task instance to
87     * @param taskInstance the task instance to add
[557]88     */
[1146]89    void addExecutedTask(IUserSession session, ITaskInstance taskInstance);
[439]90
[557]91    /**
[1191]92     * <p>
93     * adds a task instance to a task instance list
94     * </p>
[1146]95     *
[1191]96     * @param taskInstanceList the list to add the task instance to
97     * @param taskInstance     the task instance to add
[1146]98     */
99    void addTaskInstance(ITaskInstanceList taskInstanceList, ITaskInstance taskInstance);
100
101    /**
[1191]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>
[1146]106     *
[1191]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
[1146]112     */
[1191]113    void addTaskInstance(ITaskInstanceList taskInstanceList, int index, ITaskInstance taskInstance)
114        throws IndexOutOfBoundsException;
[1146]115
116    /**
[1191]117     * <p>
118     * sets a task instance in a task instance list at a specific position
119     * </p>
[1146]120     *
[1191]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
[1146]126     */
[1191]127    void setTaskInstance(ITaskInstanceList taskInstanceList, int index, ITaskInstance taskInstance)
128        throws IndexOutOfBoundsException;
[1146]129
130    /**
131     * <p>
[1191]132     * sets the task model of a task instance
[1146]133     * </p>
[1191]134     *
135     * @param taskInstance the task instance to set the task model for
136     * @param task         the task model of the instance
[557]137     */
[1146]138    void setTask(ITaskInstance taskInstance, ITask task);
[439]139
[557]140    /**
[1191]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
[1146]147     */
148    void addChild(ISequence parent, ITask child);
149
150    /**
[1191]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
[1146]160     */
[1191]161    void addChild(ISequence parent, int index, ITask child)
162        throws IndexOutOfBoundsException;
[1146]163
164    /**
[1191]165     * <p>
166     * replaces the child task of a sequence at a specific position
167     * </p>
[1126]168     *
[1191]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
[1126]174     */
[1191]175    void setChild(ISequence parent, int index, ITask child)
176        throws IndexOutOfBoundsException;
[1126]177
178    /**
[1191]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
[557]185     */
[1146]186    void addChild(ISelection parent, ITask child);
[439]187
[557]188    /**
[1191]189     * <p>
190     * sets the child task of an iteration
191     * </p>
[557]192     *
[1197]193     * @param iteration the iteration to set the child of
194     * @param child     the child to be set
[557]195     */
[1191]196    void setMarkedTask(IIteration iteration, ITask child);
[439]197
[557]198    /**
[1191]199     * <p>
200     * sets the child task of an optional
201     * </p>
[557]202     *
[1197]203     * @param optional the optional to set the child of
204     * @param child    the child to be set
[1126]205     */
[1191]206    void setMarkedTask(IOptional optional, ITask child);
[1126]207
208    /**
[1191]209     * <p>
210     * removes the child of a sequence at a specific position
211     * </p>
[1126]212     *
[1191]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
[557]217     */
[1191]218    void removeChild(ISequence parent, int index)
219        throws IndexOutOfBoundsException;
[439]220
[557]221    /**
[1191]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
[557]229     */
[1146]230    void removeChild(ISelection parent, ITask child);
[439]231
[557]232    /**
[1191]233     * <p>
234     * removes the entry of a task instance list at a specific position
235     * </p>
[1146]236     *
[1191]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
[1146]241     */
[1191]242    void removeTaskInstance(ITaskInstanceList taskInstanceList, int index)
243        throws IndexOutOfBoundsException;
[1146]244
245    /**
[1191]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
[1126]254     */
[1146]255    void replaceChild(ISelection parent, ITask oldChild, ITask newChild);
[1126]256
[1766]257    /**
258     * <p>
[2256]259     * This method is called to discard a task instance. This means, that any reference to the
260     * instance is removed from the corresponding model. This ensures model consistency if the
261     * model or the instances or both are changed.
[1766]262     * </p>
263     *
[2256]264     * @param instance the instance to discard
[1766]265     */
266    void discardTaskInstance(ITaskInstance instance);
267
[439]268}
Note: See TracBrowser for help on using the repository browser.