public abstract class CodePointMap extends Object implements Iterable<CodePointMap.Range>
Modifier and Type | Class and Description |
---|---|
static class |
CodePointMap.Range
Range iteration result data.
|
static class |
CodePointMap.RangeOption
Selectors for how getRange() should report value ranges overlapping with surrogates.
|
class |
CodePointMap.StringIterator
Iterates over code points of a string and fetches map values.
|
static interface |
CodePointMap.ValueFilter
Callback function interface: Modifies a map value.
|
Modifier | Constructor and Description |
---|---|
protected |
CodePointMap()
Protected no-args constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract int |
get(int c)
Returns the value for a code point as stored in the map, with range checking.
|
boolean |
getRange(int start,
CodePointMap.RangeOption option,
int surrogateValue,
CodePointMap.ValueFilter filter,
CodePointMap.Range range)
Sets the range object to a range of code points beginning with the start parameter.
|
abstract boolean |
getRange(int start,
CodePointMap.ValueFilter filter,
CodePointMap.Range range)
Sets the range object to a range of code points beginning with the start parameter.
|
Iterator<CodePointMap.Range> |
iterator()
Convenience iterator over same-map-value code point ranges.
|
CodePointMap.StringIterator |
stringIterator(CharSequence s,
int sIndex)
Returns an iterator (not a java.util.Iterator) over code points of a string
for fetching map values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected CodePointMap()
public abstract int get(int c)
c
- the code pointpublic abstract boolean getRange(int start, CodePointMap.ValueFilter filter, CodePointMap.Range range)
If the CodePointMap.ValueFilter
parameter is not null, then
the value to be delivered is passed through that filter, and the return value is the end
of the range where all values are modified to the same actual value.
The value is unchanged if that parameter is null.
Example:
int start = 0; CodePointMap.Range range = new CodePointMap.Range(); while (map.getRange(start, null, range)) { int end = range.getEnd(); int value = range.getValue(); // Work with the range start..end and its value. start = end + 1; }
start
- range startfilter
- an object that may modify the map data value,
or null if the values from the map are to be used unmodifiedrange
- the range object that will be set to the code point range and valuepublic boolean getRange(int start, CodePointMap.RangeOption option, int surrogateValue, CodePointMap.ValueFilter filter, CodePointMap.Range range)
Same as the simpler getRange(int, ValueFilter, Range)
but optionally
modifies the range if it overlaps with surrogate code points.
start
- range startoption
- defines whether surrogates are treated normally,
or as having the surrogateValue; usually CodePointMap.RangeOption.NORMAL
surrogateValue
- value for surrogates; ignored if option==CodePointMap.RangeOption.NORMAL
filter
- an object that may modify the map data value,
or null if the values from the map are to be used unmodifiedrange
- the range object that will be set to the code point range and valuepublic Iterator<CodePointMap.Range> iterator()
getRange(int, ValueFilter, Range)
without filtering.
Adjacent ranges have different map values.
The iterator always returns the same Range object.
iterator
in interface Iterable<CodePointMap.Range>
public CodePointMap.StringIterator stringIterator(CharSequence s, int sIndex)
s
- string to iterate oversIndex
- string index where the iteration will startCopyright © 2016 Unicode, Inc. and others.