1 | package de.ugoe.cs.autoquest.eventcore.gui;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * <p>
|
---|
7 | * Event type for releasing a key.
|
---|
8 | * </p>
|
---|
9 | *
|
---|
10 | * @version 1.0
|
---|
11 | * @author Steffen Herbold
|
---|
12 | */
|
---|
13 | public class KeyReleased extends KeyInteraction {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * <p>
|
---|
17 | * Id for object serialization.
|
---|
18 | * </p>
|
---|
19 | */
|
---|
20 | private static final long serialVersionUID = 1L;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * <p>
|
---|
24 | * Constructor. Creates a new {@link KeyReleased} event type.
|
---|
25 | * </p>
|
---|
26 | *
|
---|
27 | * @see KeyInteraction#KeyInteraction(VirtualKey)
|
---|
28 | */
|
---|
29 | public KeyReleased(VirtualKey key) {
|
---|
30 | super(key);
|
---|
31 | }
|
---|
32 |
|
---|
33 | /*
|
---|
34 | * (non-Javadoc)
|
---|
35 | *
|
---|
36 | * @see de.harms.attef.userinteraction.Interaction#getName()
|
---|
37 | */
|
---|
38 | public String getName() {
|
---|
39 | return "KeyReleased " + super.getKey();
|
---|
40 | }
|
---|
41 |
|
---|
42 | /*
|
---|
43 | * (non-Javadoc)
|
---|
44 | *
|
---|
45 | * @see java.lang.Object#toString()
|
---|
46 | */
|
---|
47 | @Override
|
---|
48 | public String toString() {
|
---|
49 | return "releasing key " + super.getKey();
|
---|
50 | }
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * (non-Javadoc)
|
---|
54 | *
|
---|
55 | * @see de.harms.attef.userinteraction.Interaction#startsLogicalSequence()
|
---|
56 | */
|
---|
57 | public boolean startsLogicalSequence() {
|
---|
58 | return false;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * (non-Javadoc)
|
---|
63 | *
|
---|
64 | * @see de.harms.attef.userinteraction.Interaction#finishesLogicalSequence()
|
---|
65 | */
|
---|
66 | public boolean finishesLogicalSequence() {
|
---|
67 | // TODO handle lock keys correctly
|
---|
68 | return super.getKey().isCombinationKey();
|
---|
69 | }
|
---|
70 |
|
---|
71 | /*
|
---|
72 | * (non-Javadoc)
|
---|
73 | *
|
---|
74 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
75 | */
|
---|
76 | @Override
|
---|
77 | public boolean equals(Object other) {
|
---|
78 | if (other instanceof KeyReleased) {
|
---|
79 | return (super.getKey() == ((KeyReleased) other).getKey());
|
---|
80 | }
|
---|
81 | else {
|
---|
82 | return false;
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | /* (non-Javadoc)
|
---|
87 | * @see java.lang.Object#hashCode()
|
---|
88 | */
|
---|
89 | @Override
|
---|
90 | public int hashCode() {
|
---|
91 | return super.getKey().hashCode();
|
---|
92 | }
|
---|
93 |
|
---|
94 | }
|
---|