< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2RTFDTM.java

Print this page


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Oct 2017
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xml.internal.dtm.ref.sax2dtm;
  23 


  41  * had to be deoptimized to support this mode of operation, and an
  42  * explicit mechanism for obtaining the Node Handle of the root node
  43  * has been provided.
  44  *
  45  * 2) A stack of these documents is maintained, allowing us to "tail-prune" the
  46  * most recently added trees off the end of the DTM as stylesheet elements
  47  * (and thus variable contexts) are exited.
  48  *
  49  * PLEASE NOTE that this class may be _heavily_ dependent upon the
  50  * internals of the SAX2DTM superclass, and must be maintained in
  51  * parallel with that code.  Arguably, they should be conditionals
  52  * within a single class... but they have deen separated for
  53  * performance reasons. (In fact, one could even argue about which is
  54  * the superclass and which is the subclass; the current arrangement
  55  * is as much about preserving stability of existing code during
  56  * development as anything else.)
  57  *
  58  * %REVIEW% In fact, since the differences are so minor, I think it
  59  * may be possible/practical to fold them back into the base
  60  * SAX2DTM. Consider that as a future code-size optimization.
  61  * */


  62 public class SAX2RTFDTM extends SAX2DTM
  63 {
  64   /** Set true to monitor SAX events and similar diagnostic info. */
  65   private static final boolean DEBUG = false;
  66 
  67   /** Most recently started Document, or null if the DTM is empty.  */
  68   private int m_currentDocumentNode=NULL;
  69 
  70   /** Tail-pruning mark: Number of nodes in use */
  71   IntStack mark_size=new IntStack();
  72   /** Tail-pruning mark: Number of data items in use */
  73   IntStack mark_data_size=new IntStack();
  74   /** Tail-pruning mark: Number of size-of-data fields in use */
  75   IntStack mark_char_size=new IntStack();
  76   /** Tail-pruning mark: Number of dataOrQName slots in use */
  77   IntStack mark_doq_size=new IntStack();
  78   /** Tail-pruning mark: Number of namespace declaration sets in use
  79    * %REVIEW% I don't think number of NS sets is ever different from number
  80    * of NS elements. We can probabably reduce these to a single stack and save
  81    * some storage.


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xml.internal.dtm.ref.sax2dtm;
  22 


  40  * had to be deoptimized to support this mode of operation, and an
  41  * explicit mechanism for obtaining the Node Handle of the root node
  42  * has been provided.
  43  *
  44  * 2) A stack of these documents is maintained, allowing us to "tail-prune" the
  45  * most recently added trees off the end of the DTM as stylesheet elements
  46  * (and thus variable contexts) are exited.
  47  *
  48  * PLEASE NOTE that this class may be _heavily_ dependent upon the
  49  * internals of the SAX2DTM superclass, and must be maintained in
  50  * parallel with that code.  Arguably, they should be conditionals
  51  * within a single class... but they have deen separated for
  52  * performance reasons. (In fact, one could even argue about which is
  53  * the superclass and which is the subclass; the current arrangement
  54  * is as much about preserving stability of existing code during
  55  * development as anything else.)
  56  *
  57  * %REVIEW% In fact, since the differences are so minor, I think it
  58  * may be possible/practical to fold them back into the base
  59  * SAX2DTM. Consider that as a future code-size optimization.
  60  *
  61  * @LastModified: Oct 2017
  62  */
  63 public class SAX2RTFDTM extends SAX2DTM
  64 {
  65   /** Set true to monitor SAX events and similar diagnostic info. */
  66   private static final boolean DEBUG = false;
  67 
  68   /** Most recently started Document, or null if the DTM is empty.  */
  69   private int m_currentDocumentNode=NULL;
  70 
  71   /** Tail-pruning mark: Number of nodes in use */
  72   IntStack mark_size=new IntStack();
  73   /** Tail-pruning mark: Number of data items in use */
  74   IntStack mark_data_size=new IntStack();
  75   /** Tail-pruning mark: Number of size-of-data fields in use */
  76   IntStack mark_char_size=new IntStack();
  77   /** Tail-pruning mark: Number of dataOrQName slots in use */
  78   IntStack mark_doq_size=new IntStack();
  79   /** Tail-pruning mark: Number of namespace declaration sets in use
  80    * %REVIEW% I don't think number of NS sets is ever different from number
  81    * of NS elements. We can probabably reduce these to a single stack and save
  82    * some storage.


< prev index next >