// Copyright 2012 Georg-August-Universität Göttingen, Germany // // 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 de.ugoe.cs.autoquest.tasktrees.treeifc; /** *

* Builder for task models. Can be used to create and edit task models. May perform integrity * checks, though they may be incomplete as the integrity of a task model can not be ensured during * creation. *

*/ public interface ITaskBuilder { /** *

* adds a child to a sequence instance. May ensure, that the child is a valid child considering * the task model of the parent. In that case, an IllegalArgumentException is thrown. *

* * @param instance the instance of add the child to * @param child the child to be added * * @throws IllegalArgumentException as described */ void addChild(ISequenceInstance instance, ITaskInstance child) throws IllegalArgumentException; /** *

* adds a child to an iteration instance. May ensure, that the child is a valid child * considering the task model of the parent. In that case, an IllegalArgumentException is * thrown. *

* * @param instance the instance of add the child to * @param child the child to be added * * @throws IllegalArgumentException as described */ void addChild(IIterationInstance instance, ITaskInstance child) throws IllegalArgumentException; /** *

* sets the child of a selection instance. May ensure, that the child is a valid child * considering the task model of the parent. In that case, an IllegalArgumentException is * thrown. *

* * @param instance the instance of add the child to * @param child the child to be added * * @throws IllegalArgumentException as described */ void setChild(ISelectionInstance instance, ITaskInstance child) throws IllegalArgumentException; /** *

* sets the child of an optional instance. May ensure, that the child is a valid child * considering the task model of the parent. In that case, an IllegalArgumentException is * thrown. *

* * @param instance the instance of add the child to * @param child the child to be added * * @throws IllegalArgumentException as described */ void setChild(IOptionalInstance instance, ITaskInstance child) throws IllegalArgumentException; /** *

* adds a task instance to a user session *

* * @param session the session to add the task instance to * @param taskInstance the task instance to add */ void addExecutedTask(IUserSession session, ITaskInstance taskInstance); /** *

* adds a task instance to a task instance list *

* * @param taskInstanceList the list to add the task instance to * @param taskInstance the task instance to add */ void addTaskInstance(ITaskInstanceList taskInstanceList, ITaskInstance taskInstance); /** *

* adds a task instance to a task instance list at a specific position. Subsequent task * instances will be moved one index forward *

* * @param taskInstanceList the list to add the task instance to * @param index the index of the task instance to add * @param taskInstance the task instance to add * * @throws IndexOutOfBoundsException if the index is invalid */ void addTaskInstance(ITaskInstanceList taskInstanceList, int index, ITaskInstance taskInstance) throws IndexOutOfBoundsException; /** *

* sets a task instance in a task instance list at a specific position *

* * @param taskInstanceList the list to set the task instance in * @param index the index of the task instance to replace * @param taskInstance the replacement for the task instance at the index * * @throws IndexOutOfBoundsException if the index is invalid */ void setTaskInstance(ITaskInstanceList taskInstanceList, int index, ITaskInstance taskInstance) throws IndexOutOfBoundsException; /** *

* sets the task model of a task instance *

* * @param taskInstance the task instance to set the task model for * @param task the task model of the instance */ void setTask(ITaskInstance taskInstance, ITask task); /** *

* adds a child task to the end of a sequence *

* * @param parent the sequence to add the child to * @param child the child to be added */ void addChild(ISequence parent, ITask child); /** *

* adds a child task to a specific index of a sequence *

* * @param parent the sequence to add the child to * @param index the index to set the child at * @param child the child to be added * * @throws IndexOutOfBoundsException if the index is invalid */ void addChild(ISequence parent, int index, ITask child) throws IndexOutOfBoundsException; /** *

* replaces the child task of a sequence at a specific position *

* * @param parent the sequence to replace the child in * @param index the index to replace the child at * @param child the child to be added * * @throws IndexOutOfBoundsException if the index is invalid */ void setChild(ISequence parent, int index, ITask child) throws IndexOutOfBoundsException; /** *

* adds a child task to a selection *

* * @param parent the selection to add the child to * @param child the child to be added */ void addChild(ISelection parent, ITask child); /** *

* sets the child task of an iteration *

* * @param iteration the iteration to set the child of * @param child the child to be set */ void setMarkedTask(IIteration iteration, ITask child); /** *

* sets the child task of an optional *

* * @param optional the optional to set the child of * @param child the child to be set */ void setMarkedTask(IOptional optional, ITask child); /** *

* removes the child of a sequence at a specific position *

* * @param parent the sequence of which the child must be removed * @param index the index of the child to be removed * * @throws IndexOutOfBoundsException if the index is invalid */ void removeChild(ISequence parent, int index) throws IndexOutOfBoundsException; /** *

* removes a child of a selection. Ignores the call, if the child is not found * (comparison using equals). *

* * @param parent the selection of which the child must be removed * @param child the child to be removes */ void removeChild(ISelection parent, ITask child); /** *

* removes the entry of a task instance list at a specific position *

* * @param taskInstanceList the task instance list of which the entry must be removed * @param index the index of the entry to be removed * * @throws IndexOutOfBoundsException if the index is invalid */ void removeTaskInstance(ITaskInstanceList taskInstanceList, int index) throws IndexOutOfBoundsException; /** *

* replaces a child of a selection. Throws an IllegalArgumentException if the child is not * found (comparison using equals). *

* * @param parent the selection of which the child must be replace * @param oldChild the child to replace * @param newChild the replacement for the child */ void replaceChild(ISelection parent, ITask oldChild, ITask newChild); /** *

* This method is called to discard a task instance. This means, that any reference to the * instance is removed from the corresponding model. This ensures model consistency if the * model or the instances or both are changed. *

* * @param instance the instance to discard */ void discardTaskInstance(ITaskInstance instance); }