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.IOptional; |
---|
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 {@link IOptional}. It |
---|
24 | * does not do anything fancy except implementing the interface. |
---|
25 | * </p> |
---|
26 | * |
---|
27 | * @author Patrick Harms |
---|
28 | */ |
---|
29 | class Optional extends MarkingTemporalRelationship implements IOptional { |
---|
30 | |
---|
31 | /** <p> default serial version UID </p>. */ |
---|
32 | private static final long serialVersionUID = 1L; |
---|
33 | |
---|
34 | /** |
---|
35 | * <p> |
---|
36 | * simple constructor providing the base class with a human readable name of |
---|
37 | * the type of this task |
---|
38 | * </p>. |
---|
39 | */ |
---|
40 | Optional() { |
---|
41 | super("optionality"); |
---|
42 | } |
---|
43 | |
---|
44 | /* |
---|
45 | * (non-Javadoc) |
---|
46 | * |
---|
47 | * @see |
---|
48 | * de.ugoe.cs.autoquest.tasktrees.treeimpl.MarkingTemporalRelationship#clone |
---|
49 | * () |
---|
50 | */ |
---|
51 | @Override |
---|
52 | public Optional clone() { |
---|
53 | return (Optional) super.clone(); |
---|
54 | } |
---|
55 | |
---|
56 | /* |
---|
57 | * (non-Javadoc) |
---|
58 | * |
---|
59 | * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.MarkingTemporalRelationship# |
---|
60 | * setMarkedTask(ITask) |
---|
61 | */ |
---|
62 | @Override |
---|
63 | protected void setMarkedTask(ITask markedTask) { |
---|
64 | if (markedTask instanceof IOptional) { |
---|
65 | throw new IllegalArgumentException( |
---|
66 | "the marked task of an optional must not be an optional"); |
---|
67 | } |
---|
68 | |
---|
69 | super.setMarkedTask(markedTask); |
---|
70 | } |
---|
71 | |
---|
72 | } |
---|