compareTo method

int compareTo(
  1. dynamic o
)
override

Events are ordered first by their x-value, and then by their eventType. Insert events are sorted before Delete events, so that items whose Insert and Delete events occur at the same x-value will be correctly handled.

Implementation

int compareTo(dynamic o) {
  SweepLineEvent pe = o;
  if (xValue < pe.xValue) return -1;
  if (xValue > pe.xValue) return 1;
  if (eventType < pe.eventType) return -1;
  if (eventType > pe.eventType) return 1;
  return 0;
}