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