source: branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/SelectionInstance.java @ 1734

Last change on this file since 1734 was 1734, checked in by rkrimmel, 10 years ago

Added automatically created javadoc, still needs to be commented properly though

File size: 2.5 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.ISelection;
18import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance;
19import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
20import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
21
22// TODO: Auto-generated Javadoc
23/**
24 * <p>
25 * Default implementation of {@link ISelectionInstance}.
26 * </p>
27 *
28 * @author Patrick Harms
29 */
30class SelectionInstance extends TaskInstance implements ISelectionInstance {
31
32        /** <p> default serial version UID </p>. */
33        private static final long serialVersionUID = 1L;
34
35        /** <p> the child of this task instance </p>. */
36        private ITaskInstance child;
37
38        /**
39         * <p>
40         * initializes this instance with the respective task model
41         * </p>.
42         *
43         * @param task            the task of which this is an instance
44         */
45        SelectionInstance(ITask task) {
46                super(task);
47        }
48
49        /*
50         * (non-Javadoc)
51         *
52         * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.ISequenceInstance#clone()
53         */
54        @Override
55        public synchronized ISelectionInstance clone() {
56                final SelectionInstance clone = (SelectionInstance) super.clone();
57
58                if (child != null) {
59                        clone.child = child.clone();
60                }
61
62                return clone;
63        }
64
65        /*
66         * (non-Javadoc)
67         *
68         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance#getChild()
69         */
70        @Override
71        public ITaskInstance getChild() {
72                return child;
73        }
74
75        /*
76         * (non-Javadoc)
77         *
78         * @see
79         * de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance#getSelection()
80         */
81        @Override
82        public ISelection getSelection() {
83                return (ISelection) super.getTask();
84        }
85
86        /**
87         * <p>
88         * used to set the child of this task instance
89         * </p>.
90         *
91         * @param child            the new child of this instance
92         */
93        void setChild(ITaskInstance child) {
94                if (child instanceof ISelectionInstance) {
95                        throw new IllegalArgumentException(
96                                        "the child of a selection can not be a selection");
97                }
98
99                this.child = child;
100        }
101
102}
Note: See TracBrowser for help on using the repository browser.