source: trunk/autoquest-plugin-guitar/src/main/java/de/ugoe/cs/autoquest/plugin/guitar/eventcore/GUITAREventTarget.java @ 927

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
  • Property svn:mime-type set to text/plain
File size: 2.7 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.plugin.guitar.eventcore;
16
17import de.ugoe.cs.autoquest.eventcore.IEventTarget;
18
19/**
20 * <p>
21 * Event target for GUITAR events. The targets are described by a widgetId.
22 * </p>
23 *
24 * @version 1.0
25 * @author Steffen Herbold
26 */
27public class GUITAREventTarget implements IEventTarget {
28
29    /**
30     * <p>
31     * Id for object serialization.
32     * </p>
33     */
34    private static final long serialVersionUID = 1L;
35
36    /**
37     * <p>
38     * Id of the widget, which can be looked up in a GUITAR .gui file.
39     * </p>
40     */
41    private String widgetId;
42
43    /**
44     * <p>
45     * Constructor. Creates a new {@link GUITAREventTarget}.
46     * </p>
47     *
48     * @param widgetId
49     *            widget id of the target
50     */
51    public GUITAREventTarget(String widgetId) {
52        this.widgetId = widgetId;
53    }
54
55    /*
56     * (non-Javadoc)
57     *
58     * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getPlatform()
59     */
60    @Override
61    public String getPlatform() {
62        return "GUITAR";
63    }
64
65    /*
66     * (non-Javadoc)
67     *
68     * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getStringIdentifier()
69     */
70    @Override
71    public String getStringIdentifier() {
72        return this.toString();
73    }
74
75    /*
76     * (non-Javadoc)
77     *
78     * @see java.lang.Object#toString()
79     */
80    @Override
81    public String toString() {
82        return widgetId;
83    }
84
85    /*
86     * (non-Javadoc)
87     *
88     * @see java.lang.Object#equals(java.lang.Object)
89     */
90    @Override
91    public boolean equals(Object obj) {
92        if (obj instanceof GUITAREventTarget) {
93            if (widgetId != null) {
94                return widgetId.equals(((GUITAREventTarget) obj).widgetId);
95            }
96            else {
97                return ((GUITAREventTarget) obj).widgetId == null;
98            }
99        }
100        return false;
101    }
102
103    /*
104     * (non-Javadoc)
105     *
106     * @see java.lang.Object#hashCode()
107     */
108    @Override
109    public int hashCode() {
110        int hash = 13;
111        if (widgetId != null) {
112            hash = widgetId.hashCode();
113        }
114        return hash;
115    }
116
117}
Note: See TracBrowser for help on using the repository browser.