Top Description Fields Constructors Methods
java.text

pack-priv final Class RBTableBuilder

extends Object
Class Inheritance
Imports
java.util.Vector, sun.text.UCompactIntArray, .IntHashtable, .ComposedCharIter, jdk.internal.icu.impl.NormalizerImpl

This class contains all the code to parse a RuleBasedCollator pattern and build a RBCollationTables object from it. A particular instance of tis class exists only during the actual build process-- once an RBCollationTables object has been built, the RBTableBuilder object goes away. This object carries all of the state which is only needed during the build process, plus a "shadow" copy of all of the state that will go into the tables object itself. This object communicates with RBCollationTables through a separate class, RBCollationTables.BuildAPI, this is an inner class of RBCollationTables and provides a separate private API for communication with RBTableBuilder. This class isn't just an inner class of RBCollationTables itself because of its large size. For source-code readability, it seemed better for the builder to have its own source file.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
private IntHashtable
private Vector<Vector<EntryPair>>
private Vector<int[]>
private boolean
private static final int
private static final int
private boolean
private char[]
private UCompactIntArray
private static final int
private short
private short
private MergeCollation
private static final int
private boolean
private static final int
private RBCollationTables.BuildAPI
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addComposedChars()

Add expanding entries for pre-composed unicode characters so that this collator can be used reasonably well with decomposition turned off.

private void
private final void
addContractOrder(String groupChars, int anOrder)

private final void
addContractOrder(String groupChars, int anOrder, boolean fwd)

Adds the contracting string into the collation table.

private final void
addExpandOrder(String contractChars, String expandChars, int anOrder)

Adds the expanding string into the collation table.

private final void
addExpandOrder(int ch, String expandChars, int anOrder)

private int
addExpansion(int anOrder, String expandChars)

Create a new entry in the expansion table that contains the orderings for the given characters.

private final void
addOrder(int ch, int anOrder)

Adds a character and its designated order into the collation table.

public void
build(String pattern, int decmp)

Create a table-based collation object with the given rules.

private final void
commit()

Look up for unmapped values in the expanded character table.

private final int
getCharOrder(int ch)

private int
getContractOrder(String groupChars)

If the given string has been specified as a contracting string in this collation table, return its ordering.

private Vector<EntryPair>
getContractValues(int
the starting character of the contracting string
ch
)

Get the entry of hash table of the contracting string in the collation table.

private Vector<EntryPair>
private final int
increment(int aStrength, int lastValue)

Increment of the last order based on the comparison level.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHARINDEXback to summary
pack-priv static final int CHARINDEX
contractFlagsback to summary
private IntHashtable contractFlags
contractTableback to summary
private Vector<Vector<EntryPair>> contractTable
expandTableback to summary
private Vector<int[]> expandTable
frenchSecback to summary
private boolean frenchSec
IGNORABLEMASKback to summary
private static final int IGNORABLEMASK
INITIALTABLESIZEback to summary
private static final int INITIALTABLESIZE
isOverIgnoreback to summary
private boolean isOverIgnore
keyBufback to summary
private char[] keyBuf
mappingback to summary
private UCompactIntArray mapping
MAXKEYSIZEback to summary
private static final int MAXKEYSIZE
maxSecOrderback to summary
private short maxSecOrder
maxTerOrderback to summary
private short maxTerOrder
mPatternback to summary
private MergeCollation mPattern
PRIMARYORDERINCREMENTback to summary
private static final int PRIMARYORDERINCREMENT
seAsianSwappingback to summary
private boolean seAsianSwapping
SECONDARYORDERINCREMENTback to summary
private static final int SECONDARYORDERINCREMENT
tablesback to summary
private RBCollationTables.BuildAPI tables
TERTIARYORDERINCREMENTback to summary
private static final int TERTIARYORDERINCREMENT

Constructor Detail

RBTableBuilderback to summary
public RBTableBuilder(RBCollationTables.BuildAPI tables)

Method Detail

addComposedCharsback to summary
private void addComposedChars() throws ParseException

Add expanding entries for pre-composed unicode characters so that this collator can be used reasonably well with decomposition turned off.

addContractFlagsback to summary
private void addContractFlags(String chars)
addContractOrderback to summary
private final void addContractOrder(String groupChars, int anOrder)
addContractOrderback to summary
private final void addContractOrder(String groupChars, int anOrder, boolean fwd)

Adds the contracting string into the collation table.

addExpandOrderback to summary
private final void addExpandOrder(String contractChars, String expandChars, int anOrder) throws ParseException

Adds the expanding string into the collation table.

addExpandOrderback to summary
private final void addExpandOrder(int ch, String expandChars, int anOrder) throws ParseException
addExpansionback to summary
private int addExpansion(int anOrder, String expandChars)

Create a new entry in the expansion table that contains the orderings for the given characters. If anOrder is valid, it is added to the beginning of the expanded list of orders.

addOrderback to summary
private final void addOrder(int ch, int anOrder)

Adds a character and its designated order into the collation table.

buildback to summary
public void build(String pattern, int decmp) throws ParseException

Create a table-based collation object with the given rules. This is the main function that actually builds the tables and stores them back in the RBCollationTables object. It is called ONLY by the RBCollationTables constructor.

Exceptions
ParseException:
If the rules format is incorrect.
See Also
RuleBasedCollator#RuleBasedCollator
commitback to summary
private final void commit()

Look up for unmapped values in the expanded character table. When the expanding character tables are built by addExpandOrder, it doesn't know what the final ordering of each character in the expansion will be. Instead, it just puts the raw character code into the table, adding CHARINDEX as a flag. Now that we've finished building the mapping table, we can go back and look up that character to see what its real collation order is and stick that into the expansion table. That lets us avoid doing a two-stage lookup later.

getCharOrderback to summary
private final int getCharOrder(int ch)
getContractOrderback to summary
private int getContractOrder(String groupChars)

If the given string has been specified as a contracting string in this collation table, return its ordering. Otherwise return UNMAPPED.

getContractValuesback to summary
private Vector<EntryPair> getContractValues(int ch)

Get the entry of hash table of the contracting string in the collation table.

Parameters
ch:int

the starting character of the contracting string

getContractValuesImplback to summary
private Vector<EntryPair> getContractValuesImpl(int index)
incrementback to summary
private final int increment(int aStrength, int lastValue)

Increment of the last order based on the comparison level.