insertBefore method

void insertBefore(
  1. EventNode? node,
  2. Coordinate? other_pt
)

Implementation

void insertBefore(EventNode node, JTS.Coordinate other_pt) {
  var last = root;
  var here = root.next;

  while (here != null) {
    if (insertBeforePredicate(here, node, other_pt)) {
      node.prev = here.prev;
      node.next = here;
      here.prev.next = node;
      here.prev = node;

      return;
    }

    last = here;
    here = here.next;
  }

  last.next = node;
  node.prev = last;
  node.next = null;
}