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

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

Used Eclipse code cleanup

File size: 2.6 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.IMarkingTemporalRelationship;
18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
19
20/**
21 * <p>
22 * this is the default implementation of the interface
23 * {@link IMarkingTemporalRelationship}. It does not do anything fancy except
24 * implementing the interface.
25 * </p>
26 *
27 * @author Patrick Harms
28 */
29abstract class MarkingTemporalRelationship extends Task implements
30                IMarkingTemporalRelationship {
31
32        /**
33         * <p>
34         * default serial version UID
35         * </p>
36         */
37        private static final long serialVersionUID = 1L;
38
39        /**
40         * <p>
41         * the task marked through this marking temporal relationship
42         * </p>
43         */
44        private ITask markedTask;
45
46        /**
47         * <p>
48         * initializes this temporal relationship with a human readable name
49         * </p>
50         *
51         * @param relationshipType
52         *            the human readable name of this temporal relationship
53         */
54        MarkingTemporalRelationship(String relationshipType) {
55                super(relationshipType);
56
57                if ((relationshipType == null) || ("".equals(relationshipType))) {
58                        throw new IllegalArgumentException(
59                                        "the relationship type must be something meaningful");
60                }
61        }
62
63        /*
64         * (non-Javadoc)
65         *
66         * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.Task#clone()
67         */
68        @Override
69        public synchronized MarkingTemporalRelationship clone() {
70                MarkingTemporalRelationship clone = null;
71                clone = (MarkingTemporalRelationship) super.clone();
72
73                if (markedTask != null) {
74                        clone.markedTask = markedTask.clone();
75                }
76
77                return clone;
78        }
79
80        /*
81         * (non-Javadoc)
82         *
83         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship#
84         * getMarkedTask()
85         */
86        @Override
87        public ITask getMarkedTask() {
88                return markedTask;
89        }
90
91        /**
92         * <p>
93         * used to set the marked task
94         * </p>
95         *
96         * @param markedTask
97         *            the marked task to set
98         */
99        protected void setMarkedTask(ITask markedTask) {
100                this.markedTask = markedTask;
101
102                super.setDescription(markedTask.toString());
103        }
104
105}
Note: See TracBrowser for help on using the repository browser.