- range overlaps the first (A).
-
- The diagrams show various relative placements
- of A and B for each OverlapType.
-
- Notes:
- Internal: the start points cannot coincide
- External: the start and end points can coincide
- Start: end points can coincide
- End: start points can coincide
-
- XXX Logically, Internal should disallow end
- point equality.
- */
-
- /*
- |--------------------| A
- |------| B
- |-----------------| B
-
-
- "B is internal to A"
-
- */
-
- if ((sb > sa) && (eb <= ea)) {
- return OverlapInternal;
+ * range overlaps the first (A).
+ *
+ * The diagram shows the OverlapType of each possible relative
+ * placement of A and B.
+ *
+ * Notes:
+ * Internal: the start and end points cannot coincide
+ * External: the start and end points can coincide
+ * Start: end points can coincide
+ * End: start points can coincide
+ *
+ * Internal disallows start and end point equality, and thus implies
+ * that there are two disjoint portions of A which do not overlap B.
+ *
+ * A: |---|
+ * B starts before A
+ * B: |-| None
+ * B: |--| Start
+ * B: |----| Start
+ * B: |------| External
+ * B: |--------| External
+ * B starts equal to A
+ * B: |-| Start
+ * B: |---| External
+ * B: |----| External
+ * B starts inside A
+ * B: |-| Internal
+ * B: |--| End
+ * B: |---| End
+ * B starts at end of A
+ * B: |--| End
+ * B starts after A
+ * B: |-| None
+ * A: |---|
+ */
+
+
+ if (sa > ea) {
+ // seems we are sometimes called with negative length ranges
+ std::cerr << "a - start after end: " << sa << ", " << ea << std::endl;
+ return OverlapNone;