Return-Path: Delivered-To: apmail-xml-xalan-cvs-archive@xml.apache.org Received: (qmail 79492 invoked by uid 500); 5 Sep 2001 15:49:04 -0000 Mailing-List: contact xalan-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: Delivered-To: mailing list xalan-cvs@xml.apache.org Received: (qmail 79464 invoked from network); 5 Sep 2001 15:49:04 -0000 Date: 5 Sep 2001 15:46:26 -0000 Message-ID: <20010905154626.91552.qmail@icarus.apache.org> From: jkesselm@apache.org To: xml-xalan-cvs@apache.org Subject: cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jkesselm 01/09/05 08:46:26 Modified: java/src/org/apache/xml/dtm/ref DTMDefaultBase.java java/src/org/apache/xml/dtm/ref/dom2dtm DOM2DTM.java java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java Log: Removed the code which precalculated node levels (depth in tree). This has been IFed out for some time, but was retained in case we wanted to go back to it. Since it seems we're happy with this choice, zapping it entirely saves a few more cycles. It's simple enough to recreate if we change our minds later. Revision Changes Path 1.19 +4 -26 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBase.java Index: DTMDefaultBase.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBase.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- DTMDefaultBase.java 2001/08/28 19:23:23 1.18 +++ DTMDefaultBase.java 2001/09/05 15:46:26 1.19 @@ -90,12 +90,6 @@ */ public abstract class DTMDefaultBase implements DTM { - /** %OPT% %REVIEW% When true, don't build the m_level array; - * instead, support _level()/getLevel() by counting upward to the - * root. This is exposed because SAX2DTM and DOM2DTM should - * respond to it. */ - protected static final boolean DISABLE_PRECALC_LEVEL=true; - /** * The number of nodes, which is also used to determine the next * node index. @@ -105,12 +99,6 @@ /** The expanded names, one array element for each node. */ protected SuballocatedIntVector m_exptype; - /** levels deep, one array element for each node. - * - * %REVIEW% Used only when DISABLE_PRECALC_LEVEL is false! - */ - protected SuballocatedByteVector m_level; - /** First child values, one array element for each node. */ protected SuballocatedIntVector m_firstch; @@ -223,9 +211,6 @@ m_prevsib = new SuballocatedIntVector(m_initialblocksize); m_parent = new SuballocatedIntVector(m_initialblocksize); - if(!DISABLE_PRECALC_LEVEL) - m_level = new SuballocatedByteVector(m_initialblocksize); - m_mgr = mgr; m_documentBaseURI = (null != source) ? source.getSystemId() : null; m_dtmIdent = dtmIdentity; @@ -512,17 +497,10 @@ return NULL; } - if(DISABLE_PRECALC_LEVEL) - { - int i=0; - while(NULL != (identity=_parent(identity))) - ++i; - return i; - } - else - { - return m_level.elementAt(identity); - } + int i=0; + while(NULL != (identity=_parent(identity))) + ++i; + return i; } /** 1.16 +5 -16 xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java Index: DOM2DTM.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- DOM2DTM.java 2001/07/20 18:48:11 1.15 +++ DOM2DTM.java 2001/09/05 15:46:26 1.16 @@ -148,7 +148,7 @@ m_pos=m_root = domSource.getNode(); // Initialize DTM navigation m_last_parent=m_last_kid=NULL; - m_last_kid=addNode(m_root, 0, m_last_parent,m_last_kid, NULL); + m_last_kid=addNode(m_root, m_last_parent,m_last_kid, NULL); // Apparently the domSource root may not actually be the // Document node. If it's an Element node, we need to immediately @@ -169,7 +169,7 @@ // No need to force nodetype in this case; // addNode() will take care of switching it from // Attr to Namespace if necessary. - attrIndex=addNode(attrs.item(i),1,0,attrIndex,NULL); + attrIndex=addNode(attrs.item(i),0,attrIndex,NULL); m_firstch.setElementAt(DTM.NULL,attrIndex); } // Terminate list of attrs, and make sure they aren't @@ -188,7 +188,6 @@ * Construct the node map from the node. * * @param node The node that is to be added to the DTM. - * @param level The current level in the tree. * @param parentIndex The current parent index. * @param previousSibling The previous sibling index. * @param forceNodeType If not DTM.NULL, overrides the DOM node type. @@ -197,7 +196,7 @@ * * @return The index identity of the node that was added. */ - protected int addNode(Node node, int level, int parentIndex, + protected int addNode(Node node, int parentIndex, int previousSibling, int forceNodeType) { int nodeIndex = m_nodes.size(); @@ -239,12 +238,6 @@ m_nodes.addElement(node); - // Do casts here so that if we change the sizes, the changes are localized. - // %REVIEW% Remember to change this cast if we change - // m_level's type, or we may truncate values without warning! - if(!DTMDefaultBase.DISABLE_PRECALC_LEVEL) - m_level.addElement((byte)level); // setElementAt(level,nodeIndex)? - m_firstch.setElementAt(NOTPROCESSED,nodeIndex); m_nextsib.setElementAt(NOTPROCESSED,nodeIndex); m_prevsib.setElementAt(previousSibling,nodeIndex); @@ -520,10 +513,7 @@ // Inserting next. NOTE that we force the node type; for // coalesced Text, this records CDATASections adjacent to // ordinary Text as Text. - int level=0; - if(!DTMDefaultBase.DISABLE_PRECALC_LEVEL) - level=m_level.elementAt(m_last_parent)+1; - int nextindex=addNode(next,level,m_last_parent,m_last_kid, + int nextindex=addNode(next,m_last_parent,m_last_kid, nexttype); m_last_kid=nextindex; @@ -536,14 +526,13 @@ int attrsize=(attrs==null) ? 0 : attrs.getLength(); if(attrsize>0) { - int attrlevel=level+1; int attrIndex=NULL; // start with no previous sib for(int i=0;i