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