xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mk...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom DOMAdapter.java SAXImpl.java
Date Fri, 07 Mar 2003 18:36:32 GMT
mkwan       2003/03/07 10:36:32

  Modified:    java/src/org/apache/xalan/xsltc/dom Tag: XSLTC_DTM
                        DOMAdapter.java SAXImpl.java
  Log:
  XSLTC_DTM performance work
  Small tweaks in DOMAdapter. Invoking a final method is generally faster than
  invoking a method via interface.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.10.17 +72 -29    xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java
  
  Index: DOMAdapter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java,v
  retrieving revision 1.11.10.16
  retrieving revision 1.11.10.17
  diff -u -r1.11.10.16 -r1.11.10.17
  --- DOMAdapter.java	6 Mar 2003 21:22:00 -0000	1.11.10.16
  +++ DOMAdapter.java	7 Mar 2003 18:36:31 -0000	1.11.10.17
  @@ -178,7 +178,14 @@
       }
       
       public DTMAxisIterator getChildren(final int node) {
  -        DTMAxisIterator iterator = _dom.getChildren(node);
  +        if (_saxImpl != null) {
  +            return _saxImpl.getChildren(node);
  +        }
  +        else {
  +            DTMAxisIterator iterator = _dom.getChildren(node);
  +            return iterator.setStartNode(node);
  +        }
  +        //DTMAxisIterator iterator = _dom.getChildren(node);
           /*
           if (_filter != null) {
               if (_domImpl != null)
  @@ -189,7 +196,7 @@
                                                         _filter);
           }
           */
  -        return iterator.setStartNode(node);
  +        //return iterator.setStartNode(node);
       }
   
       public void setFilter(StripFilter filter) {
  @@ -199,9 +206,16 @@
       public DTMAxisIterator getTypedChildren(final int type) {
         final int[] reverse = getReverse();
   
  -      DTMAxisIterator iterator = (reverse != null)
  -                                  ? _dom.getTypedChildren(reverse[type])
  -                                  : _dom.getTypedChildren(type);
  +      if (_saxImpl != null) {
  +          return _saxImpl.getTypedChildren(reverse[type]);
  +      }
  +      else if (_domImpl != null) {
  +          return _domImpl.getTypedChildren(reverse[type]);
  +      }
  +      else {
  +          return _dom.getTypedChildren(type);
  +      }
  +      
         /*
         if (_filter != null && reverse[type] == DTM.TEXT_NODE) {
         	if (_domImpl != null) {
  @@ -211,7 +225,7 @@
           }
         }
         */
  -      return iterator;
  +      //return iterator;
       }
   
       public DTMAxisIterator getNamespaceAxisIterator(final int axis,
  @@ -220,7 +234,14 @@
       }
   
       public DTMAxisIterator getAxisIterator(final int axis) {
  -      DTMAxisIterator iterator = _dom.getAxisIterator(axis);
  +        if (_saxImpl != null) {
  +            return _saxImpl.getAxisIterator(axis);
  +        }
  +        else {
  +            return _dom.getAxisIterator(axis);
  +        }
  +        
  +      //DTMAxisIterator iterator = _dom.getAxisIterator(axis);
         /*
         if (_filter != null)
         {
  @@ -229,25 +250,27 @@
                     : _saxImpl.strippingIterator(iterator, getMapping(), _filter);
         }
         */
  -      return iterator;
  +      //return iterator;
       }
       
       public DTMAxisIterator getTypedAxisIterator(final int axis,
                                                   final int type) {
  -      DTMAxisIterator iterator;
  +      //DTMAxisIterator iterator;
         final int[] reverse = getReverse();
   
         if (axis == Axis.NAMESPACE) {
             short[] NSReverse = getNSReverse();
             if (type == NO_TYPE || type > NSReverse.length) {
  -             iterator = _dom.getAxisIterator(axis);
  +             return _dom.getAxisIterator(axis);
             } else {
  -             iterator = _dom.getTypedAxisIterator(axis, NSReverse[type]);
  +             return _dom.getTypedAxisIterator(axis, NSReverse[type]);
             }
  +      } else if (_saxImpl != null) {
  +          return _saxImpl.getTypedAxisIterator(axis, reverse[type]);
  +      } else if (_domImpl != null) {
  +          return _domImpl.getTypedAxisIterator(axis, reverse[type]);
         } else {
  -          iterator = (reverse != null)
  -                      ? _dom.getTypedAxisIterator(axis, reverse[type])
  -                      : _dom.getTypedAxisIterator(axis, type);
  +          return _dom.getTypedAxisIterator(axis, type);
         }
         
         /*
  @@ -258,7 +281,7 @@
           
         }
         */
  -      return iterator;
  +      //return iterator;
       }
           
       public int getMultiDOMMask() {
  @@ -285,11 +308,11 @@
       }
       
       public int getExpandedTypeID(final int node) {
  -      if (_saxImpl != null) {
  -        return getMapping()[_saxImpl.getExpandedTypeID(node)];
  -      }
  -      else
  -        return getMapping()[_dom.getExpandedTypeID(node)];
  +        if (_saxImpl != null) {
  +            return getMapping()[_saxImpl.getExpandedTypeID(node)];
  +        }
  +        else
  +            return getMapping()[_dom.getExpandedTypeID(node)];
       }
   
       public int getNamespaceType(final int node) {
  @@ -301,7 +324,7 @@
       }
       
       public int getParent(final int node) {
  -      return _dom.getParent(node);
  +        return _dom.getParent(node);
       }
   
       public int getAttributeNode(final int type, final int element) {
  @@ -329,10 +352,15 @@
       }
       
       public String getStringValueX(final int node) 
  -    {
  -    	if (node == DTM.NULL)
  -    	return "";
  -      return _dom.getStringValueX(node);
  +    {    	
  +    	if (_saxImpl != null) {
  +            return _saxImpl.getStringValueX(node);
  +        }
  +        else {
  +            if (node == DTM.NULL)
  +    	        return "";
  +            return _dom.getStringValueX(node);
  +        }
       }
       
       public void copy(final int node, TransletOutputHandler handler)
  @@ -350,7 +378,12 @@
       public String shallowCopy(final int node, TransletOutputHandler handler)
   	throws TransletException 
       {
  -	    return _dom.shallowCopy(node, handler);
  +        if (_saxImpl != null) {
  +            return _saxImpl.shallowCopy(node, handler);
  +        }
  +        else {
  +            return _dom.shallowCopy(node, handler);
  +        }
       }
       
       public boolean lessThan(final int node1, final int node2) 
  @@ -361,7 +394,12 @@
       public void characters(final int textNode, TransletOutputHandler handler)
         throws TransletException 
       {
  -      _dom.characters(textNode, handler);
  +        if (_saxImpl != null) {
  +            _saxImpl.characters(textNode, handler);
  +        }
  +        else {
  +            _dom.characters(textNode, handler);
  +        }
       }
   
       public Node makeNode(int index) 
  @@ -452,7 +490,12 @@
        */ 
       public DOM getResultTreeFrag(int initSize, boolean isSimple)
       {
  -    	return _dom.getResultTreeFrag(initSize, isSimple);
  +    	if (_saxImpl != null) {
  +    	    return _saxImpl.getResultTreeFrag(initSize, isSimple);
  +    	}
  +    	else {
  +    	    return _dom.getResultTreeFrag(initSize, isSimple);
  +    	}
       }
       
       /**
  
  
  
  1.1.2.41  +3 -3      xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/SAXImpl.java
  
  Index: SAXImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/SAXImpl.java,v
  retrieving revision 1.1.2.40
  retrieving revision 1.1.2.41
  diff -u -r1.1.2.40 -r1.1.2.41
  --- SAXImpl.java	6 Mar 2003 20:42:32 -0000	1.1.2.40
  +++ SAXImpl.java	7 Mar 2003 18:36:31 -0000	1.1.2.41
  @@ -806,7 +806,7 @@
        */
       public DTMAxisIterator getIterator()
       {
  -	    return new SingletonIterator(getDocument());
  +        return new SingletonIterator(getDocument());
       }
   
        /**
  @@ -1548,7 +1548,7 @@
                   ? new ChildrenIterator()
                   : EMPTYITERATOR;
   */
  -      return new ChildrenIterator();
  +      return (new ChildrenIterator()).setStartNode(node);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message