docs: public final boolean containsExactly(LocatedString other) {
      if (!referenceCharOffsetsSequential() && other.referenceCharOffsetsSequential()) {
        throw new UnsupportedOperationException("Containment for non-monotonic LocatedStrings needs"
            + " to be implemented");
      }
  
      if (!referenceBounds().asCharOffsetRange().contains(other.referenceBounds().asCharOffsetRange())
          || !referenceBounds().asEdtOffsetRange()
          .contains(other.referenceBounds().asEdtOffsetRange())) {
        // quick, cheap short-circuit check
        return false;
      }
  
      // which of our character regions contains the start character offset of the putative substring?
      final Optional<Integer> startRegionIndex =
          firstRegionIndexContainingReferenceCharOffset(other.referenceBounds().startCharOffsetInclusive());
      // which of our character regions contains the end character offset of the putative substring?
      final Optional<Integer> endRegionIndex =
          firstRegionIndexContainingReferenceCharOffset(other.referenceBounds().endCharOffsetInclusive());
  
      // if we don't have any region containing them, it can't be a substring
      if (!startRegionIndex.isPresent() || !endRegionIndex.isPresent()) {
        return false;
      }
  
      final int numThisRegionsPossiblyOverlappingSubstring =
          endRegionIndex.get() - startRegionIndex.get() + 1;
  
      // we know if they are a substring this must be equal because both are in canonical form
      if (numThisRegionsPossiblyOverlappingSubstring != other.characterRegions().size()) {
        return false;
      }
  
      final CharOffset earliestPossibleMatchingContentOffset;
      final CharOffset latestPossibleMatchingContentOffset;
  
      if (numThisRegionsPossiblyOverlappingSubstring == 1) {
        // special case for when the putative substring would be contained entirely in just one
        // of our character regions
        final CharacterRegion containerOnlyMatchingRegion =
            characterRegions().get(startRegionIndex.get());
        final CharacterRegion containeeOnlyRegion = other.characterRegions().get(0);
        if (containerOnlyMatchingRegion.contains(containeeOnlyRegion)) {
          earliestPossibleMatchingContentOffset =
              containerOnlyMatchingRegion.absoluteStartingContentOffsetOfReferenceCharOffset(
                  containeeOnlyRegion.referenceStartOffsetInclusive().charOffset());
          latestPossibleMatchingContentOffset =
              containerOnlyMatchingRegion.absoluteEndingContentOffsetOfReferenceCharOffset(
                  containeeOnlyRegion.referenceEndOffsetInclusive().charOffset());
        } else {
          return false;
        }
      } else {
        // if the putative substring covers more than one of our character regions, then
        // its first region must be a suffix of our first region...
        final CharacterRegion containerFirstMatchingRegion =
            characterRegions().get(startRegionIndex.get());
        final CharacterRegion containeeFirstRegion = other.characterRegions().get(0);
        if (!containeeFirstRegion.isSuffixOf(containerFirstMatchingRegion)) {
          return false;
        }
        earliestPossibleMatchingContentOffset =
            containerFirstMatchingRegion.absoluteStartingContentOffsetOfReferenceCharOffset(
                containeeFirstRegion.referenceStartOffsetInclusive().charOffset());
  
        // and its last region must be a prefix of our last region
        final CharacterRegion containerLastMatchingRegion =
            characterRegions().get(endRegionIndex.get());
        final CharacterRegion containeeLastRegion = Iterables.getLast(other.characterRegions());
        if (!containeeLastRegion.isPrefixOf(containerLastMatchingRegion)) {
          return false;
        }
        latestPossibleMatchingContentOffset =
            containerLastMatchingRegion.absoluteEndingContentOffsetOfReferenceCharOffset(
                containeeLastRegion.referenceEndOffsetInclusive().charOffset());
  
        // and all intermediate regions must match exactly (because of canonical form)
        for (int i = 1; i < numThisRegionsPossiblyOverlappingSubstring - 1; ++i) {
          final CharacterRegion thisRegion = characterRegions().get(startRegionIndex.get() + i);
          final CharacterRegion otherRegion = other.characterRegions().get(i);
          if (!thisRegion.equivalentUpToShiftedContentOffsets(otherRegion)) {
            return false;
          }
        }
      }
  
      return content().substringByCodePoints(OffsetRange.fromInclusiveEndpoints(
          earliestPossibleMatchingContentOffset, latestPossibleMatchingContentOffset))
          .contains(other.content());
    }