xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/dom DOMConfigurationImpl.java
Date Wed, 11 Feb 2004 16:57:28 GMT
mrglavas    2004/02/11 08:57:28

  Modified:    java/src/org/apache/xerces/parsers XML11Configuration.java
                        BasicParserConfiguration.java
               java/src/org/apache/xerces/util
                        ParserConfigurationSettings.java
               java/src/org/apache/xerces/dom DOMConfigurationImpl.java
  Log:
  Performance: Replace some Vectors with unsynchronized
  ArrayLists.  We don't require thread-safety in our
  configurations so this should speed us up a bit on reset.
  
  Revisit for replacing Hashtables with unsynch'd 
  Hashmaps. Hashmaps allow null entries so we need to 
  be careful in how we use them.
  
  Revision  Changes    Path
  1.15      +22 -21    xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java
  
  Index: XML11Configuration.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XML11Configuration.java	26 Jan 2004 17:28:10 -0000	1.14
  +++ XML11Configuration.java	11 Feb 2004 16:57:28 -0000	1.15
  @@ -58,6 +58,7 @@
   package org.apache.xerces.parsers;
   
   import java.io.IOException;
  +import java.util.ArrayList;
   import java.util.Hashtable;
   import java.util.Locale;
   import java.util.Vector;
  @@ -294,13 +295,13 @@
   	protected Locale fLocale;
   
   	/** XML 1.0 Components. */
  -	protected Vector fComponents;
  +	protected ArrayList fComponents;
       
   	/** XML 1.1. Components. */
  -	protected Vector fXML11Components = null;
  +	protected ArrayList fXML11Components = null;
   	
   	/** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */
  -	protected Vector fCommonComponents = null;
  +	protected ArrayList fCommonComponents = null;
   
   	/** The document handler. */
   	protected XMLDocumentHandler fDocumentHandler;
  @@ -450,15 +451,15 @@
   
   		// create a vector to hold all the components in use
   		// XML 1.0 specialized components
  -		fComponents = new Vector();
  +		fComponents = new ArrayList();
   		// XML 1.1 specialized components
  -		fXML11Components = new Vector();
  +		fXML11Components = new ArrayList();
   		// Common components for XML 1.1. and XML 1.0
  -		fCommonComponents = new Vector();
  +		fCommonComponents = new ArrayList();
   
   		// create storage for recognized features and properties
  -		fRecognizedFeatures = new Vector();
  -		fRecognizedProperties = new Vector();
  +		fRecognizedFeatures = new ArrayList();
  +		fRecognizedProperties = new ArrayList();
   
   		// create table for features and properties
   		fFeatures = new Hashtable();
  @@ -886,20 +887,20 @@
   		// forward to every XML 1.0 component
   		int count = fComponents.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +			XMLComponent c = (XMLComponent) fComponents.get(i);
   			c.setFeature(featureId, state);
   		}
   		// forward it to common components
   		count = fCommonComponents.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fCommonComponents.elementAt(i);
  +			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
   			c.setFeature(featureId, state);
   		}
   				
   		// forward to every XML 1.1 component
   		count = fXML11Components.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fXML11Components.elementAt(i);
  +			XMLComponent c = (XMLComponent) fXML11Components.get(i);
   			try{            
   				c.setFeature(featureId, state);
   			}
  @@ -924,19 +925,19 @@
   		// forward to every XML 1.0 component
   		int count = fComponents.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +			XMLComponent c = (XMLComponent) fComponents.get(i);
   			c.setProperty(propertyId, value);
   		}
   		// forward it to every common Component
   		count = fCommonComponents.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fCommonComponents.elementAt(i);
  +			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
   			c.setProperty(propertyId, value);
   		}
   		// forward it to every XML 1.1 component
   		count = fXML11Components.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fXML11Components.elementAt(i);
  +			XMLComponent c = (XMLComponent) fXML11Components.get(i);
   			try{			
   				c.setProperty(propertyId, value);
   			}
  @@ -962,7 +963,7 @@
   	protected void reset() throws XNIException {
   		int count = fComponents.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +			XMLComponent c = (XMLComponent) fComponents.get(i);
   			c.reset(this);
   		}
   
  @@ -975,7 +976,7 @@
   		// reset common components
   		int count = fCommonComponents.size();
   		for (int i = 0; i < count; i++) {
  -			XMLComponent c = (XMLComponent) fCommonComponents.elementAt(i);
  +			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
   			c.reset(this);
   		}
   
  @@ -989,7 +990,7 @@
   		// reset every component
   		int count = fXML11Components.size();
   		for (int i = 0; i < count; i++) {			
  -			XMLComponent c = (XMLComponent) fXML11Components.elementAt(i);
  +			XMLComponent c = (XMLComponent) fXML11Components.get(i);
   			c.reset(this);
   		}
   
  @@ -1398,7 +1399,7 @@
           if (fComponents.contains(component)) {
               return;
           }
  -        fComponents.addElement(component);
  +        fComponents.add(component);
           addRecognizedParamsAndSetDefaults(component);
   	
       } // addComponent(XMLComponent)
  @@ -1416,7 +1417,7 @@
           if (fCommonComponents.contains(component)) {
               return;
           }
  -        fCommonComponents.addElement(component);
  +        fCommonComponents.add(component);
           addRecognizedParamsAndSetDefaults(component);
   
       } // addCommonComponent(XMLComponent)
  @@ -1434,7 +1435,7 @@
           if (fXML11Components.contains(component)) {
               return;
           }
  -        fXML11Components.addElement(component);
  +        fXML11Components.add(component);
           addRecognizedParamsAndSetDefaults(component);
           
       } // addXML11Component(XMLComponent)
  
  
  
  1.21      +10 -10    xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java
  
  Index: BasicParserConfiguration.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- BasicParserConfiguration.java	26 Jan 2004 17:28:10 -0000	1.20
  +++ BasicParserConfiguration.java	11 Feb 2004 16:57:28 -0000	1.21
  @@ -58,9 +58,9 @@
   package org.apache.xerces.parsers;
   
   import java.io.IOException;
  +import java.util.ArrayList;
   import java.util.Hashtable;
   import java.util.Locale;
  -import java.util.Vector;
   
   import org.apache.xerces.impl.Constants;
   import org.apache.xerces.util.ParserConfigurationSettings;
  @@ -190,7 +190,7 @@
       protected Locale fLocale;
   
       /** Components. */
  -    protected Vector fComponents;
  +    protected ArrayList fComponents;
   
       // handlers
   
  @@ -236,11 +236,11 @@
           super(parentSettings);
   
           // create a vector to hold all the components in use
  -        fComponents = new Vector();
  +        fComponents = new ArrayList();
   
           // create storage for recognized features and properties
  -        fRecognizedFeatures = new Vector();
  -        fRecognizedProperties = new Vector();
  +        fRecognizedFeatures = new ArrayList();
  +        fRecognizedProperties = new ArrayList();
   
           // create table for features and properties
           fFeatures = new Hashtable();
  @@ -292,7 +292,7 @@
           if (fComponents.contains(component)) {
               return;
           }
  -        fComponents.addElement(component);
  +        fComponents.add(component);
   
           // register component's recognized features
           String[] recognizedFeatures = component.getRecognizedFeatures();
  @@ -482,7 +482,7 @@
           // forward to every component
           int count = fComponents.size();
           for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +            XMLComponent c = (XMLComponent) fComponents.get(i);
               c.setFeature(featureId, state);
           }
           // save state if noone "objects"
  @@ -502,7 +502,7 @@
           // forward to every component
           int count = fComponents.size();
           for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +            XMLComponent c = (XMLComponent) fComponents.get(i);
               c.setProperty(propertyId, value);
           }
   
  @@ -540,7 +540,7 @@
           // reset every component
           int count = fComponents.size();
           for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +            XMLComponent c = (XMLComponent) fComponents.get(i);
               c.reset(this);
           }
   
  
  
  
  1.8       +8 -7      xml-xerces/java/src/org/apache/xerces/util/ParserConfigurationSettings.java
  
  Index: ParserConfigurationSettings.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/ParserConfigurationSettings.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ParserConfigurationSettings.java	1 Dec 2003 05:06:18 -0000	1.7
  +++ ParserConfigurationSettings.java	11 Feb 2004 16:57:28 -0000	1.8
  @@ -57,6 +57,7 @@
   
   package org.apache.xerces.util;
   
  +import java.util.ArrayList;
   import java.util.Hashtable;
   import java.util.Vector;
   
  @@ -92,13 +93,13 @@
       // data
   
       /** Recognized properties. */
  -    protected Vector fRecognizedProperties;
  +    protected ArrayList fRecognizedProperties;
   
       /** Properties. */
       protected Hashtable fProperties;
   
       /** Recognized features. */
  -    protected Vector fRecognizedFeatures;
  +    protected ArrayList fRecognizedFeatures;
   
       /** Features. */
       protected Hashtable fFeatures;
  @@ -122,8 +123,8 @@
       public ParserConfigurationSettings(XMLComponentManager parent) {
   
           // create storage for recognized features and properties
  -        fRecognizedFeatures = new Vector();
  -        fRecognizedProperties = new Vector();
  +        fRecognizedFeatures = new ArrayList();
  +        fRecognizedProperties = new ArrayList();
   
           // create table for features and properties
           fFeatures = new Hashtable();
  @@ -152,7 +153,7 @@
           for (int i = 0; i < featureIdsCount; i++) {
               String featureId = featureIds[i];
               if (!fRecognizedFeatures.contains(featureId)) {
  -                fRecognizedFeatures.addElement(featureId);
  +                fRecognizedFeatures.add(featureId);
               }
           }
   
  @@ -194,7 +195,7 @@
           for (int i = 0; i < propertyIdsCount; i++) {
               String propertyId = propertyIds[i];
               if (!fRecognizedProperties.contains(propertyId)) {
  -                fRecognizedProperties.addElement(propertyId);
  +                fRecognizedProperties.add(propertyId);
               }
           }
   
  
  
  
  1.20      +8 -7      xml-xerces/java/src/org/apache/xerces/dom/DOMConfigurationImpl.java
  
  Index: DOMConfigurationImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMConfigurationImpl.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DOMConfigurationImpl.java	29 Jan 2004 21:13:09 -0000	1.19
  +++ DOMConfigurationImpl.java	11 Feb 2004 16:57:28 -0000	1.20
  @@ -58,6 +58,7 @@
   package org.apache.xerces.dom;
   
   import java.io.IOException;
  +import java.util.ArrayList;
   import java.util.Hashtable;
   import java.util.Locale;
   import java.util.Vector;
  @@ -200,7 +201,7 @@
       protected SymbolTable fSymbolTable;
   
       /** Components. */
  -    protected Vector fComponents;
  +    protected ArrayList fComponents;
   
       protected ValidationManager fValidationManager;
   
  @@ -248,8 +249,8 @@
           super(parentSettings);
   
           // create storage for recognized features and properties
  -        fRecognizedFeatures = new Vector();
  -        fRecognizedProperties = new Vector();
  +        fRecognizedFeatures = new ArrayList();
  +        fRecognizedProperties = new ArrayList();
   
           // create table for features and properties
           fFeatures = new Hashtable();
  @@ -302,7 +303,7 @@
           }
           fSymbolTable = symbolTable;
   
  -        fComponents = new Vector();
  +        fComponents = new ArrayList();
   
           setProperty(SYMBOL_TABLE, fSymbolTable);
           fErrorReporter = new XMLErrorReporter();
  @@ -1027,7 +1028,7 @@
   
           int count = fComponents.size();
           for (int i = 0; i < count; i++) {
  -            XMLComponent c = (XMLComponent) fComponents.elementAt(i);
  +            XMLComponent c = (XMLComponent) fComponents.get(i);
               c.reset(this);
           }
   
  @@ -1081,7 +1082,7 @@
           if (fComponents.contains(component)) {
               return;
           }
  -        fComponents.addElement(component);
  +        fComponents.add(component);
   
           // register component's recognized features
           String[] recognizedFeatures = component.getRecognizedFeatures();
  
  
  

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


Mime
View raw message