source: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/NodeInfo.java @ 1113

Last change on this file since 1113 was 1113, checked in by pharms, 11 years ago
  • added license statement
  • Property svn:executable set to *
File size: 2.5 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 java.util.ArrayList;
18import java.util.List;
19
20import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode;
21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeInfo;
22
23/**
24 * TODO comment
25 *
26 * @version $Revision: $ $Date: $
27 * @author 2011, last modified by $Author: $
28 */
29public class NodeInfo implements ITaskTreeNodeInfo {
30   
31    /** */
32    private ITaskTreeNode task;
33
34    /** */
35    private long lastUpdate;
36
37    /** */
38    private List<ITaskTreeNode> parentNodes = new ArrayList<ITaskTreeNode>();
39
40    /**
41     * @param node
42     */
43    NodeInfo(ITaskTreeNode task) {
44        this.task = task;
45        lastUpdate = System.currentTimeMillis();
46    }
47
48    /*
49     * (non-Javadoc)
50     *
51     * @see de.ugoe.cs.tasktree.treeifc.NodeInfo#getTask()
52     */
53    @Override
54    public ITaskTreeNode getTask() {
55        return task;
56    }
57
58    /*
59     * (non-Javadoc)
60     *
61     * @see de.ugoe.cs.tasktree.treeimpl.NodeInfo#getNoOfOccurencesInTree()
62     */
63    @Override
64    public int getNoOfOccurencesInTree() {
65        return parentNodes.size();
66    }
67
68    /*
69     * (non-Javadoc)
70     *
71     * @see de.ugoe.cs.tasktree.treeimpl.NodeInfo#getLastUpdate()
72     */
73    @Override
74    public long getLastUpdate() {
75        return lastUpdate;
76    }
77
78    /**
79     * TODO: comment
80     *
81     */
82    void addParent(ITaskTreeNode parent) {
83        parentNodes.add(parent);
84    }
85
86    /**
87     * TODO: comment
88     *
89     */
90    void removeParent(ITaskTreeNode parent) {
91        parentNodes.remove(parent);
92    }
93
94    /*
95     * (non-Javadoc)
96     *
97     * @see java.lang.Object#toString()
98     */
99    @Override
100    public synchronized String toString() {
101        return "NodeInfo(" + task + ", " + parentNodes.size() + " parents)";
102    }
103
104}
Note: See TracBrowser for help on using the repository browser.