Package com.google.ortools.util
Class SortedDisjointIntervalList
java.lang.Object
com.google.ortools.util.SortedDisjointIntervalList
public class SortedDisjointIntervalList
extends java.lang.Object
This class represents a sorted list of disjoint, closed intervals. When an
interval is inserted, all intervals that overlap it or are adjacent to it are
merged into one. I.e. [0,14] and [15,30] will be merged to [0,30].
Iterators returned by this class are invalidated by non-const operations.
interval is inserted, all intervals that overlap it or are adjacent to it are
merged into one. I.e. [0,14] and [15,30] will be merged to [0,30].
Iterators returned by this class are invalidated by non-const operations.
-
Field Summary
Fields Modifier and Type Field Description protected booleanswigCMemOwn -
Constructor Summary
Constructors Constructor Description SortedDisjointIntervalList()SortedDisjointIntervalList(int[] starts, int[] ends)SortedDisjointIntervalList(long[] starts, long[] ends)Creates a SortedDisjointIntervalList and fills it with intervals
[starts[i]..ends[i]].SortedDisjointIntervalList(long cPtr, boolean cMemoryOwn) -
Method Summary
Modifier and Type Method Description SortedDisjointIntervalListbuildComplementOnInterval(long start, long end)Builds the complement of the interval list on the interval [start, end].voiddelete()protected voidfinalize()protected static longgetCPtr(SortedDisjointIntervalList obj)SWIGTYPE_p_std__setT_operations_research__ClosedInterval_operations_research__SortedDisjointIntervalList__IntervalComparator_t__iteratorinsertInterval(long start, long end)Adds the interval [start..end] to the list, and merges overlapping or
immediately adjacent intervals ([2, 5] and [6, 7] are adjacent, but
[2, 5] and [7, 8] are not).
Returns an iterator to the inserted interval (possibly merged with others).
If start > end, it does LOG(DFATAL) and returns end() (no interval added).voidinsertIntervals(int[] starts, int[] ends)voidinsertIntervals(long[] starts, long[] ends)Adds all intervals [starts[i]..ends[i]].
Same behavior as InsertInterval() upon invalid intervals.intnumIntervals()Returns the number of disjoint intervals in the list.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
swigCMemOwn
protected transient boolean swigCMemOwn
-
-
Constructor Details
-
SortedDisjointIntervalList
public SortedDisjointIntervalList(long cPtr, boolean cMemoryOwn) -
SortedDisjointIntervalList
public SortedDisjointIntervalList() -
SortedDisjointIntervalList
public SortedDisjointIntervalList(long[] starts, long[] ends)Creates a SortedDisjointIntervalList and fills it with intervals
[starts[i]..ends[i]]. All intervals must be consistent (starts[i] <=
ends[i]). There are two version, one for int64_t and one for int. -
SortedDisjointIntervalList
public SortedDisjointIntervalList(int[] starts, int[] ends)
-
-
Method Details
-
getCPtr
-
finalize
protected void finalize()- Overrides:
finalizein classjava.lang.Object
-
delete
public void delete() -
buildComplementOnInterval
Builds the complement of the interval list on the interval [start, end]. -
insertInterval
public SWIGTYPE_p_std__setT_operations_research__ClosedInterval_operations_research__SortedDisjointIntervalList__IntervalComparator_t__iterator insertInterval(long start, long end)Adds the interval [start..end] to the list, and merges overlapping or
immediately adjacent intervals ([2, 5] and [6, 7] are adjacent, but
[2, 5] and [7, 8] are not).
Returns an iterator to the inserted interval (possibly merged with others).
If start > end, it does LOG(DFATAL) and returns end() (no interval added). -
insertIntervals
public void insertIntervals(long[] starts, long[] ends)Adds all intervals [starts[i]..ends[i]].
Same behavior as InsertInterval() upon invalid intervals. There's a version
with int64_t and int32_t. -
insertIntervals
public void insertIntervals(int[] starts, int[] ends) -
numIntervals
public int numIntervals()Returns the number of disjoint intervals in the list. -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-