public int following(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());return DONE;} else if (pos >= sentenceStarts[sentenceStarts.length - 1]) {text.setIndex(text.getEndIndex());currentSentence = sentenceStarts.length - 1;return DONE;} else { currentSentence = (sentenceStarts.length - 1) / 2; moveToSentenceAt(pos, 0, sentenceStarts.length - 2);text.setIndex(sentenceStarts[++currentSentence]);return current();}}

public override int Following(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);return Done;}else if (pos >= sentenceStarts[sentenceStarts.Length - 1]){text.SetIndex(text.EndIndex);currentSentence = sentenceStarts.Length - 1;return Done;}else{ currentSentence = (sentenceStarts.Length - 1) / 2; MoveToSentenceAt(pos, 0, sentenceStarts.Length - 2);text.SetIndex(sentenceStarts[++currentSentence]);return Current;}}
