1 | //------------------------------------------------------------------------------------------------- |
---|
2 | // Module : $RCSfile: Iteration.java,v $ |
---|
3 | // Version : $Revision: 0.0 $ $Author: patrick $ $Date: 19.02.2012 $ |
---|
4 | // Project : TaskTreeCreator |
---|
5 | // Creation : 2012 by patrick |
---|
6 | // Copyright : Patrick Harms, 2012 |
---|
7 | //------------------------------------------------------------------------------------------------- |
---|
8 | package de.ugoe.cs.quest.tasktrees.treeimpl; |
---|
9 | |
---|
10 | import de.ugoe.cs.quest.tasktrees.treeifc.Iteration; |
---|
11 | import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNode; |
---|
12 | |
---|
13 | //------------------------------------------------------------------------------------------------- |
---|
14 | /** |
---|
15 | * TODO comment |
---|
16 | * |
---|
17 | * @version $Revision: $ $Date: 19.02.2012$ |
---|
18 | * @author 2012, last modified by $Author: patrick$ |
---|
19 | */ |
---|
20 | //------------------------------------------------------------------------------------------------- |
---|
21 | public class IterationImpl extends TaskTreeNodeImpl implements Iteration |
---|
22 | { |
---|
23 | |
---|
24 | //----------------------------------------------------------------------------------------------- |
---|
25 | /** |
---|
26 | * |
---|
27 | */ |
---|
28 | //----------------------------------------------------------------------------------------------- |
---|
29 | IterationImpl() |
---|
30 | { |
---|
31 | super("Iteration"); |
---|
32 | } |
---|
33 | |
---|
34 | //----------------------------------------------------------------------------------------------- |
---|
35 | /* (non-Javadoc) |
---|
36 | * @see de.ugoe.cs.tasktree.treeifc.TaskTreeNode#addChild(TaskTreeNode) |
---|
37 | */ |
---|
38 | //----------------------------------------------------------------------------------------------- |
---|
39 | @Override |
---|
40 | public void addChild(TaskTreeNode child) |
---|
41 | { |
---|
42 | // adding more children is not allowed |
---|
43 | throw new UnsupportedOperationException(); |
---|
44 | } |
---|
45 | |
---|
46 | //----------------------------------------------------------------------------------------------- |
---|
47 | /** |
---|
48 | * TODO: comment |
---|
49 | * |
---|
50 | * @param selection |
---|
51 | * @return |
---|
52 | */ |
---|
53 | //----------------------------------------------------------------------------------------------- |
---|
54 | public void setChild(TaskTreeNode child) |
---|
55 | { |
---|
56 | if (super.getChildren().size() > 0) |
---|
57 | { |
---|
58 | super.removeChild(0); |
---|
59 | } |
---|
60 | super.addChild(child); |
---|
61 | } |
---|
62 | |
---|
63 | //----------------------------------------------------------------------------------------------- |
---|
64 | /* (non-Javadoc) |
---|
65 | * @see java.lang.Object#clone() |
---|
66 | */ |
---|
67 | //----------------------------------------------------------------------------------------------- |
---|
68 | @Override |
---|
69 | public TaskTreeNode clone() |
---|
70 | { |
---|
71 | IterationImpl clone = new IterationImpl(); |
---|
72 | clone.setDescription(super.getDescription()); |
---|
73 | |
---|
74 | if (super.getChildren().size() > 0) |
---|
75 | { |
---|
76 | clone.setChild(super.getChildren().get(0)); |
---|
77 | } |
---|
78 | return clone; |
---|
79 | } |
---|
80 | |
---|
81 | } |
---|