public int preceding(int pos) {if (pos < text.getBeginIndex() || pos > text.getEndIndex()) {throw new IllegalArgumentException("offset out of bounds");} else if (0 == sentenceStarts.length) {text.setIndex(text.getBeginIndex());currentSentence = 0;return DONE;} else if (pos < sentenceStarts[0]) {text.setIndex(text.getBeginIndex());currentSentence = 0;return DONE;} else {currentSentence = sentenceStarts.length / 2; moveToSentenceAt(pos, 0, sentenceStarts.length - 1);if (0 == currentSentence) {text.setIndex(text.getBeginIndex());return DONE;} else {text.setIndex(sentenceStarts[--currentSentence]);return current();}}}
public override int Preceding(int pos){if (pos < text.BeginIndex || pos > text.EndIndex){throw new ArgumentException("offset out of bounds");}else if (0 == sentenceStarts.Length){text.SetIndex(text.BeginIndex);currentSentence = 0;return Done;}else if (pos < sentenceStarts[0]){text.SetIndex(text.BeginIndex);currentSentence = 0;return Done;}else{currentSentence = sentenceStarts.Length / 2; MoveToSentenceAt(pos, 0, sentenceStarts.Length - 1);if (0 == currentSentence){text.SetIndex(text.BeginIndex);return Done;}else{text.SetIndex(sentenceStarts[--currentSentence]);return Current;}}}