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 end index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public int getEndIndex() { return iter.getEndIndex(); }
/** * Get the end index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public int getEndIndex() { return iter.getEndIndex(); }
int endIndex() { if (targetText == null) { return 0; } return targetText.getEndIndex(); } }
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); } }
private void validateOffset(int offset) { CharacterIterator it = wrapped.getText(); if (offset < it.getBeginIndex() || offset >= it.getEndIndex()) { throw new IllegalArgumentException(); } }
/** * 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()); }
/** * @see UCharacterIterator#setToLimit() */ @Override public void setToLimit() { iterator.setIndex(iterator.getEndIndex()); }
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); } }
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); } }
/** * Returns the total number of characters in the sequence. * * @return The length. */ @API(value = "2.0") public int getLength() { return chars.getEndIndex() - chars.getBeginIndex(); }
AttributedString s = new AttributedString("Hello"); AttributedCharacterIterator x = s.getIterator(); String a = ""; a+=x.current(); while (x.getIndex() < x.getEndIndex()) a += x.next(); a=a.substring(0,a.length()-1); System.out.println(a);
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 char next() { if (it.getIndex() == it.getEndIndex()) throw new MalformedJsonException("Reached end of input at the " + it.getIndex() + "th character."); c = it.next(); return c; }
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; }