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

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 UTC