@Test public void testGetMainEvent() { this.event1.setImportance(Importance.BACKGROUND); this.event2.setImportance(Importance.MAJOR); this.event3.setImportance(Importance.MAJOR); assertNull(this.g.getMainEvent()); this.g.addEvents(this.event1); assertEquals(this.event1, this.g.getMainEvent()); this.g.addEvents(this.event2); assertEquals(this.event2, this.g.getMainEvent()); this.g.addEvents(this.event3); assertEquals(this.event2, this.g.getMainEvent()); this.g.clearEvents(); assertNull(this.g.getMainEvent()); this.g.clearEvents(); this.g.addEvents(this.event3); assertEquals(this.event3, this.g.getMainEvent()); this.g.addEvents(this.event2); assertEquals(this.event3, this.g.getMainEvent()); this.g.addEvents(this.event1); assertEquals(this.event3, this.g.getMainEvent()); this.g.clearEvents(); this.g.addEvents(this.event2); assertEquals(this.event2, this.g.getMainEvent()); this.g.addEvents(this.event3); assertEquals(this.event2, this.g.getMainEvent()); this.g.addEvents(this.event1); assertEquals(this.event2, this.g.getMainEvent()); this.g.clearEvents(); this.g.addEvents(this.event3); assertEquals(this.event3, this.g.getMainEvent()); this.g.addEvents(this.event3); assertEquals(this.event3, this.g.getMainEvent()); this.g.addEvents(this.event2); assertEquals(this.event3, this.g.getMainEvent()); }
public Event getMainEvent() { Event result = null; for (Event e : this.events) { if (result == null || e.getImportance().ordinal() > result.getImportance().ordinal()) { result = e; } } return result; }
EventGroup { public Event getMainEvent() { Event result = null; for (Event e : this.events) { if (result == null || e.getImportance().ordinal() > result.getImportance().ordinal()) { result = e; } } return result; } }
EventGroup { public Event getMainEvent() { Event result = null; for (Event e : this.events) { if (result == null || e.getImportance().ordinal() > result.getImportance().ordinal()) { result = e; } } return result; } EventGroup();  EventGroup(List<Event> events);  EventGroup(Set<Event> events);  EventGroup(Event... events); }
EventGroup { public Event getMainEvent() { Event result = null; for (Event e : this.events) { if (result == null || e.getImportance().ordinal() > result.getImportance().ordinal()) { result = e; } } return result; } EventGroup();  EventGroup(List<Event> events);  EventGroup(Set<Event> events);  EventGroup(Event... events); Set<Event> getEvents(); void addEvents(Event... events); void clearEvents(); Event getMainEvent(); @Override String toString(); }
EventGroup { public Event getMainEvent() { Event result = null; for (Event e : this.events) { if (result == null || e.getImportance().ordinal() > result.getImportance().ordinal()) { result = e; } } return result; } EventGroup();  EventGroup(List<Event> events);  EventGroup(Set<Event> events);  EventGroup(Event... events); Set<Event> getEvents(); void addEvents(Event... events); void clearEvents(); Event getMainEvent(); @Override String toString();  }