W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2008

2002/css-validator/org/w3c/css/css StyleSheet.java,1.14,1.15

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 28 Mar 2008 16:36:48 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JfHZQ-0002Wp-75@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/css
In directory hutz:/tmp/cvs-serv9611/w3c/css/css

Modified Files:
	StyleSheet.java 
Log Message:
optimization, using arrays instead of enumeration in findConflict

Index: StyleSheet.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheet.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- StyleSheet.java	20 Mar 2008 14:50:50 -0000	1.14
+++ StyleSheet.java	28 Mar 2008 16:36:46 -0000	1.15
@@ -171,13 +171,15 @@
      * Find all conflicts for this style sheet.
      */
     public void findConflicts(ApplContext ac) {
-	for (Enumeration e = getRules().elements(); e.hasMoreElements();) {
-	    CssSelectors sel = (CssSelectors) e.nextElement();
-	    sel.markAsFinal();
+	Hashtable rules = getRules();
+	CssSelectors[] all = new CssSelectors[rules.size()];
+	all = (CssSelectors[]) rules.values().toArray(all);
+	for (int i = 0; i< all.length; i++) {
+	    all[i].markAsFinal();
 	}
-	for (Enumeration e = getRules().elements(); e.hasMoreElements();) {
-	    CssSelectors sel = (CssSelectors) e.nextElement();
-	    sel.findConflicts(ac, warnings, getRules().elements());
+	for (int i = 0; i< all.length; i++) {
+	    CssSelectors sel = all[i];
+	    sel.findConflicts(ac, warnings, all);
 	}
     }
 
Received on Friday, 28 March 2008 16:37:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:00 GMT