1 package org.newdawn.slick.command;
2
3
4
5
6
7
8
9 abstract class ControllerControl implements Control {
10
11 static final int BUTTON_EVENT = 0;
12
13 static final int LEFT_EVENT = 1;
14
15 static final int RIGHT_EVENT = 2;
16
17 static final int UP_EVENT = 3;
18
19 static final int DOWN_EVENT = 4;
20
21
22 private final int event;
23
24 private final int button;
25
26 private final int controllerNumber;
27
28
29
30
31
32
33
34
35 ControllerControl(int controllerNumber, int event, int button) {
36 this.event = event;
37 this.button = button;
38 this.controllerNumber = controllerNumber;
39 }
40
41
42
43
44 @Override
45 public int hashCode() {
46 final int prime = 31;
47 int result = 1;
48 result = prime * result + button;
49 result = prime * result + controllerNumber;
50 result = prime * result + event;
51 return result;
52 }
53
54
55
56
57 @Override
58 public boolean equals(Object obj) {
59 if (this == obj) {
60 return true;
61 }
62 if (obj == null) {
63 return false;
64 }
65 if (!(obj instanceof ControllerControl)) {
66 return false;
67 }
68 ControllerControl other = (ControllerControl) obj;
69 if (button != other.button) {
70 return false;
71 }
72 if (controllerNumber != other.controllerNumber) {
73 return false;
74 }
75 if (event != other.event) {
76 return false;
77 }
78 return true;
79 }
80
81
82 }