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

Last change on this file since 1157 was 1157, checked in by adeicke, 11 years ago

Added Visitor pattern for tasks.

  • Property svn:executable set to *
File size: 2.3 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 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.ITaskVisitor;
21
22/**
23 * TODO comment
24 *
25 * @version $Revision: $ $Date: $
26 * @author 2011, last modified by $Author: $
27 */
28class EventTask extends Task implements IEventTask {
29   
30    /**  */
31    private static final long serialVersionUID = 1L;
32
33    /** */
34    private IEventType eventType;
35
36    /** */
37    private IEventTarget eventTarget;
38
39    /**
40     * @param eventType
41     * @param eventTarget
42     */
43    EventTask(IEventType eventType, IEventTarget eventTarget) {
44        super.setDescription(eventType.toString() + " executed on " + eventTarget);
45        this.eventType = eventType;
46        this.eventTarget = eventTarget;
47    }
48
49    /**
50     * @return Returns the interaction.
51     */
52    public IEventType getEventType() {
53        return eventType;
54    }
55
56    /**
57     * @return Returns the GUIElement.
58     */
59    public IEventTarget getEventTarget() {
60        return eventTarget;
61    }
62
63    /*
64     * (non-Javadoc)
65     *
66     * @see de.harms.tasktrees.TreeNode#clone()
67     */
68    @Override
69    public EventTask clone() {
70        // Event type and target are unchangeable and do not need to be cloned
71        return (EventTask) super.clone();
72    }
73
74    /* (non-Javadoc)
75     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask#accept(de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor)
76     */
77    @Override
78    public void accept(ITaskVisitor visitor) {
79        visitor.visit(this);
80    }
81
82}
Note: See TracBrowser for help on using the repository browser.