private Character findBestSingleCharReplacement(int fixIndex) { buffer.insertChar(fixIndex, DEL_ERROR); Character bestChar = findBestSingleCharInsertion(fixIndex + 2); if (bestChar == null) { // success, we found a fix that renders the complete input error free currentError .shiftIndexDeltaBy(-1); // delta from DEL_ERROR char insertion and index shift by insertion method } else { buffer.undoCharInsertion(fixIndex); errorIndex = Math.max(errorIndex - 3, 0); } return bestChar; }
int nextErrorAfterDeletion = errorIndex; Character bestInsertionCharacter = findBestSingleCharInsertion(fixIndex); if (bestInsertionCharacter == null) return true; int nextErrorAfterBestInsertion = errorIndex;