[1113] | 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 | |
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.treeimpl;
|
---|
[439] | 16 |
|
---|
| 17 | import java.util.ArrayList;
|
---|
| 18 | import java.util.List;
|
---|
| 19 |
|
---|
[922] | 20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode;
|
---|
| 21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeInfo;
|
---|
[439] | 22 |
|
---|
| 23 | /**
|
---|
| 24 | * TODO comment
|
---|
[557] | 25 | *
|
---|
[439] | 26 | * @version $Revision: $ $Date: $
|
---|
[557] | 27 | * @author 2011, last modified by $Author: $
|
---|
[439] | 28 | */
|
---|
[557] | 29 | public class NodeInfo implements ITaskTreeNodeInfo {
|
---|
| 30 |
|
---|
| 31 | /** */
|
---|
| 32 | private ITaskTreeNode task;
|
---|
[439] | 33 |
|
---|
[557] | 34 | /** */
|
---|
| 35 | private long lastUpdate;
|
---|
[439] | 36 |
|
---|
[557] | 37 | /** */
|
---|
| 38 | private List<ITaskTreeNode> parentNodes = new ArrayList<ITaskTreeNode>();
|
---|
[439] | 39 |
|
---|
[557] | 40 | /**
|
---|
| 41 | * @param node
|
---|
| 42 | */
|
---|
| 43 | NodeInfo(ITaskTreeNode task) {
|
---|
| 44 | this.task = task;
|
---|
| 45 | lastUpdate = System.currentTimeMillis();
|
---|
| 46 | }
|
---|
[439] | 47 |
|
---|
[557] | 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 | }
|
---|
[439] | 57 |
|
---|
[557] | 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 | }
|
---|
[439] | 67 |
|
---|
[557] | 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 | }
|
---|
[439] | 77 |
|
---|
[557] | 78 | /**
|
---|
| 79 | * TODO: comment
|
---|
| 80 | *
|
---|
| 81 | */
|
---|
| 82 | void addParent(ITaskTreeNode parent) {
|
---|
| 83 | parentNodes.add(parent);
|
---|
| 84 | }
|
---|
[439] | 85 |
|
---|
[557] | 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 |
|
---|
[439] | 104 | }
|
---|