private TreeMap<Pair<Integer, Integer>, String> calculateReplacements(String[] propertyWords, Int2IntMap matches) {
    TreeMap<Pair<Integer, Integer>, String> replacements = new TreeMap<>(Pair.comparingByFirst());
    for (final OriginalToNewChange change : myChanges) {
      final int first = change.oldFirst;
      final int last = change.oldLast;
      if (change.getOldLength() > 0) {
        if (containsAllBetween(matches, first, last)) {
          final String newString = change.getNewString();
          final int propertyWordFirst = matches.get(first);

          if (first >= myOldClassName.length || last >= myOldClassName.length) {
            LOG.error("old class name = " + myOldClassNameAsGiven + ", new class name = " + myNewClassNameAsGiven + ", propertyWords = " +
                      Arrays.asList(propertyWords));
          }

          final String replacement = suggestReplacement(propertyWords[propertyWordFirst], newString);
          replacements.put(Pair.create(propertyWordFirst, matches.get(last)), replacement);
        }
      }
      else {
        final String newString = change.getNewString();
        final int propertyWordToInsertBefore;
        if (matches.containsKey(first)) {
          propertyWordToInsertBefore = matches.get(first);
        }
        else if (matches.containsKey(last)) {
          propertyWordToInsertBefore = matches.get(last) + 1;
        }
        else {
          propertyWordToInsertBefore = propertyWords.length;
        }
        replacements.put(Pair.create(propertyWordToInsertBefore, propertyWordToInsertBefore - 1), newString);
      }
    }
    return replacements;
  }
private TreeMap<Pair<Integer, Integer>, String> calculateReplacements(String[] propertyWords, Int2IntMap matches)