Skip to content

Commit

Permalink
Complete 'EventsQueueKey.__lt__' magic method
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed May 19, 2020
1 parent d2504d9 commit bb8ade1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions bentley_ottmann/core/events_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ def __lt__(self, other: 'EventsQueueKey') -> bool:
# and the other is a right endpoint,
# the right endpoint is processed first
return not event.is_left_endpoint
elif event.end != other_event.end:
# same start, different end,
# both events are left endpoints
# or both are right endpoints
return event.end < other_event.end
else:
# same segments
return (event.segments_ids < other_event.segments_ids
if event.is_intersection is other_event.is_intersection
else event.is_intersection)
# same start,
# both events are left endpoints or both are right endpoints
return ((event.segments_ids < other_event.segments_ids
if event.is_intersection is other_event.is_intersection
else event.is_intersection)
if event.end == other_event.end
else event.end < other_event.end)


EventsQueue = cast(Callable[..., PriorityQueue[Event]],
Expand Down

0 comments on commit bb8ade1

Please sign in to comment.