public class Event implements Comparable
1: /**
2: * Represents an event in the bank simulation.
3: */
4: public class Event implements Comparable<Event> {
6: public final int TIME;
7: public final String NAME;
9: /**
10: * Create an event with the given time and type.
11: *
12: * @param t the event's time.
13: * @param n the event's type.
14: */
15: public Event(int t, String n) {
16: TIME = t;
17: NAME = n;
18: }
20: /**
21: * Check what order these two events come in.
22: *
23: * @param other the other event.
24: * @return less than zero if this event is earlier; zero if the two events
25: * have the same time; and greater than zero if the other event is earlier.
26: */
27: @Override
28: public int compareTo(Event other) {
29: return Integer.compare(this.TIME, other.TIME);
30: }
32: }