Top Description Inners Fields Constructors Methods
com.ibm.icu.text

pack-priv Class RBBITableBuilder

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collection, .HashSet, .List, .Set, .SortedSet, .TreeSet, com.ibm.icu.impl.Assert, .RBBIDataWrapper, com.ibm.icu.text.RBBIRuleBuilder.IntPair

This class is part of the RBBI rule compiler. It builds the state transition table used by the RBBI runtime from the expression syntax tree generated by the rule scanner. This class is part of the RBBI implementation only. There is no user-visible public API here.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private List<RBBITableBuilder.RBBIStateDescriptor>
fDStates

D states (Aho's terminology).

pack-priv int
fLASlotsInUse

Counter used when assigning lookahead rule numbers.

pack-priv int[]
fLookAheadRuleMap

Map from rule number (fVal in look ahead nodes) to sequential lookahead index.

private RBBIRuleBuilder
private int
fRootIx

The array index into RBBIRuleBuilder.fTreeRoots for the parse tree to operate on.

private List<short[]>
fSafeTable

Synthesized safe table, a List of row arrays.

private static final int

Constructor Summary

AccessConstructor and Description
pack-priv
RBBITableBuilder(RBBIRuleBuilder rb, int rootNodeIx)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
pack-priv void
pack-priv void
buildSafeReverseTable()

Synthesize a safe state table from the main state table.

pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv RBBIDataWrapper.RBBIStateTable
exportSafeTable()

Create a RBBIDataWrapper.RBBIStateTable for the safe reverse table.

pack-priv RBBIDataWrapper.RBBIStateTable
exportTable()

Create a RBBIDataWrapper.RBBIStateTable for a newly compiled table.

pack-priv boolean

Returns:

true if duplicate char classes were found, false otherwise.
findDuplCharClassFrom
(RBBIRuleBuilder.IntPair
in/out parameter, specifies where to start looking for duplicates, and returns the first pair of duplicates found, if any.
categories
)

Find duplicate (redundant) character classes.

pack-priv boolean

Returns:

true if duplicate states were found, false otherwise.
findDuplicateSafeState
(RBBIRuleBuilder.IntPair
in/out parameter, specifies where to start looking for duplicates, and returns the first pair of duplicates found, if any.
states
)

Find the next duplicate state in the safe reverse table.

pack-priv boolean

Returns:

true if duplicate states were found, false otherwise.
findDuplicateState
(RBBIRuleBuilder.IntPair
in/out parameter, specifies where to start looking for duplicates, and returns the first pair of duplicates found, if any.
states
)

Find duplicate (redundant) states, beginning at the specified pair, within this state table.

pack-priv void
pack-priv void
pack-priv void
pack-priv int
getSafeTableSize()

Calculate the size of the runtime form of this safe state table.

pack-priv int
getTableSize()

Calculate the size in bytes of the serialized form of this state transition table, which is identical to the ICU4C runtime form.

pack-priv void
mapLookAheadRules()

mapLookAheadRules

pack-priv void
pack-priv void
pack-priv void
printReverseTable()

Debug Function.

pack-priv void
pack-priv void
pack-priv void
pack-priv void
removeColumn(int column)

Remove a column from the state table.

pack-priv int

Returns:

the number of states removed.
removeDuplicateStates
()

Check for, and remove duplicate states (table rows).

pack-priv void
removeSafeState(RBBIRuleBuilder.IntPair
The duplicate pair of states. The first is kept, the second is removed. All references to the second in the state table are retargeted to the first.
duplStates
)

Remove a duplicate state from the safe table.

pack-priv void
removeState(RBBIRuleBuilder.IntPair
The duplicate pair of states.
duplStates
)

Remove a duplicate state (row) from the state table.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fDStatesback to summary
private List<RBBITableBuilder.RBBIStateDescriptor> fDStates

D states (Aho's terminology). Index is state number.

fLASlotsInUseback to summary
pack-priv int fLASlotsInUse

Counter used when assigning lookahead rule numbers. Contains the last look-ahead number already in use. The first look-ahead number is 2; Number 1 (ACCEPTING_UNCONDITIONAL) is reserved for non-lookahead accepting states. See the declarations of RBBIStateTableRowT.

fLookAheadRuleMapback to summary
pack-priv int[] fLookAheadRuleMap

Map from rule number (fVal in look ahead nodes) to sequential lookahead index.

fRBback to summary
private RBBIRuleBuilder fRB
fRootIxback to summary
private int fRootIx

The array index into RBBIRuleBuilder.fTreeRoots for the parse tree to operate on.

fSafeTableback to summary
private List<short[]> fSafeTable

Synthesized safe table, a List of row arrays.

MAX_STATE_FOR_8BITS_TABLEback to summary
private static final int MAX_STATE_FOR_8BITS_TABLE

Constructor Detail

RBBITableBuilderback to summary
pack-priv RBBITableBuilder(RBBIRuleBuilder rb, int rootNodeIx)

Method Detail

addRuleRootNodesback to summary
pack-priv void addRuleRootNodes(List<RBBINode> dest, RBBINode node)
bofFixupback to summary
pack-priv void bofFixup()
buildForwardTableback to summary
pack-priv void buildForwardTable()
buildSafeReverseTableback to summary
pack-priv void buildSafeReverseTable()

Synthesize a safe state table from the main state table.

buildStateTableback to summary
pack-priv void buildStateTable()
calcChainedFollowPosback to summary
pack-priv void calcChainedFollowPos(RBBINode tree, RBBINode endMarkNode)
calcFirstPosback to summary
pack-priv void calcFirstPos(RBBINode n)
calcFollowPosback to summary
pack-priv void calcFollowPos(RBBINode n)
calcLastPosback to summary
pack-priv void calcLastPos(RBBINode n)
calcNullableback to summary
pack-priv void calcNullable(RBBINode n)
exportSafeTableback to summary
pack-priv RBBIDataWrapper.RBBIStateTable exportSafeTable()

Create a RBBIDataWrapper.RBBIStateTable for the safe reverse table. RBBIDataWrapper.RBBIStateTable is similar to struct RBBIStateTable in ICU4C, in common/rbbidata.h

exportTableback to summary
pack-priv RBBIDataWrapper.RBBIStateTable exportTable()

Create a RBBIDataWrapper.RBBIStateTable for a newly compiled table. RBBIDataWrapper.RBBIStateTable is similar to struct RBBIStateTable in ICU4C, in common/rbbidata.h

findDuplCharClassFromback to summary
pack-priv boolean findDuplCharClassFrom(RBBIRuleBuilder.IntPair categories)

Find duplicate (redundant) character classes. Begin looking with categories.first. Duplicates, if found are returned in the categories parameter. This is an iterator-like function, used to identify character classes (state table columns) that can be eliminated.

Parameters
categories:RBBIRuleBuilder.IntPair

in/out parameter, specifies where to start looking for duplicates, and returns the first pair of duplicates found, if any.

Returns:boolean

true if duplicate char classes were found, false otherwise.

ICU Status
Internal ICU component.
findDuplicateSafeStateback to summary
pack-priv boolean findDuplicateSafeState(RBBIRuleBuilder.IntPair states)

Find the next duplicate state in the safe reverse table. An iterator function.

Parameters
states:RBBIRuleBuilder.IntPair

in/out parameter, specifies where to start looking for duplicates, and returns the first pair of duplicates found, if any.

Returns:boolean

true if duplicate states were found, false otherwise.

ICU Status
Internal ICU component.
findDuplicateStateback to summary
pack-priv boolean findDuplicateState(RBBIRuleBuilder.IntPair states)

Find duplicate (redundant) states, beginning at the specified pair, within this state table. This is an iterator-like function, used to identify states (state table rows) that can be eliminated.

Parameters
states:RBBIRuleBuilder.IntPair

in/out parameter, specifies where to start looking for duplicates, and returns the first pair of duplicates found, if any.

Returns:boolean

true if duplicate states were found, false otherwise.

ICU Status
Internal ICU component.
flagAcceptingStatesback to summary
pack-priv void flagAcceptingStates()
flagLookAheadStatesback to summary
pack-priv void flagLookAheadStates()
flagTaggedStatesback to summary
pack-priv void flagTaggedStates()
getSafeTableSizeback to summary
pack-priv int getSafeTableSize()

Calculate the size of the runtime form of this safe state table.

getTableSizeback to summary
pack-priv int getTableSize()

Calculate the size in bytes of the serialized form of this state transition table, which is identical to the ICU4C runtime form. Refer to common/rbbidata.h from ICU4C for the declarations of the structures being matched by this calculation.

mapLookAheadRulesback to summary
pack-priv void mapLookAheadRules()

mapLookAheadRules

mergeRuleStatusValsback to summary
pack-priv void mergeRuleStatusVals()
printPosSetsback to summary
pack-priv void printPosSets(RBBINode n)
printReverseTableback to summary
pack-priv void printReverseTable()

Debug Function. Dump the fully constructed safe reverse table.

printRuleStatusTableback to summary
pack-priv void printRuleStatusTable()
printSetback to summary
pack-priv void printSet(Collection<RBBINode> s)
printStatesback to summary
pack-priv void printStates()
removeColumnback to summary
pack-priv void removeColumn(int column)

Remove a column from the state table. Used when two character categories have been found equivalent, and merged together, to eliminate the unneeded table column.

removeDuplicateStatesback to summary
pack-priv int removeDuplicateStates()

Check for, and remove duplicate states (table rows).

Returns:int

the number of states removed.

ICU Status
Internal ICU component.
removeSafeStateback to summary
pack-priv void removeSafeState(RBBIRuleBuilder.IntPair duplStates)

Remove a duplicate state from the safe table.

Parameters
duplStates:RBBIRuleBuilder.IntPair

The duplicate pair of states. The first is kept, the second is removed. All references to the second in the state table are retargeted to the first.

ICU Status
Internal ICU component.
removeStateback to summary
pack-priv void removeState(RBBIRuleBuilder.IntPair duplStates)

Remove a duplicate state (row) from the state table. All references to the deleted (second) state are redirected to first state.

Parameters
duplStates:RBBIRuleBuilder.IntPair

The duplicate pair of states.

ICU Status
Internal ICU component.
com.ibm.icu.text back to summary

pack-priv Class RBBITableBuilder.RBBIStateDescriptor

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int[]
pack-priv int
pack-priv boolean
pack-priv Set<RBBINode>
pack-priv int
pack-priv SortedSet<Integer>

Constructor Summary

AccessConstructor and Description
pack-priv
RBBIStateDescriptor(int maxInputSymbol)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fAcceptingback to summary
pack-priv int fAccepting
fDtranback to summary
pack-priv int[] fDtran
fLookAheadback to summary
pack-priv int fLookAhead
fMarkedback to summary
pack-priv boolean fMarked
fPositionsback to summary
pack-priv Set<RBBINode> fPositions
fTagsIdxback to summary
pack-priv int fTagsIdx
fTagValsback to summary
pack-priv SortedSet<Integer> fTagVals

Constructor Detail

RBBIStateDescriptorback to summary
pack-priv RBBIStateDescriptor(int maxInputSymbol)