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

Last change on this file since 1126 was 1126, checked in by pharms, 11 years ago
  • extended task tree model with support for optionalities
  • improved performance of task tree handling
  • improved visualization of task trees
  • Property svn:executable set to *
File size: 2.7 KB
RevLine 
[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]15package de.ugoe.cs.autoquest.tasktrees.treeimpl;
[439]16
[922]17import de.ugoe.cs.autoquest.eventcore.IEventTarget;
18import de.ugoe.cs.autoquest.eventcore.IEventType;
19import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask;
20import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode;
[439]21
22/**
23 * TODO comment
[557]24 *
[439]25 * @version $Revision: $ $Date: $
[557]26 * @author 2011, last modified by $Author: $
[439]27 */
[557]28public class EventTask extends TaskTreeNode implements IEventTask {
29   
30    /** */
31    private IEventType eventType;
[439]32
[557]33    /** */
34    private IEventTarget eventTarget;
[439]35
[557]36    /**
37     * @param eventType
38     * @param eventTarget
39     */
40    EventTask(IEventType eventType, IEventTarget eventTarget) {
[1126]41        super(eventType.toString());
42        super.setDescription("executed on " + eventTarget);
[557]43        this.eventType = eventType;
44        this.eventTarget = eventTarget;
45    }
[439]46
[557]47    /**
48     * @return Returns the interaction.
49     */
50    public IEventType getEventType() {
51        return eventType;
52    }
[439]53
[557]54    /**
55     * @return Returns the GUIElement.
56     */
57    public IEventTarget getEventTarget() {
58        return eventTarget;
[439]59    }
[557]60
61    /*
62     * (non-Javadoc)
63     *
64     * @see de.harms.ctte.Task#equals(de.harms.ctte.Task)
65     */
66    @Override
67    public boolean equals(ITaskTreeNode task) {
68        if (!(task instanceof IEventTask)) {
69            return false;
70        }
71
72        IEventType otherType = ((IEventTask) task).getEventType();
73        IEventTarget otherTarget = ((IEventTask) task).getEventTarget();
74
75        if (((eventType == otherType) ||
76             ((eventType != null) && (eventType.equals(otherType)))) &&
77            ((eventTarget == otherTarget) ||
78             ((eventTarget != null) && (eventTarget.equals(otherTarget)))))
79        {
80            return true;
81        }
82
83        return false;
[439]84    }
85
[557]86    /*
87     * (non-Javadoc)
88     *
89     * @see de.harms.tasktrees.TreeNode#clone()
90     */
91    @Override
92    public EventTask clone() {
93        // Event type and target are unchangeable and do not need to be cloned
94        return (EventTask) super.clone();
95    }
[439]96
97}
Note: See TracBrowser for help on using the repository browser.