lib/interval_notation/operations.rb in interval_notation-0.1.3 vs lib/interval_notation/operations.rb in interval_notation-0.2.0
- old
+ new
@@ -1,18 +1,18 @@
require_relative 'interval_set'
require_relative 'basic_intervals'
-require_relative 'combiners'
+require_relative 'sweep_line'
module IntervalNotation
module Operations
# Union of multiple intervals.
def union(intervals)
- UnionCombiner.new(intervals.size).combine(intervals)
+ SweepLine.make_interval_set(intervals, SweepLine::TraceState::Union.initial_state(intervals.size))
end
# Intersection of multiple intervals
def intersection(intervals)
- IntersectCombiner.new(intervals.size).combine(intervals)
+ SweepLine.make_interval_set(intervals, SweepLine::TraceState::Intersection.initial_state(intervals.size))
end
module_function :union, :intersection
end
end