Class Trie2Writable
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.Trie2
org.graalvm.shadowed.com.ibm.icu.impl.Trie2Writable
- All Implemented Interfaces:
Iterable<Trie2.Range>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graalvm.shadowed.com.ibm.icu.impl.Trie2
Trie2.CharSequenceIterator, Trie2.CharSequenceValues, Trie2.Range, Trie2.ValueMapper -
Constructor Summary
ConstructorsConstructorDescriptionTrie2Writable(int initialValueP, int errorValueP) Create a new, empty, writable Trie2.Trie2Writable(Trie2 source) Create a new build time (modifiable) Trie2 whose contents are the same as the source Trie2. -
Method Summary
Modifier and TypeMethodDescriptionintget(int codePoint) Get the value for a code point as stored in the Trie2.intgetFromU16SingleLead(char c) Get a trie value for a UTF-16 code unit.set(int c, int value) Set a value for a code point.setForLeadSurrogateCodeUnit(char codeUnit, int value) Set a value for a UTF-16 code unit.setRange(int start, int end, int value, boolean overwrite) Set a value in a range of code points [start..end].setRange(Trie2.Range range, boolean overwrite) Set the values from a Trie2.Range.Produce an optimized, read-only Trie2_16 from this writable Trie.Produce an optimized, read-only Trie2_32 from this writable Trie.Methods inherited from class org.graalvm.shadowed.com.ibm.icu.impl.Trie2
charSequenceIterator, createFromSerialized, equals, getVersion, hashCode, iterator, iterator, iteratorForLeadSurrogate, iteratorForLeadSurrogate, serializeHeaderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Trie2Writable
public Trie2Writable(int initialValueP, int errorValueP) Create a new, empty, writable Trie2. 32-bit data values are used.- Parameters:
initialValueP- the initial value that is set for all code pointserrorValueP- the value for out-of-range code points and illegal UTF-8
-
Trie2Writable
Create a new build time (modifiable) Trie2 whose contents are the same as the source Trie2.- Parameters:
source- the source Trie2. Its contents will be copied into the new Trie2.
-
-
Method Details
-
set
Set a value for a code point.- Parameters:
c- the code pointvalue- the value
-
setRange
Set a value in a range of code points [start..end]. All code points c with startinvalid input: '<'=cinvalid input: '<'=end will get the value if overwrite is true or if the old value is the initial value.- Parameters:
start- the first code point to get the valueend- the last code point to get the value (inclusive)value- the valueoverwrite- flag for whether old non-initial values are to be overwritten
-
setRange
Set the values from a Trie2.Range. All code points within the range will get the value if overwrite is true or if the old value is the initial value. Ranges with the lead surrogate flag set will set the alternate lead-surrogate values in the Trie, rather than the code point values. This function is intended to work with the ranges produced when iterating the contents of a source Trie.- Parameters:
range- contains the range of code points and the value to be set.overwrite- flag for whether old non-initial values are to be overwritten
-
setForLeadSurrogateCodeUnit
Set a value for a UTF-16 code unit. Note that a Trie2 stores separate values for supplementary code points in the lead surrogate range (accessed via the plain set() and get() interfaces) and for lead surrogate code units. The lead surrogate code unit values are set via this function and read by the function getFromU16SingleLead(). For code units outside of the lead surrogate range, this function behaves identically to set().- Parameters:
codeUnit- A UTF-16 code unit.value- the value to be stored in the Trie2.
-
get
-
getFromU16SingleLead
public int getFromU16SingleLead(char c) Get a trie value for a UTF-16 code unit. This function returns the same value as get() if the input character is outside of the lead surrogate range There are two values stored in a Trie for inputs in the lead surrogate range. This function returns the alternate value, while Trie2.get() returns the main value.- Specified by:
getFromU16SingleLeadin classTrie2- Parameters:
c- the code point or lead surrogate value.- Returns:
- the value
-
toTrie2_16
Produce an optimized, read-only Trie2_16 from this writable Trie. The data values outside of the range that will fit in a 16 bit unsigned value will be truncated. -
toTrie2_32
Produce an optimized, read-only Trie2_32 from this writable Trie.
-