source: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Iteration.java @ 1183

Last change on this file since 1183 was 1157, checked in by adeicke, 11 years ago

Added Visitor pattern for tasks.

  • Property svn:executable set to *
File size: 2.2 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.treeimpl;
16
17import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration;
18import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional;
19import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
20import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor;
21
22/**
23 * TODO comment
24 *
25 * @version $Revision: $ $Date: 19.02.2012$
26 * @author 2012, last modified by $Author: patrick$
27 */
28class Iteration extends MarkingTemporalRelationship implements IIteration {
29
30    /**  */
31    private static final long serialVersionUID = 1L;
32
33    /**
34     *
35     */
36    Iteration() {
37        super("iteration");
38    }
39
40    /* (non-Javadoc)
41     * @see MarkingTemporalRelationship#setMarkedTask(ITask)
42     */
43    @Override
44    protected void setMarkedTask(ITask markedTask) {
45        if (markedTask instanceof IIteration) {
46            throw new IllegalArgumentException
47                ("the marked task of an iteration must not be an iteration");
48        }
49        else if (markedTask instanceof IOptional) {
50            throw new IllegalArgumentException
51                ("the marked task of an iteration must not be an optional");
52        }
53       
54        super.setMarkedTask(markedTask);
55    }
56
57    /*
58     * (non-Javadoc)
59     *
60     * @see java.lang.Object#clone()
61     */
62    @Override
63    public Iteration clone() {
64        return (Iteration) super.clone();
65    }
66   
67    /* (non-Javadoc)
68     * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode#accept(de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor)
69     */
70    @Override
71    public void accept(ITaskVisitor visitor) {
72        visitor.visit(this);
73    }
74
75}
Note: See TracBrowser for help on using the repository browser.