Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android Pie: add java.text.BreakIterator.
Change on 2019/05/24 by antoniocortes <antoniocortes@google.com> ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=249842328
- Loading branch information
1 parent
b36b257
commit a5cbf0f
Showing
18 changed files
with
2,814 additions
and
845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
...atform/external/icu/android_icu4j/src/main/java/android/icu/impl/CSCharacterIterator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,108 @@ | |||
/* GENERATED SOURCE. DO NOT MODIFY. */ | |||
// © 2017 and later: Unicode, Inc. and others. | |||
// License & terms of use: http://www.unicode.org/copyright.html#License | |||
package android.icu.impl; | |||
|
|||
import java.text.CharacterIterator; | |||
|
|||
/** | |||
* Implement the Java CharacterIterator interface on a CharSequence. | |||
* Intended for internal use by ICU only. | |||
* @hide Only a subset of ICU is exposed in Android | |||
*/ | |||
public class CSCharacterIterator implements CharacterIterator { | |||
|
|||
private int index; | |||
private CharSequence seq; | |||
|
|||
|
|||
/** | |||
* Constructor. | |||
* @param text The CharSequence to iterate over. | |||
*/ | |||
public CSCharacterIterator(CharSequence text) { | |||
if (text == null) { | |||
throw new NullPointerException(); | |||
} | |||
seq = text; | |||
index = 0; | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public char first() { | |||
index = 0; | |||
return current(); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public char last() { | |||
index = seq.length(); | |||
return previous(); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public char current() { | |||
if (index == seq.length()) { | |||
return DONE; | |||
} | |||
return seq.charAt(index); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public char next() { | |||
if (index < seq.length()) { | |||
++index; | |||
} | |||
return current(); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public char previous() { | |||
if (index == 0) { | |||
return DONE; | |||
} | |||
--index; | |||
return current(); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public char setIndex(int position) { | |||
if (position < 0 || position > seq.length()) { | |||
throw new IllegalArgumentException(); | |||
} | |||
index = position; | |||
return current(); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public int getBeginIndex() { | |||
return 0; | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public int getEndIndex() { | |||
return seq.length(); | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public int getIndex() { | |||
return index; | |||
} | |||
|
|||
/** @{inheritDoc} */ | |||
@Override | |||
public Object clone() { | |||
CSCharacterIterator copy = new CSCharacterIterator(seq); | |||
copy.setIndex(index); | |||
return copy; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.