src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/models/XSDFACM.java

Print this page




 119      * build operation, then dropped.
 120      */
 121     private XSCMLeaf fLeafList[] = null;
 122 
 123     /** Array mapping ANY types to the leaf list. */
 124     private int fLeafListType[] = null;
 125 
 126     /**
 127      * This is the transition table that is the main by product of all
 128      * of the effort here. It is an array of arrays of ints. The first
 129      * dimension is the number of states we end up with in the DFA. The
 130      * second dimensions is the number of unique elements in the content
 131      * model (fElemMapSize). Each entry in the second dimension indicates
 132      * the new state given that input for the first dimension's start
 133      * state.
 134      * <p>
 135      * The fElemMap array handles mapping from element indexes to
 136      * positions in the second dimension of the transition table.
 137      */
 138     private int fTransTable[][] = null;

 139     /**
 140      * Array containing occurence information for looping states
 141      * which use counters to check minOccurs/maxOccurs.
 142      */
 143     private Occurence [] fCountingStates = null;
 144     static final class Occurence {
 145         final int minOccurs;
 146         final int maxOccurs;
 147         final int elemIndex;
 148         public Occurence (XSCMRepeatingLeaf leaf, int elemIndex) {
 149             minOccurs = leaf.getMinOccurs();
 150             maxOccurs = leaf.getMaxOccurs();
 151             this.elemIndex = elemIndex;
 152         }
 153         public String toString() {
 154             return "minOccurs=" + minOccurs
 155                 + ";maxOccurs=" +
 156                 ((maxOccurs != SchemaSymbols.OCCURRENCE_UNBOUNDED)
 157                         ? Integer.toString(maxOccurs) : "unbounded");
 158         }


 194 
 195     // temp variables
 196 
 197     //
 198     // Constructors
 199     //
 200 
 201     /**
 202      * Constructs a DFA content model.
 203      *
 204      * @param syntaxTree    The syntax tree of the content model.
 205      * @param leafCount     The number of leaves.
 206      *
 207      * @exception RuntimeException Thrown if DFA can't be built.
 208      */
 209 
 210    public XSDFACM(CMNode syntaxTree, int leafCount) {
 211 
 212         // Store away our index and pools in members
 213         fLeafCount = leafCount;

 214 
 215         //
 216         //  Create some string pool indexes that represent the names of some
 217         //  magical nodes in the syntax tree.
 218         //  (already done in static initialization...
 219         //
 220 
 221         //
 222         //  Ok, so lets grind through the building of the DFA. This method
 223         //  handles the high level logic of the algorithm, but it uses a
 224         //  number of helper classes to do its thing.
 225         //
 226         //  In order to avoid having hundreds of references to the error and
 227         //  string handlers around, this guy and all of his helper classes
 228         //  just throw a simple exception and we then pass it along.
 229         //
 230 
 231         if(DEBUG_VALIDATE_CONTENT) {
 232             XSDFACM.time -= System.currentTimeMillis();
 233         }




 119      * build operation, then dropped.
 120      */
 121     private XSCMLeaf fLeafList[] = null;
 122 
 123     /** Array mapping ANY types to the leaf list. */
 124     private int fLeafListType[] = null;
 125 
 126     /**
 127      * This is the transition table that is the main by product of all
 128      * of the effort here. It is an array of arrays of ints. The first
 129      * dimension is the number of states we end up with in the DFA. The
 130      * second dimensions is the number of unique elements in the content
 131      * model (fElemMapSize). Each entry in the second dimension indicates
 132      * the new state given that input for the first dimension's start
 133      * state.
 134      * <p>
 135      * The fElemMap array handles mapping from element indexes to
 136      * positions in the second dimension of the transition table.
 137      */
 138     private int fTransTable[][] = null;
 139 
 140     /**
 141      * Array containing occurence information for looping states
 142      * which use counters to check minOccurs/maxOccurs.
 143      */
 144     private Occurence [] fCountingStates = null;
 145     static final class Occurence {
 146         final int minOccurs;
 147         final int maxOccurs;
 148         final int elemIndex;
 149         public Occurence (XSCMRepeatingLeaf leaf, int elemIndex) {
 150             minOccurs = leaf.getMinOccurs();
 151             maxOccurs = leaf.getMaxOccurs();
 152             this.elemIndex = elemIndex;
 153         }
 154         public String toString() {
 155             return "minOccurs=" + minOccurs
 156                 + ";maxOccurs=" +
 157                 ((maxOccurs != SchemaSymbols.OCCURRENCE_UNBOUNDED)
 158                         ? Integer.toString(maxOccurs) : "unbounded");
 159         }


 195 
 196     // temp variables
 197 
 198     //
 199     // Constructors
 200     //
 201 
 202     /**
 203      * Constructs a DFA content model.
 204      *
 205      * @param syntaxTree    The syntax tree of the content model.
 206      * @param leafCount     The number of leaves.
 207      *
 208      * @exception RuntimeException Thrown if DFA can't be built.
 209      */
 210 
 211    public XSDFACM(CMNode syntaxTree, int leafCount) {
 212 
 213         // Store away our index and pools in members
 214         fLeafCount = leafCount;
 215         fIsCompactedForUPA = syntaxTree.isCompactedForUPA();
 216 
 217         //
 218         //  Create some string pool indexes that represent the names of some
 219         //  magical nodes in the syntax tree.
 220         //  (already done in static initialization...
 221         //
 222 
 223         //
 224         //  Ok, so lets grind through the building of the DFA. This method
 225         //  handles the high level logic of the algorithm, but it uses a
 226         //  number of helper classes to do its thing.
 227         //
 228         //  In order to avoid having hundreds of references to the error and
 229         //  string handlers around, this guy and all of his helper classes
 230         //  just throw a simple exception and we then pass it along.
 231         //
 232 
 233         if(DEBUG_VALIDATE_CONTENT) {
 234             XSDFACM.time -= System.currentTimeMillis();
 235         }