Note
Upstream work insures that this class will never see a content model with PCDATA in it. Any model with PCDATA is 'mixed' and is handled via the MixedContentModel class since mixed models are very constrained in form and easily handled via a special case. This also makes implementation of this class much easier.
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean | DEBUG_VALIDATE_CONTENT
Set to true to debug content model validation. |
| private QName[] | fElemMap
This is the map of unique input symbol elements to indices into each state's per-input symbol transition table entry. |
| private int | fElemMapSize
The element map size. |
| private int[] | fElemMapType
This is a map of whether the element map contains information related to ANY models. |
| private boolean | fEmptyContentIsValid
Flag that indicates that even though we have a "complicated" content model, it is valid to have no content. |
| private int | fEOCPos
The NFA position of the special EOC (end of content) node. |
| private static String | fEOCString
End-of-content string. |
| private static String | fEpsilonString
Epsilon string. |
| private boolean[] | fFinalStateFlags
This is an array of booleans, one per state (there are fTransTableSize states in the DFA) that indicates whether that state is a final state. |
| private CMStateSet[] | fFollowList
The list of follow positions for each NFA position (i.e. for each non-epsilon leaf node.) This is only used during the building of the DFA, and is let go afterwards. |
| private CMNode | fHeadNode
This is the head node of our intermediate representation. |
| private int | fLeafCount
The count of leaf nodes. |
| private CMLeaf[] | fLeafList
An array of non-epsilon leaf nodes, which is used during the DFA build operation, then dropped. |
| private int[] | fLeafListType
Array mapping ANY types to the leaf list. |
| private boolean | fMixed
Boolean to distinguish Schema Mixed Content |
| private final QName | fQName
Temporary qualified name. |
| private int[][] | fTransTable
This is the transition table that is the main by product of all of the effort here. |
| private int | fTransTableSize
The number of valid entries in the transition table, and in the other related tables such as fFinalStateFlags. |
| Access | Constructor and Description |
|---|---|
| public | DFAContentModel(CMNode
The syntax tree of the content model. syntaxTree, int The number of leaves. leafCount, boolean mixed)Constructs a DFA content model. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | |
| private int[] | makeDefStateList()
-1 is used to represent bad transitions in the transition table entry for each state. |
| private int | |
| public int | Returns: The value -1 if fully valid, else the 0 based index of the child that first failed. If the value returned is equal to the number of children, then the specified children are valid but additional content is required to reach a valid ending state.The children of this element. Each integer is an index within
the children, int StringPool of the child element name. An index
of -1 is used to indicate an occurrence of non-whitespace character
data.Offset into the array where the children starts. offset, int The number of entries in the length)children array.Implements com. Check that the specified content is valid according to this content model. |
| DEBUG_VALIDATE_CONTENT | back to summary |
|---|---|
| private static final boolean DEBUG_VALIDATE_CONTENT Set to true to debug content model validation. | |
| fElemMap | back to summary |
|---|---|
| private QName[] fElemMap This is the map of unique input symbol elements to indices into each state's per-input symbol transition table entry. This is part of the built DFA information that must be kept around to do the actual validation. | |
| fElemMapSize | back to summary |
|---|---|
| private int fElemMapSize The element map size. | |
| fElemMapType | back to summary |
|---|---|
| private int[] fElemMapType This is a map of whether the element map contains information related to ANY models. | |
| fEmptyContentIsValid | back to summary |
|---|---|
| private boolean fEmptyContentIsValid Flag that indicates that even though we have a "complicated" content model, it is valid to have no content. In other words, all parts of the content model are optional. For example:
<!ELEMENT AllOptional (Optional*,NotRequired?)>
| |
| fEOCPos | back to summary |
|---|---|
| private int fEOCPos The NFA position of the special EOC (end of content) node. This is saved away since it's used during the DFA build. | |
| fEOCString | back to summary |
|---|---|
| private static String fEOCString End-of-content string. | |
| fEpsilonString | back to summary |
|---|---|
| private static String fEpsilonString Epsilon string. | |
| fFinalStateFlags | back to summary |
|---|---|
| private boolean[] fFinalStateFlags This is an array of booleans, one per state (there are fTransTableSize states in the DFA) that indicates whether that state is a final state. | |
| fFollowList | back to summary |
|---|---|
| private CMStateSet[] fFollowList The list of follow positions for each NFA position (i.e. for each non-epsilon leaf node.) This is only used during the building of the DFA, and is let go afterwards. | |
| fHeadNode | back to summary |
|---|---|
| private CMNode fHeadNode This is the head node of our intermediate representation. It is only non-null during the building of the DFA (just so that it does not have to be passed all around.) Once the DFA is built, this is no longer required so its nulled out. | |
| fLeafCount | back to summary |
|---|---|
| private int fLeafCount The count of leaf nodes. This is an important number that set some limits on the sizes of data structures in the DFA process. | |
| fLeafList | back to summary |
|---|---|
| private CMLeaf[] fLeafList An array of non-epsilon leaf nodes, which is used during the DFA build operation, then dropped. | |
| fLeafListType | back to summary |
|---|---|
| private int[] fLeafListType Array mapping ANY types to the leaf list. | |
| fMixed | back to summary |
|---|---|
| private boolean fMixed Boolean to distinguish Schema Mixed Content | |
| fQName | back to summary |
|---|---|
| private final QName fQName Temporary qualified name. | |
| fTransTable | back to summary |
|---|---|
| private int[][] fTransTable This is the transition table that is the main by product of all of the effort here. It is an array of arrays of ints. The first dimension is the number of states we end up with in the DFA. The second dimensions is the number of unique elements in the content model (fElemMapSize). Each entry in the second dimension indicates the new state given that input for the first dimension's start state. The fElemMap array handles mapping from element indexes to positions in the second dimension of the transition table. | |
| fTransTableSize | back to summary |
|---|---|
| private int fTransTableSize The number of valid entries in the transition table, and in the other related tables such as fFinalStateFlags. | |
| DFAContentModel | back to summary |
|---|---|
| public DFAContentModel(CMNode syntaxTree, int leafCount, boolean mixed) Constructs a DFA content model.
| |
| buildDFA | back to summary |
|---|---|
| private void buildDFA(CMNode syntaxTree) Builds the internal DFA transition table from the given syntax tree.
| |
| calcFollowList | back to summary |
|---|---|
| private void calcFollowList(CMNode nodeCur) Calculates the follow list of the current node.
| |
| dumpTree | back to summary |
|---|---|
| private void dumpTree(CMNode nodeCur, int level) Dumps the tree of the current node to standard output.
| |
| makeDefStateList | back to summary |
|---|---|
| private int[] makeDefStateList() -1 is used to represent bad transitions in the transition table entry for each state. So each entry is initialized to an all -1 array. This method creates a new entry and initializes it. | |
| postTreeBuildInit | back to summary |
|---|---|
| private int postTreeBuildInit(CMNode nodeCur, int curIndex) Post tree build initialization. | |
| validate | back to summary |
|---|---|
| public int validate(QName[] children, int offset, int length) Implements com. Check that the specified content is valid according to this content model. This method can also be called to do 'what if' testing of content models just to see if they would be valid. A value of -1 in the children array indicates a PCDATA node. All other indexes will be positive and represent child elements. The count can be zero, since some elements have the EMPTY content model and that must be confirmed.
| |