2002/css-validator/org/w3c/css/properties/css1 Css1Style.java,1.8,1.9

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

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

Index: Css1Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/Css1Style.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Css1Style.java	13 Sep 2007 10:11:41 -0000	1.8
+++ Css1Style.java	28 Mar 2008 16:36:46 -0000	1.9
@@ -2527,7 +2527,7 @@
      * @param allSelectors All contexts is the entire style sheet.
      */
     public void findConflicts(ApplContext ac, Warnings warnings, 
-	    CssSelectors selector, Enumeration allSelectors) {
+	    CssSelectors selector, CssSelectors[] allSelectors) {
 	// if border-style == none, border-width should be 0
 	// @@ this is a horrible place to do this ...
 	cssBorder.check();
@@ -2567,9 +2567,8 @@
 	    CssColor colorCSS3 = cssColor;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    while (colorCSS3 == null && allSelectors.hasMoreElements()) {
-		CssSelectors sel = 
-			(CssSelectors) allSelectors.nextElement();		
+	    for (int i=0;(colorCSS3 == null) && (i<allSelectors.length); i++) {
+		CssSelectors sel = allSelectors[i];	
 		if(sel.toString().equals(selector.toString())) {
 		    colorCSS3 = ((Css1Style) sel.getStyle()).cssColor;
 		}
@@ -2652,9 +2651,8 @@
 	    CssColorCSS1 colorCSS1 = cssColorCSS1;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    while (colorCSS1 == null && allSelectors.hasMoreElements()) {
-		CssSelectors sel = 
-			(CssSelectors) allSelectors.nextElement();		
+	    for (int i=0; (colorCSS1 == null) && i < allSelectors.length; i++) {
+		CssSelectors sel = allSelectors[i];		
 		if(sel.toString().equals(selector.toString())) {
 		    colorCSS1 = ((Css1Style) sel.getStyle()).cssColorCSS1;
 		}
@@ -2725,9 +2723,8 @@
 	    CssColorCSS2 colorCSS2 = cssColorCSS2;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    while (colorCSS2 == null && allSelectors.hasMoreElements()) {
-		CssSelectors sel = 
-			(CssSelectors) allSelectors.nextElement();		
+	    for (int i=0; (colorCSS2 == null) && (i<allSelectors.length); i++) {
+		CssSelectors sel = allSelectors[i];		
 		if(sel.toString().equals(selector.toString())) {
 		    colorCSS2 = ((Css1Style) sel.getStyle()).cssColorCSS2;
 		}
@@ -2803,13 +2800,12 @@
 	    CssValue backgroundColor = null;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    while (allSelectors.hasMoreElements()) {
-		CssSelectors sel = 
-			(CssSelectors) allSelectors.nextElement();
+	    for (int i=0; i<allSelectors.length; i++) {
+		CssSelectors sel = allSelectors[i];
 		Css1Style style =
 		    (Css1Style) sel.getStyle();
 		if(backgroundColor == null &&
-			sel.toString().equals(selector.toString())) {
+		   sel.toString().equals(selector.toString())) {
 		    backgroundColor = ((Css1Style) sel.getStyle()).
 		    	cssBackground.getColor();
 		}
@@ -2817,7 +2813,7 @@
 		    if (style.cssBackground.getColor().equals(cssColor.getColor())) {
 			warnings.addWarning(new Warning(cssColor, "same-colors2", 1,
 				new String[] { style.cssBackground.color.getSelectors().toString(),
-				cssColor.getSelectors().toString() }, ac));
+					       cssColor.getSelectors().toString() }, ac));
 		    }
 		}
 	    }
@@ -2831,11 +2827,9 @@
 	    CssValue backgroundColor = null;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    while (allSelectors.hasMoreElements()) {
-		CssSelectors sel = 
-			(CssSelectors) allSelectors.nextElement();
-		Css1Style style =
-		    (Css1Style) sel.getStyle();
+	    for (int i=0; i<allSelectors.length; i++) {
+		CssSelectors sel = allSelectors[i];
+		Css1Style style = (Css1Style) sel.getStyle();
 		if(backgroundColor == null &&
 			sel.toString().equals(selector.toString())) {
 		    backgroundColor = ((Css1Style) sel.getStyle()).
@@ -2859,11 +2853,9 @@
 	    CssValue backgroundColor = null;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    while (allSelectors.hasMoreElements()) {
-		CssSelectors sel = 
-			(CssSelectors) allSelectors.nextElement();		
-		Css1Style style =
-		    (Css1Style) sel.getStyle();
+	    for (int i=0; i<allSelectors.length; i++) {
+		CssSelectors sel = allSelectors[i];
+		Css1Style style = (Css1Style) sel.getStyle();
 		if(backgroundColor == null && 
 			sel.toString().equals(selector.toString())) {
 		    backgroundColor = ((Css1Style) sel.getStyle()).

Received on Friday, 28 March 2008 16:37:23 UTC