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 | |
---|
15 | package de.ugoe.cs.autoquest.plugin.guitar.eventcore; |
---|
16 | |
---|
17 | import de.ugoe.cs.autoquest.eventcore.IEventType; |
---|
18 | |
---|
19 | /** |
---|
20 | * <p> |
---|
21 | * Event type of GUITAR events. The types are defined by eventIds. |
---|
22 | * </p> |
---|
23 | * |
---|
24 | * @version 1.0 |
---|
25 | * @author Steffen Herbold |
---|
26 | */ |
---|
27 | public class GUITAREventType implements IEventType { |
---|
28 | |
---|
29 | /** |
---|
30 | * <p> |
---|
31 | * Id for object serialization. |
---|
32 | * </p> |
---|
33 | */ |
---|
34 | private static final long serialVersionUID = 1L; |
---|
35 | |
---|
36 | /** |
---|
37 | * <p> |
---|
38 | * GUITAR eventId of the event type. |
---|
39 | * </p> |
---|
40 | */ |
---|
41 | String guitarEventId; |
---|
42 | |
---|
43 | /** |
---|
44 | * <p> |
---|
45 | * Constructor. Creates a new {@link GUITAREventType}. |
---|
46 | * </p> |
---|
47 | * |
---|
48 | * @param eventId |
---|
49 | * eventId of the event type |
---|
50 | */ |
---|
51 | public GUITAREventType(String eventId) { |
---|
52 | this.guitarEventId = eventId; |
---|
53 | } |
---|
54 | |
---|
55 | /* |
---|
56 | * (non-Javadoc) |
---|
57 | * |
---|
58 | * @see de.ugoe.cs.autoquest.eventcore.IEventType#getName() |
---|
59 | */ |
---|
60 | @Override |
---|
61 | public String getName() { |
---|
62 | return "GUITAREventType"; |
---|
63 | } |
---|
64 | |
---|
65 | /* |
---|
66 | * (non-Javadoc) |
---|
67 | * |
---|
68 | * @see java.lang.Object#toString() |
---|
69 | */ |
---|
70 | @Override |
---|
71 | public String toString() { |
---|
72 | return guitarEventId; |
---|
73 | } |
---|
74 | |
---|
75 | /* |
---|
76 | * (non-Javadoc) |
---|
77 | * |
---|
78 | * @see java.lang.Object#equals(java.lang.Object) |
---|
79 | */ |
---|
80 | @Override |
---|
81 | public boolean equals(Object obj) { |
---|
82 | if (obj instanceof GUITAREventType) { |
---|
83 | if (guitarEventId != null) { |
---|
84 | return guitarEventId.equals(((GUITAREventType) obj).guitarEventId); |
---|
85 | } |
---|
86 | else { |
---|
87 | return ((GUITAREventType) obj).guitarEventId == null; |
---|
88 | } |
---|
89 | } |
---|
90 | return false; |
---|
91 | } |
---|
92 | |
---|
93 | /* |
---|
94 | * (non-Javadoc) |
---|
95 | * |
---|
96 | * @see java.lang.Object#hashCode() |
---|
97 | */ |
---|
98 | @Override |
---|
99 | public int hashCode() { |
---|
100 | int hash = 37; |
---|
101 | if (guitarEventId != null) { |
---|
102 | hash = guitarEventId.hashCode(); |
---|
103 | } |
---|
104 | return hash; |
---|
105 | } |
---|
106 | |
---|
107 | } |
---|