1 |
|
---|
2 | package de.ugoe.cs.quest.plugin.mfc.eventcore;
|
---|
3 |
|
---|
4 | import de.ugoe.cs.quest.eventcore.Event;
|
---|
5 | import de.ugoe.cs.quest.eventcore.IEventType;
|
---|
6 | import de.ugoe.cs.quest.eventcore.guimodel.GUIModel;
|
---|
7 | import de.ugoe.cs.quest.plugin.mfc.guimodel.MFCGUIElement;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * <p>
|
---|
11 | * Contains all informations about a windows message, i.e., all parameters that are read when a
|
---|
12 | * windows message is parsed as well as its target, hwnd, etc.
|
---|
13 | * </p>
|
---|
14 | *
|
---|
15 | * @author Steffen Herbold
|
---|
16 | * @version 1.0
|
---|
17 | *
|
---|
18 | */
|
---|
19 | public class MFCEvent extends Event {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * <p>
|
---|
23 | * Id for object serialization.
|
---|
24 | * </p>
|
---|
25 | */
|
---|
26 | private static final long serialVersionUID = 1L;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * <p>
|
---|
30 | * TODO: comment
|
---|
31 | * </p>
|
---|
32 | *
|
---|
33 | * @param eventType
|
---|
34 | * @param target
|
---|
35 | * @param currentMessageParameters
|
---|
36 | */
|
---|
37 | public MFCEvent(IEventType eventType,
|
---|
38 | MFCGUIElement target,
|
---|
39 | GUIModel guiModel)
|
---|
40 | {
|
---|
41 | super(eventType);
|
---|
42 | super.setTarget(target);
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * <p>
|
---|
47 | * Two {@link WindowsMessage} are equal, if their {@link #type}, {@link #xmlWindowDescription},
|
---|
48 | * and {@link #params} are equal.
|
---|
49 | * </p>
|
---|
50 | *
|
---|
51 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
52 | */
|
---|
53 | @Override
|
---|
54 | public boolean equals(Object other) {
|
---|
55 | if (other == this) {
|
---|
56 | return true;
|
---|
57 | }
|
---|
58 | boolean isEqual = false;
|
---|
59 | if (other instanceof MFCEvent) {
|
---|
60 | isEqual =
|
---|
61 | ((MFCEvent) other).type == this.type &&
|
---|
62 | ((MFCEvent) other).target.equals(this.target);
|
---|
63 | }
|
---|
64 | return isEqual;
|
---|
65 | }
|
---|
66 |
|
---|
67 | /*
|
---|
68 | * (non-Javadoc)
|
---|
69 | *
|
---|
70 | * @see java.lang.Object#hashCode()
|
---|
71 | */
|
---|
72 | @Override
|
---|
73 | public int hashCode() {
|
---|
74 | int multiplier = 17;
|
---|
75 | int hash = 42;
|
---|
76 |
|
---|
77 | hash = multiplier * hash + type.hashCode();
|
---|
78 | hash = multiplier * hash + target.hashCode();
|
---|
79 |
|
---|
80 | return hash;
|
---|
81 | }
|
---|
82 |
|
---|
83 | }
|
---|