public void insert(EventPoint ep){
  Iterator<EventPoint> it=events.iterator();
  while (it.hasNext()) {
    EventPoint exist=it.next();
    if (exist.equals(ep)) {
      exist.addUpperLineSegments(ep.upperEndpointSegments());
      return;
    }
  }
  events.add(ep);
}

public void insert ( EventPoint ep ) { Iterator < EventPoint > it = events . iterator ( ) ; while ( it . hasNext ( ) ) { EventPoint exist = it . next ( ) ; if ( exist . equals ( ep ) ) { exist . addUpperLineSegments ( ep . upperEndpointSegments ( ) ) ; return ; } } events . add ( ep ) ; }
insert the event point into the queue , taking care to properly maintain the set of segments associated with this eventpoint if it is indeed has upper segments . < p > note that we must merge the upper endpoints associated with ep with the existing event point in the queue , should one exist .
