private void checkOffset(int offset) { if (!wrapped.hasText()) { throw new IllegalArgumentException("BreakIterator has no text"); } CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset > it.getEndIndex()) { String message = "Valid range is [" + it.getBeginIndex() + " " + it.getEndIndex() + "]"; throw new IllegalArgumentException(message); } }
/** * Get the start index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public int getBeginIndex() { return iter.getBeginIndex(); }
/** * Get the start index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public int getBeginIndex() { return iter.getBeginIndex(); }
private void validateOffset(int offset) { CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset > it.getEndIndex()) { String message = "Valid range is [" + it.getBeginIndex() + " " + it.getEndIndex() + "]"; throw new IllegalArgumentException(message); } }
/** * Throw IllegalArgumentException unless begin <= offset < end. * @stable ICU 2.0 */ protected static final void checkOffset(int offset, CharacterIterator text) { if (offset < text.getBeginIndex() || offset > text.getEndIndex()) { throw new IllegalArgumentException("offset out of bounds"); } }
/** * @see UCharacterIterator#getLength() */ @Override public int getLength() { return (iterator.getEndIndex() - iterator.getBeginIndex()); }
private void validateOffset(int offset) { CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset >= it.getEndIndex()) { throw new IllegalArgumentException(); } }
private void checkOffset(int offset) { if (!wrapped.hasText()) { throw new IllegalArgumentException("BreakIterator has no text"); } CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset > it.getEndIndex()) { String message = "Valid range is [" + it.getBeginIndex() + " " + it.getEndIndex() + "]"; throw new IllegalArgumentException(message); } }
private void checkOffset(int offset) { if (!wrapped.hasText()) { throw new IllegalArgumentException("BreakIterator has no text"); } CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset > it.getEndIndex()) { String message = "Valid range is [" + it.getBeginIndex() + " " + it.getEndIndex() + "]"; throw new IllegalArgumentException(message); } }
private void checkOffset(int offset) { if (!wrapped.hasText()) { throw new IllegalArgumentException("BreakIterator has no text"); } CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset > it.getEndIndex()) { String message = "Valid range is [" + it.getBeginIndex() + " " + it.getEndIndex() + "]"; throw new IllegalArgumentException(message); } }
private void checkOffset(int offset) { if (!wrapped.hasText()) { throw new IllegalArgumentException("BreakIterator has no text"); } CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset > it.getEndIndex()) { String message = "Valid range is [" + it.getBeginIndex() + " " + it.getEndIndex() + "]"; throw new IllegalArgumentException(message); } }
@Override public boolean isBoundary(int offset) { if (offset == getText().getBeginIndex()) { return true; } else { return following(offset - 1) == offset; } }
public boolean isBoundary(int offset) { if (offset == getText().getBeginIndex()) return true; else return following(offset - 1) == offset; }
@Override public boolean isBoundary(int offset) { if (offset == getText().getBeginIndex()) return true; else return following(offset - 1) == offset; }
/** * Gets the current index that the iterator is operating on. * * @return the current index. */ @API(value = "2.0") public int getIndex() { return chars.getIndex() - chars.getBeginIndex(); }
@Override public boolean isBoundary(int offset) { if (offset == getText().getBeginIndex()) return true; else return following(offset - 1) == offset; }
/** * Returns the total number of characters in the sequence. * * @return The length. */ @API(value = "2.0") public int getLength() { return chars.getEndIndex() - chars.getBeginIndex(); }
int start = target.getBeginIndex(); int end = target.getEndIndex();
@Override public int moveIndex(int delta){ int length = iterator.getEndIndex() - iterator.getBeginIndex(); int idx = iterator.getIndex()+delta; if(idx < 0) { idx = 0; } else if(idx > length) { idx = length; } return iterator.setIndex(idx); }
private boolean isPrimarySufficient(CharacterIterator iter) { int limit = iter.getEndIndex(); char c = iter.setIndex(iter.getBeginIndex()); while (iter.getIndex() < limit && super.canDisplay(c)) { c = iter.next(); } return iter.getIndex() == limit; }