-
Notifications
You must be signed in to change notification settings - Fork 0
/
RobotEvent.java
55 lines (42 loc) · 1.24 KB
/
RobotEvent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
RobotEvent.java
*/
//package first;
public class RobotEvent {
public static final int EVENT_TYPE_UNKNOWN = 0;
public static final int EVENT_TYPE_A = 1;
public static final int EVENT_TYPE_B = 2;
public static final int EVENT_TYPE_C = 3;
public static final int EVENT_TYPE_D = 4;
public static final int EVENT_TYPE_E = 5;
private int eventType;
private Object eventSource;
public RobotEvent(Object source, int eType)
{
eventSource = source;
//System.out.println("RobotEvent: begining type "+eType);
if ((eType < EVENT_TYPE_A) && (eType > EVENT_TYPE_E))
eventType = EVENT_TYPE_UNKNOWN;
else
eventType = eType;
}
public String toString()
{
switch (eventType) {
case EVENT_TYPE_A:
return new String("Event Type A");
case EVENT_TYPE_B:
return new String("Event Type B");
case EVENT_TYPE_C:
return new String("Event Type C");
case EVENT_TYPE_D:
return new String("Event Type D");
case EVENT_TYPE_E:
return new String("Event Type E");
case EVENT_TYPE_UNKNOWN:
default:
return new String("Unknown Event");
}
}
Object getSource() { return eventSource; }
} /* RobotEvent */