source: branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/MarkingTemporalRelationship.java @ 1618

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