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.ITask;
|
---|
18 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * <p> |
---|
22 | * this is the default implementation of the interface {@link ITaskInfo}. It |
---|
23 | * does not do anything fancy except implementing the interface. |
---|
24 | * </p> |
---|
25 | * |
---|
26 | * @author Patrick Harms |
---|
27 | */
|
---|
28 | public class TaskInfo implements ITaskInfo {
|
---|
29 |
|
---|
30 | /** |
---|
31 | * <p> |
---|
32 | * default serial version UID |
---|
33 | * </p> |
---|
34 | */ |
---|
35 | private static final long serialVersionUID = 1L; |
---|
36 | |
---|
37 | /** |
---|
38 | * <p> |
---|
39 | * the task to which the infos belong |
---|
40 | * </p> |
---|
41 | */
|
---|
42 | private ITask task;
|
---|
43 |
|
---|
44 | /** |
---|
45 | * <p> |
---|
46 | * the number of occurrences of this task |
---|
47 | * </p> |
---|
48 | */ |
---|
49 | private int count; |
---|
50 | |
---|
51 | /** |
---|
52 | * <p> |
---|
53 | * initialized the task infos with the task to which they belong. |
---|
54 | * </p> |
---|
55 | *
|
---|
56 | * @param task
|
---|
57 | */
|
---|
58 | TaskInfo(ITask task) {
|
---|
59 | this.task = task;
|
---|
60 | }
|
---|
61 |
|
---|
62 | /* (non-Javadoc)
|
---|
63 | * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo#getTask()
|
---|
64 | */
|
---|
65 | @Override
|
---|
66 | public ITask getTask() {
|
---|
67 | return task;
|
---|
68 | }
|
---|
69 |
|
---|
70 | /* (non-Javadoc) |
---|
71 | * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo#getCount() |
---|
72 | */ |
---|
73 | @Override |
---|
74 | public int getCount() { |
---|
75 | return count; |
---|
76 | } |
---|
77 | |
---|
78 | /* (non-Javadoc)
|
---|
79 | * @see java.lang.Object#toString()
|
---|
80 | */
|
---|
81 | @Override
|
---|
82 | public synchronized String toString() {
|
---|
83 | return "TaskInfo(" + task + ")";
|
---|
84 | }
|
---|
85 | |
---|
86 | /** |
---|
87 | * <p> |
---|
88 | * used to increase the counter of occurrences of this task by one |
---|
89 | * </p> |
---|
90 | */ |
---|
91 | void increaseCount() { |
---|
92 | count++; |
---|
93 | }
|
---|
94 | }
|
---|