private int convertRaw(boolean fromMaster, int value, boolean approximate) {
    TreeMap<Integer, Data> fragments = fromMaster ? myFragments : myInvertedFragments;

    if (approximate) {
      Map.Entry<Integer, Data> prevEntry = fragments.floorEntry(value);
      if (prevEntry == null) return 0;
      int start = prevEntry.getKey();
      Data data = prevEntry.getValue();

      return Math.min(data.otherStart - start + value, data.otherStart + data.otherLength);
    }
    else {
      Map.Entry<Integer, Data> prevEntry = fragments.floorEntry(value);
      if (prevEntry == null) return -1;
      int start = prevEntry.getKey();
      Data data = prevEntry.getValue();

      if (value >= start + data.length) return -1;
      if (data.length != data.otherLength) return -1;

      return data.otherStart - start + value;
    }
  }
private int convertRaw(boolean fromMaster, int value, boolean approximate)