Case | Core Implementation | Main Implementation |
Empty Set | FiniteInterval | Interval |
Fully Bounded | FiniteInterval | Interval |
Left Bounded | HalfInterval | Interval |
Right Bounded | HalfInterval | Interval |
Unbounded | EnumInterval | Interval |
Disjoint | — | IntervalSet |
Most operations are provided via traits in order to present a consistent,
easy to use API for each type.
Operation | Op Type | Core | Main | Description |
Contains | predicate | ✓ | ✓ | Test if A is a superset of B |
Intersects | predicate | ✓ | ✓ | Test for some shared element of A and B |
Connects | predicate | ✓ | ✓ | Test if sets are connected |
Width | measure | ✓ | ✓ | Find the width/diameter/length of a set |
Count | measure | ✓ | ✓ | Count the elements of a set |
Intersection | binary | ✓ | ✓ | The intersection set of two sets |
TryMerge | binary | ✓ | ✓ | The union of two connected sets |
Split | function | ✓ | ✓ | Two sets partitioned by some element |
IntoFinite | unary | ✓ | ✓ | Convert to a finite interval limited by element type |
Complement | unary | — | ✓ | The (possibly disjoint) complement of a set |
Union | binary | — | ✓ | The (possibly disjoint) union of two sets |
Difference | binary | — | ✓ | The (possibly disjoint) difference of set A from B |
SymDifference | binary | — | ✓ | The (possibly disjoint) symmetric difference of two sets |