private void computePositionOfEvents(List<EventRect> eventRects){
  List<List<EventRect>> collisionGroups=new ArrayList<List<EventRect>>();
  for (  EventRect eventRect : eventRects) {
    boolean isPlaced=false;
    outerLoop:     for (    List<EventRect> collisionGroup : collisionGroups) {
      for (      EventRect groupEvent : collisionGroup) {
        if (isEventsCollide(groupEvent.event,eventRect.event)) {
          collisionGroup.add(eventRect);
          isPlaced=true;
          break outerLoop;
        }
      }
    }
    if (!isPlaced) {
      List<EventRect> newGroup=new ArrayList<EventRect>();
      newGroup.add(eventRect);
      collisionGroups.add(newGroup);
    }
  }
  for (  List<EventRect> collisionGroup : collisionGroups) {
    expandEventsToMaxWidth(collisionGroup);
  }
}

private void computePositionOfEvents ( List < EventRect > eventRects ) { List < List < EventRect > > collisionGroups = new ArrayList < List < EventRect > > ( ) ; for ( EventRect eventRect : eventRects ) { boolean isPlaced = false ; outerLoop : for ( List < EventRect > collisionGroup : collisionGroups ) { for ( EventRect groupEvent : collisionGroup ) { if ( isEventsCollide ( groupEvent . event , eventRect . event ) ) { collisionGroup . add ( eventRect ) ; isPlaced = true ; break outerLoop ; } } } if ( ! isPlaced ) { List < EventRect > newGroup = new ArrayList < EventRect > ( ) ; newGroup . add ( eventRect ) ; collisionGroups . add ( newGroup ) ; } } for ( List < EventRect > collisionGroup : collisionGroups ) { expandEventsToMaxWidth ( collisionGroup ) ; } }
calculates the left and right positions of each events . this comes handy specially if events are overlapping .
