[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> |
---|
| 22 | * TODO comment |
---|
| 23 | * </p> |
---|
| 24 | * |
---|
| 25 | * @author Patrick Harms |
---|
| 26 | */ |
---|
| 27 | abstract class MarkingTemporalRelationship extends Task |
---|
| 28 | implements IMarkingTemporalRelationship |
---|
| 29 | { |
---|
| 30 | |
---|
| 31 | /** */ |
---|
| 32 | private static final long serialVersionUID = 1L; |
---|
| 33 | |
---|
| 34 | /** |
---|
| 35 | * |
---|
| 36 | */ |
---|
| 37 | private ITask markedTask; |
---|
| 38 | |
---|
| 39 | /** |
---|
| 40 | * |
---|
| 41 | */ |
---|
| 42 | private String relationshipType; |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * <p> |
---|
| 46 | * TODO: comment |
---|
| 47 | * </p> |
---|
| 48 | * |
---|
| 49 | * @param description |
---|
| 50 | */ |
---|
| 51 | MarkingTemporalRelationship(String relationshipType) { |
---|
| 52 | if ((relationshipType == null) || ("".equals(relationshipType))) { |
---|
| 53 | throw new IllegalArgumentException |
---|
| 54 | ("the relationship type must be something meaningful"); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | this.relationshipType = relationshipType; |
---|
| 58 | super.setDescription(this.relationshipType); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | /* (non-Javadoc) |
---|
| 62 | * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship#getMarkedTask() |
---|
| 63 | */ |
---|
| 64 | @Override |
---|
| 65 | public ITask getMarkedTask() { |
---|
| 66 | return markedTask; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | /* (non-Javadoc) |
---|
| 70 | * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.Task#clone() |
---|
| 71 | */ |
---|
| 72 | @Override |
---|
| 73 | public synchronized MarkingTemporalRelationship clone() { |
---|
| 74 | MarkingTemporalRelationship clone = null; |
---|
| 75 | clone = (MarkingTemporalRelationship) super.clone(); |
---|
| 76 | |
---|
| 77 | if (markedTask != null) { |
---|
| 78 | clone.markedTask = markedTask.clone(); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | return clone; |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | /** |
---|
| 85 | * @param markedTask the markedTask to set |
---|
| 86 | */ |
---|
| 87 | protected void setMarkedTask(ITask markedTask) { |
---|
| 88 | this.markedTask = markedTask; |
---|
| 89 | |
---|
| 90 | super.setDescription(relationshipType + " of " + markedTask); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | } |
---|