[1146] | 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 | /** |
---|
| 21 | * <p> |
---|
[1733] | 22 | * this is the default implementation of the interface |
---|
| 23 | * {@link IMarkingTemporalRelationship}. It does not do anything fancy except |
---|
| 24 | * implementing the interface. |
---|
[1146] | 25 | * </p> |
---|
| 26 | * |
---|
| 27 | * @author Patrick Harms |
---|
| 28 | */ |
---|
[1733] | 29 | abstract class MarkingTemporalRelationship extends Task implements |
---|
| 30 | IMarkingTemporalRelationship { |
---|
[1146] | 31 | |
---|
[1733] | 32 | /** |
---|
| 33 | * <p> |
---|
| 34 | * default serial version UID |
---|
| 35 | * </p> |
---|
| 36 | */ |
---|
| 37 | private static final long serialVersionUID = 1L; |
---|
[1146] | 38 | |
---|
[1733] | 39 | /** |
---|
| 40 | * <p> |
---|
| 41 | * the task marked through this marking temporal relationship |
---|
| 42 | * </p> |
---|
| 43 | */ |
---|
| 44 | private ITask markedTask; |
---|
[1146] | 45 | |
---|
[1733] | 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); |
---|
[1146] | 56 | |
---|
[1733] | 57 | if ((relationshipType == null) || ("".equals(relationshipType))) { |
---|
| 58 | throw new IllegalArgumentException( |
---|
| 59 | "the relationship type must be something meaningful"); |
---|
| 60 | } |
---|
| 61 | } |
---|
[1146] | 62 | |
---|
[1733] | 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(); |
---|
[1146] | 72 | |
---|
[1733] | 73 | if (markedTask != null) { |
---|
| 74 | clone.markedTask = markedTask.clone(); |
---|
| 75 | } |
---|
[1146] | 76 | |
---|
[1733] | 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 | |
---|
[1146] | 105 | } |
---|