@Override
 public Object clone() {
   int cloneAddr = cloneImpl(this.addr);
   NativeBreakIterator clone = new NativeBreakIterator(cloneAddr, this.type);
   // The RI doesn't clone the CharacterIterator.
   clone.charIter = this.charIter;
   return clone;
 }
Example #2
0
 /**
  * Creates a copy of this iterator, all status information including the current position are kept
  * the same.
  *
  * @return a copy of this iterator.
  */
 @Override
 public Object clone() {
   try {
     BreakIterator cloned = (BreakIterator) super.clone();
     cloned.wrapped = (NativeBreakIterator) wrapped.clone();
     return cloned;
   } catch (CloneNotSupportedException e) {
     throw new AssertionError(e); // android-changed
   }
 }
Example #3
0
 /**
  * Sets the new text string to be analyzed, the current position will be reset to the beginning of
  * this new string, and the old string will be lost.
  *
  * @param newText the new text string to be analyzed.
  */
 public void setText(String newText) {
   wrapped.setText(newText);
 }
Example #4
0
 /**
  * Returns the position of last boundary preceding the given offset, and sets the current position
  * to the returned value, or {@code DONE} if the given offset specifies the starting position.
  *
  * @param offset the given start position to be searched for.
  * @return the position of the last boundary preceding the given offset.
  * @throws IllegalArgumentException if the offset is invalid.
  */
 public int preceding(int offset) {
   return wrapped.preceding(offset);
 }
Example #5
0
 /**
  * Indicates whether the given offset is a boundary position. If this method returns true, the
  * current iteration position is set to the given position; if the function returns false, the
  * current iteration position is set as though {@link #following(int)} had been called.
  *
  * @param offset the given offset to check.
  * @return {@code true} if the given offset is a boundary position; {@code false} otherwise.
  */
 public boolean isBoundary(int offset) {
   return wrapped.isBoundary(offset);
 }
Example #6
0
 /**
  * Returns a new instance of {@code BreakIterator} to iterate over word-breaks using the given
  * locale.
  *
  * @param where the given locale.
  * @return a new instance of {@code BreakIterator} using the given locale.
  * @throws NullPointerException if {@code where} is {@code null}.
  */
 public static BreakIterator getWordInstance(Locale where) {
   return new RuleBasedBreakIterator(NativeBreakIterator.getWordInstance(where));
 }