1 | //-------------------------------------------------------------------------------------------------
|
---|
2 | // Module : $RCSfile: InteractionTask.java,v $
|
---|
3 | // Version : $Revision: 0.0 $ $Author: Patrick $ $Date: 06.11.2011 10:57:52 $
|
---|
4 | // Project : TaskTreePerformanceTest
|
---|
5 | // Creation : 2011 by Patrick
|
---|
6 | // Copyright : Patrick Harms, 2011
|
---|
7 | //-------------------------------------------------------------------------------------------------
|
---|
8 |
|
---|
9 | package de.ugoe.cs.quest.tasktrees.treeimpl;
|
---|
10 |
|
---|
11 | import de.ugoe.cs.quest.eventcore.guimodel.GUIElement;
|
---|
12 | import de.ugoe.cs.quest.eventcore.userinteraction.Interaction;
|
---|
13 | import de.ugoe.cs.quest.tasktrees.treeifc.InteractionTask;
|
---|
14 | import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNode;
|
---|
15 |
|
---|
16 | //-------------------------------------------------------------------------------------------------
|
---|
17 | /**
|
---|
18 | * TODO comment
|
---|
19 | *
|
---|
20 | * @version $Revision: $ $Date: $
|
---|
21 | * @author 2011, last modified by $Author: $
|
---|
22 | */
|
---|
23 | //-------------------------------------------------------------------------------------------------
|
---|
24 | public class InteractionTaskImpl extends TaskTreeNodeImpl implements InteractionTask
|
---|
25 | {
|
---|
26 | /** */
|
---|
27 | private GUIElement mGUIElement;
|
---|
28 |
|
---|
29 | /** */
|
---|
30 | private Interaction mInteraction;
|
---|
31 |
|
---|
32 | //-----------------------------------------------------------------------------------------------
|
---|
33 | /**
|
---|
34 | * @param guiElement
|
---|
35 | * @param interaction
|
---|
36 | */
|
---|
37 | //-----------------------------------------------------------------------------------------------
|
---|
38 | InteractionTaskImpl(GUIElement guiElement, Interaction interaction)
|
---|
39 | {
|
---|
40 | super(interaction.getName() + "(" + guiElement + ")");
|
---|
41 | super.setDescription(interaction + " on " + guiElement);
|
---|
42 | mGUIElement = guiElement;
|
---|
43 | mInteraction = interaction;
|
---|
44 | }
|
---|
45 |
|
---|
46 | //-----------------------------------------------------------------------------------------------
|
---|
47 | /**
|
---|
48 | * @return Returns the interaction.
|
---|
49 | */
|
---|
50 | //-----------------------------------------------------------------------------------------------
|
---|
51 | public Interaction getInteraction()
|
---|
52 | {
|
---|
53 | return mInteraction;
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 | //-----------------------------------------------------------------------------------------------
|
---|
58 | /**
|
---|
59 | * @return Returns the GUIElement.
|
---|
60 | */
|
---|
61 | //-----------------------------------------------------------------------------------------------
|
---|
62 | public GUIElement getGUIElement()
|
---|
63 | {
|
---|
64 | return mGUIElement;
|
---|
65 | }
|
---|
66 |
|
---|
67 | //-----------------------------------------------------------------------------------------------
|
---|
68 | /* (non-Javadoc)
|
---|
69 | * @see de.harms.ctte.Task#equals(de.harms.ctte.Task)
|
---|
70 | */
|
---|
71 | //-----------------------------------------------------------------------------------------------
|
---|
72 | @Override
|
---|
73 | public boolean equals(TaskTreeNode task)
|
---|
74 | {
|
---|
75 | if (!(task instanceof InteractionTask))
|
---|
76 | {
|
---|
77 | return false;
|
---|
78 | }
|
---|
79 |
|
---|
80 | GUIElement otherInteractionElem = ((InteractionTask) task).getGUIElement();
|
---|
81 | Interaction otherInteraction = ((InteractionTask) task).getInteraction();
|
---|
82 |
|
---|
83 | if ((((mGUIElement == null) && (otherInteractionElem == null)) ||
|
---|
84 | ((mGUIElement != null) && (mGUIElement.equals(otherInteractionElem)))) &&
|
---|
85 | (((mInteraction == null) && (otherInteraction == null)) ||
|
---|
86 | ((mInteraction != null) && (mInteraction.equals(otherInteraction)))))
|
---|
87 | {
|
---|
88 | return true;
|
---|
89 | }
|
---|
90 |
|
---|
91 | return false;
|
---|
92 | }
|
---|
93 |
|
---|
94 | //-----------------------------------------------------------------------------------------------
|
---|
95 | /* (non-Javadoc)
|
---|
96 | * @see de.harms.tasktrees.TreeNode#clone()
|
---|
97 | */
|
---|
98 | //-----------------------------------------------------------------------------------------------
|
---|
99 | @Override
|
---|
100 | public TaskTreeNode clone()
|
---|
101 | {
|
---|
102 | return new InteractionTaskImpl(mGUIElement, mInteraction);
|
---|
103 | }
|
---|
104 |
|
---|
105 | }
|
---|