W3C home > Mailing lists > Public > www-validator-cvs@w3.org > January 2010

2002/css-validator/org/w3c/css/values CssAngle.java,1.8,1.9 CssDate.java,1.5,1.6 CssFunction.java,1.7,1.8 CssNumber.java,1.8,1.9 CssTime.java,1.6,1.7 HSL.java,1.6,1.7 HSLA.java,1.6,1.7 RGB.java,1.8,1.9 RGBA.java,1.7,1.8

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 06 Jan 2010 09:27:47 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1NSSB9-0002Ev-5T@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/values
In directory hutz:/tmp/cvs-serv8530/org/w3c/css/values

Modified Files:
	CssAngle.java CssDate.java CssFunction.java CssNumber.java 
	CssTime.java HSL.java HSLA.java RGB.java RGBA.java 
Log Message:
progress on background CSS3 shorthand property

Index: RGBA.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/RGBA.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- RGBA.java	5 Jan 2010 13:50:01 -0000	1.7
+++ RGBA.java	6 Jan 2010 09:27:45 -0000	1.8
@@ -17,8 +17,8 @@
 
 public class RGBA {
     String output = null;
-    int r,g,b;
-    float fr,fg,fb,a;
+    int r, g, b;
+    float fr, fg, fb, a;
 
     boolean percent = false;
 
@@ -37,52 +37,55 @@
     }
 
     public final void setRed(int r) {
-	this.r = r;
-	this.fr = r;
+        this.r = r;
+        this.fr = r;
     }
+
     public final void setRed(float fr) {
-	this.fr = fr;
+        this.fr = fr;
     }
 
     public final void setGreen(int g) {
-	this.g = g;
-	this.fg = g;
+        this.g = g;
+        this.fg = g;
     }
+
     public final void setGreen(float fg) {
-	this.fg = fg;
+        this.fg = fg;
     }
 
     public final void setBlue(int b) {
-	this.b = b;
-	this.fb = b;
+        this.b = b;
+        this.fb = b;
     }
+
     public final void setBlue(float fb) {
-	this.fb = fb;
+        this.fb = fb;
     }
 
     public final void setAlpha(float a) {
-	this.a = a;
+        this.a = a;
     }
 
     public boolean equals(RGBA other) {
-	if (other != null) {
-	    if (percent) {
-		if (other.percent) {
-		    return ((fr == other.fr) &&
-			    (fg == other.fg) &&
-			    (fb == other.fb) &&
-			    (a == other.a));
-		}
-	    } else {
-		if (!other.percent) {
-		    return ((r == other.r) &&
-			    (g == other.g) &&
-			    (b == other.b) &&
-			    (a == other.a));	    
-		}
-	    }
-	}
-	return false;
+        if (other != null) {
+            if (percent) {
+                if (other.percent) {
+                    return ((fr == other.fr) &&
+                            (fg == other.fg) &&
+                            (fb == other.fb) &&
+                            (a == other.a));
+                }
+            } else {
+                if (!other.percent) {
+                    return ((r == other.r) &&
+                            (g == other.g) &&
+                            (b == other.b) &&
+                            (a == other.a));
+                }
+            }
+        }
+        return false;
     }
 
     /**
@@ -93,45 +96,53 @@
 
     /**
      * Create a new RGBA with default values
+     * @param r the red channel
+     * @param g the green channel
+     * @param b the blue channel
+     * @param a the alpha channel
      */
     public RGBA(int r, int g, int b, float a) {
-	this.r = r;
-	this.g = g;
-	this.b = b;
-	this.a = a;
-	this.percent = false;
+        this.r = r;
+        this.g = g;
+        this.b = b;
+        this.a = a;
+        this.percent = false;
     }
 
     /**
+     * @param r the red channel
+     * @param g the green channel
+     * @param b the blue channel
+     * @param a the alpha channel
      * Create a new RGBA with default values
      */
     public RGBA(float r, float g, float b, float a) {
-	this.fr = r;
-	this.fg = g;
-	this.fb = b;
-	this.a = a;
-	this.percent = true;
+        this.fr = r;
+        this.fg = g;
+        this.fb = b;
+        this.a = a;
+        this.percent = true;
     }
-    
-    
+
+
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	if (output == null) {
-	    StringBuilder sb = new StringBuilder("rgba(");
-	    if (isPercent()) {
-		sb.append(Util.displayFloat(fr)).append("%, ");
-		sb.append(Util.displayFloat(fg)).append("%, ");
-		sb.append(Util.displayFloat(fb)).append("%, ");
-	    } else {
-		sb.append(r).append(", ");
-		sb.append(g).append(", ");
-		sb.append(b).append(", ");
-	    }
-	    sb.append(Util.displayFloat(a)).append(')');
-	    output = sb.toString();
-	} 
-	return output;
+        if (output == null) {
+            StringBuilder sb = new StringBuilder("rgba(");
+            if (isPercent()) {
+                sb.append(Util.displayFloat(fr)).append("%, ");
+                sb.append(Util.displayFloat(fg)).append("%, ");
+                sb.append(Util.displayFloat(fb)).append("%, ");
+            } else {
+                sb.append(r).append(", ");
+                sb.append(g).append(", ");
+                sb.append(b).append(", ");
+            }
+            sb.append(Util.displayFloat(a)).append(')');
+            output = sb.toString();
+        }
+        return output;
     }
 }

Index: CssDate.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssDate.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssDate.java	5 Jan 2010 13:50:00 -0000	1.5
+++ CssDate.java	6 Jan 2010 09:27:44 -0000	1.6
@@ -2,7 +2,7 @@
 // $Id$
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio, 1997-2010.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.values;
 
@@ -11,96 +11,99 @@
 
 /**
  * <H3>Date</H3>
- *
+ * <p/>
  * Legal format is dd/mm/yyyy as in SSML
  *
  * @version $Revision$
  */
 public class CssDate extends CssValue {
-    
+
     public static final int type = CssTypes.CSS_DATE;
-    
+
     public final int getType() {
-	return type;
+        return type;
     }
 
-    String day = new String();
-    String month = new String();
-    String year = new String();
-
-  /**
-   * Create a new CssDate.
-   */
-  public CssDate() {
-  }
+    String day = "";
+    String month = "";
+    String year = "";
 
-  /**
-   * Set the value of this date.
-   *
-   * @param s     the string representation of the time.
-   * @param ac For errors and warnings reports.
-   * @exception InvalidParamException The date format is incorrect
-   */
-  public void set(String s, ApplContext ac) throws InvalidParamException {
-    s = s.toLowerCase();
-    int length = s.length();
+    /**
+     * Create a new CssDate.
+     */
+    public CssDate() {
+    }
 
-	if (s.indexOf("/") == -1) {
-		// invalid date
-		throw new InvalidParamException("value",
-		      s, ac);
+    /**
+     * Set the value of this date.
+     *
+     * @param s  the string representation of the time.
+     * @param ac For errors and warnings reports.
+     * @throws InvalidParamException The date format is incorrect
+     */
+    public void set(String s, ApplContext ac) throws InvalidParamException {
+        s = s.toLowerCase();
+        int first_slash = s.indexOf('/');
+        int last_slash;
 
-	} else if (s.indexOf("/") == s.lastIndexOf("/")) {
-		// only one / in date is invalid date
-	      throw new InvalidParamException("value",
-		      s, ac);
-	} else {
-		day = s.substring(0,s.indexOf("/") - 1);
-		month = s.substring(s.indexOf("/"), s.lastIndexOf("/") - 1);
-		year = s.substring(s.lastIndexOf("/"),length);
+        if (first_slash == -1) {
+            // invalid date
+            throw new InvalidParamException("value",
+                    s, ac);
+        }
+        last_slash = s.lastIndexOf('/');
+        if (first_slash == last_slash) {
+            // only one / in date is invalid date
+            throw new InvalidParamException("value",
+                    s, ac);
+        }
 
-		Integer d, m, y;
+        day = s.substring(0, first_slash - 1);
+        month = s.substring(first_slash, last_slash - 1);
+        year = s.substring(last_slash);
 
-		try {
-			d = new Integer(day);
-			m = new Integer(month);
-			y = new Integer(year);
-		} catch (NumberFormatException e) {
-	      throw new InvalidParamException("value", s, ac);
-		}
+        int d, m, y;
 
-		if (d.intValue() > 31 || d.intValue() < 0 || m.intValue() > 12 ||
-           m.intValue() < 0 || y.intValue() < 0) {
-			throw new InvalidParamException("value", s, ac);
-		}
-	}
+        try {
+            d = Integer.parseInt(day);
+            m = Integer.parseInt(month);
+            y = Integer.parseInt(year);
+        } catch (NumberFormatException e) {
+            throw new InvalidParamException("value", s, ac);
+        }
 
-  }
+        if (d > 31 || d <= 0 || m > 12 || m <= 0 || y < 0) {
+            throw new InvalidParamException("value", s, ac);
+        }
+    }
 
-  /**
-   * Returns the current value
-   *  Float
-   */
-  public Object get() {
-    return new String(day + "/" + month + "/" + year);
-  }
+    /**
+     * Returns the current value
+     */
+    public Object get() {
+        return toString();
+    }
 
-  /**
-   * Returns a string representation of the object.
-   */
-  public String toString() {
-	  return day + "/" + month + "/" + year;
-  }
+    /**
+     * Returns a string representation of the object.
+     */
+    public String toString() {
+        StringBuilder sb = new StringBuilder(day);
+        sb.append('/').append(month).append('/').append(year);
+        return sb.toString();
+    }
 
-  /**
-   * Compares two values for equality.
-   *
-   * @param value The other value.
-   */
-  public boolean equals(Object value) {
-    return (value instanceof CssDate && this.day.equals(((CssDate)value).day) &&
-    this.month.equals(((CssDate)value).month) && this.year.equals(((CssDate)value).year));
-  }
+    /**
+     * Compares two values for equality.
+     *
+     * @param value The other value.
+     */
+    public boolean equals(Object value) {
+        return (value instanceof CssDate &&
+                this.day.equals(((CssDate) value).day) &&
+                this.month.equals(((CssDate) value).month)
+                && this.year.equals(((CssDate) value).year));
+    }
 
 }
 

Index: HSL.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/HSL.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- HSL.java	5 Jan 2010 13:50:01 -0000	1.6
+++ HSL.java	6 Jan 2010 09:27:44 -0000	1.7
@@ -28,37 +28,40 @@
     }
 
     public void setHue(float hue) {
-	this.fh = (float)((((double)hue%360.0)+360.0)%360.0);
+        this.fh = (float) ((((double) hue % 360.0) + 360.0) % 360.0);
     }
+
     public void setHue(CssNumber hue) {
-	setHue(hue.getValue());
+        setHue(hue.getValue());
     }
 
     public void setSaturation(float sat) {
-	this.fs = sat;
+        this.fs = sat;
     }
+
     public void setSaturation(CssNumber sat) {
-	setSaturation(sat.getValue());
+        setSaturation(sat.getValue());
     }
 
     public void setLightness(float light) {
-	this.fl = light;
+        this.fl = light;
     }
+
     public void setLightness(CssNumber light) {
-	setLightness(light.getValue());
+        setLightness(light.getValue());
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	if (output == null) {
-	    StringBuilder sb = new StringBuilder("hsl(");
-	    sb.append(Util.displayFloat(fh)).append(", ");
-	    sb.append(Util.displayFloat(fs)).append("%, ");
-	    sb.append(Util.displayFloat(fl)).append("%)");
-	    output = sb.toString();
-	}
-	return output;
+        if (output == null) {
+            StringBuilder sb = new StringBuilder("hsl(");
+            sb.append(Util.displayFloat(fh)).append(", ");
+            sb.append(Util.displayFloat(fs)).append("%, ");
+            sb.append(Util.displayFloat(fl)).append("%)");
+            output = sb.toString();
+        }
+        return output;
     }
 }

Index: CssAngle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssAngle.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CssAngle.java	5 Jan 2010 13:50:00 -0000	1.8
+++ CssAngle.java	6 Jan 2010 09:27:44 -0000	1.9
@@ -2,7 +2,7 @@
 // $Id$
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio, 1997-2010.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.values;
 
@@ -10,6 +10,8 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.util.Util;
 
+import java.util.HashMap;
+
 /**
  * <H3>Angle</H3>
  * <p/>
@@ -37,11 +39,23 @@
     }
 
     Float value;
-    int unit;
-    static String[] units = {"deg", "grad", "rad"};
-    static int[] hash_units;
+    String unit;
+
+    static final String deg = "deg";
+    static final String rad = "rad";
+    static final String grad = "grad";
+
+    private static final HashMap<String, String> allowed_values;
+
     static Float defaultValue = new Float(0);
 
+    static {
+        allowed_values = new HashMap<String, String>();
+        allowed_values.put(deg, deg);
+        allowed_values.put(rad, rad);
+        allowed_values.put(grad, grad);
+    }
+
     /**
      * Create a new CssAngle.
      */
@@ -77,38 +91,16 @@
         //float v;
         if (s.indexOf("grad") == -1) {
             unit = s.substring(length - 3, length);
+            unit = allowed_values.get(unit);
+            if (unit == null) {
+                throw new InvalidParamException("unit", unit, ac);
+            }
             value = new Float(s.substring(0, length - 3));
         } else {
-            unit = "grad";
+            unit = grad;
             value = new Float(s.substring(0, length - 4));
         }
-        int hash = unit.hashCode();
-
-
-        int i = 0;
-        while (i < units.length) {
-            if (hash == hash_units[i]) {
-                this.unit = i;
-                break;
-            }
-            i++;
-        }
-
-        if (i > 2) {
-            throw new InvalidParamException("unit", unit, ac);
-        }
-
-        this.unit = i; // there is no unit by default
-
-        /* clipping with degree */
-        /*
-        while (v < 0) {
-        v += 360;
-        }
-        while (v > 360) {
-        v -= 360;
-        }
-      */
+        this.unit = unit; // there is no unit by default
     }
 
     /**
@@ -126,7 +118,7 @@
      * Returns the current value
      */
     public String getUnit() {
-        return units[unit];
+        return unit;
     }
 
     /**
@@ -167,74 +159,31 @@
 
     public float getDegree() {
         float angle = value.floatValue();
-        switch (unit) {
-            case 0:
-                // angle % 360
-                return normalize(angle);
-            case 1:
-                return normalize(angle * (9.f / 10.f));
-            case 2:
-                return normalize(angle * (180.f / ((float) Math.PI)));
-            default:
-                System.err.println("[ERROR] in org.w3c.css.values.CssAngle");
-                System.err.println("[ERROR] Please report (" + unit + ")");
-                return (float) 0;
+        if (unit == deg) {
+            return normalize(angle);
+        } else if (unit == rad) {
+            return normalize(angle * (180.f / ((float) Math.PI)));
+        } else if (unit == grad) {
+            return normalize(angle * (9.f / 10.f));
         }
-    }
-/*
- // These functions are not used, don't normalize angles, and are false
- // (int operations instead of float ones)
-
-    public float getGradian() {
-	float grad = value.floatValue();
-	switch (unit) {
-	case 0:
-	    return (grad * (((float) Math.PI) / 180));
-	case 1:
-	    return grad;
-	case 2:
-	    return (grad * (((float) Math.PI) / 100));
-	default:
-	    System.err.println("[ERROR] in org.w3c.css.values.CssAngle");
-	    System.err.println("[ERROR] Please report (" + unit + ")");
-	    return (float) 0;
-	}
-    }
 
-    public float getRadian() {
-	float rad = value.floatValue();
-	switch (unit) {
-	case 0:
-	    return (rad * (5 / 9));
-	case 1:
-	    return (rad * (100 / ((float) Math.PI)));
-	case 2:
-	    return rad;
-	default:
-	    System.err.println("[ERROR] in org.w3c.css.values.CssAngle");
-	    System.err.println("[ERROR] Please report (" + unit + ")");
-	    return (float) 0;
-	}
+        System.err.println("[ERROR] in org.w3c.css.values.CssAngle");
+        System.err.println("[ERROR] Please report (" + unit + ")");
+        return (float) 0;
     }
-*/
 
     public boolean isDegree() {
-        return unit == 0;
+        return unit == deg;
     }
 
     public boolean isGradian() {
-        return unit == 1;
+        return unit == grad;
     }
 
     public boolean isRadian() {
-        return unit == 2;
+        return unit == rad;
     }
 
-    static {
-        hash_units = new int[units.length];
-        for (int i = 0; i < units.length; i++) {
-            hash_units[i] = units[i].hashCode();
-        }
-    }
+
 }
 

Index: CssFunction.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssFunction.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- CssFunction.java	5 Jan 2010 13:50:00 -0000	1.7
+++ CssFunction.java	6 Jan 2010 09:27:44 -0000	1.8
@@ -2,7 +2,7 @@
 // $Id$
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio, 1997.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.values;
 
@@ -18,7 +18,7 @@
     public static final int type = CssTypes.CSS_FUNCTION;
 
     public final int getType() {
-	return type;
+        return type;
     }
 
     String name;
@@ -27,16 +27,16 @@
     /**
      * Set the value of this function
      *
-     * @param s     the string representation of the frequency.
-     * @param frame For errors and warnings reports.
+     * @param s  the string representation of the frequency.
+     * @param ac For errors and warnings reports.
      */
     public void set(String s, ApplContext ac) {
-	// @@TODO
+        // @@TODO
     }
 
     public void set(String name, CssExpression parameters) {
-	this.name = name;
-	this.parameters = parameters;
+        this.name = name;
+        this.parameters = parameters;
 
     }
 
@@ -44,29 +44,31 @@
      * Returns the value
      */
     public Object get() {
-	// @@TODO
-	return null;
+        // @@TODO
+        return null;
     }
 
     /**
      * Returns the name of the function
      */
     public String getName() {
-	return name;
+        return name;
     }
 
     /**
      * Returns the parameters expression
      */
     public CssExpression getParameters() {
-	return parameters;
+        return parameters;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	return name + "(" + parameters + ")";
+        StringBuilder sb = new StringBuilder(name);
+        sb.append('(').append(parameters).append(')');
+        return sb.toString();
     }
 
     /**
@@ -75,8 +77,8 @@
      * @param value The other value.
      */
     public boolean equals(Object value) {
-	// @@FIXME
-	return (value instanceof CssFunction &&
-		this.name.equals(((CssFunction) value).name));
+        // @@FIXME
+        return (value instanceof CssFunction &&
+                this.name.equals(((CssFunction) value).name));
     }
 }

Index: CssTime.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssTime.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssTime.java	25 Mar 2008 18:30:11 -0000	1.6
+++ CssTime.java	6 Jan 2010 09:27:44 -0000	1.7
@@ -54,7 +54,7 @@
    * Set the value of this time.
    *
    * @param s     the string representation of the time.
-   * @param frame For errors and warnings reports.
+   * @param ac For errors and warnings reports.
    * @exception InvalidParamException The unit is incorrect
    */
   public void set(String s, ApplContext ac) throws InvalidParamException {

Index: RGB.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/RGB.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- RGB.java	5 Jan 2010 13:50:01 -0000	1.8
+++ RGB.java	6 Jan 2010 09:27:45 -0000	1.9
@@ -18,7 +18,7 @@
     String output = null;
     int r, g, b;
     float fr, fg, fb;
-    
+
     boolean percent = false;
 
     /**
@@ -36,24 +36,27 @@
     }
 
     public final void setRed(int r) {
-	this.r = r;
+        this.r = r;
     }
+
     public final void setRed(float fr) {
-	this.fr = fr;
+        this.fr = fr;
     }
 
     public final void setGreen(int g) {
-	this.g = g;
+        this.g = g;
     }
+
     public final void setGreen(float fg) {
-	this.fg = fg;
+        this.fg = fg;
     }
 
     public final void setBlue(int b) {
-	this.b = b;
+        this.b = b;
     }
+
     public final void setBlue(float fb) {
-	this.fb = fb;
+        this.fb = fb;
     }
 
     /**
@@ -64,58 +67,60 @@
 
     /**
      * Create a new RGB with default values
+     *
      * @param r the red channel, an <EM>int</EM>
      * @param g the green channel, an <EM>int</EM>
      * @param b the blue channel, an <EM>int</EM>
      */
     public RGB(int r, int g, int b) {
-	this.r = r;
-	this.g = g;
-	this.b = b;
+        this.r = r;
+        this.g = g;
+        this.b = b;
     }
-    
+
     public RGB(float fr, float fg, float fb) {
-	this.fr = fr;
-	this.fg = fg;
-	this.fb = fb;
-	percent = true;
+        this.fr = fr;
+        this.fg = fg;
+        this.fb = fb;
+        percent = true;
     }
 
     public boolean equals(RGB other) {
-	if (other != null) {
-	    if (percent) {
-		if (other.percent) {
-		    return ((fr == other.fr) &&
-			    (fg == other.fg) &&
-			    (fb == other.fb));
-		}
-	    } else {
-		if (!other.percent) {
-		    return ((r == other.r) &&
-			    (g == other.g) &&
-			    (b == other.b));		    
-		}
-	    }
-	}
-	return false;
+        if (other != null) {
+            if (percent) {
+                if (other.percent) {
+                    return ((fr == other.fr) &&
+                            (fg == other.fg) &&
+                            (fb == other.fb));
+                }
+            } else {
+                if (!other.percent) {
+                    return ((r == other.r) &&
+                            (g == other.g) &&
+                            (b == other.b));
+                }
+            }
+        }
+        return false;
     }
+
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	if (output == null) {
-	    StringBuilder sb = new StringBuilder("rgb(");
-	    if (isPercent()) {
-		sb.append(fr).append("%, ");
-		sb.append(fg).append("%, ");
-		sb.append(fb).append("%)");
-	    } else {
-		sb.append(r).append(", ");
-		sb.append(g).append(", ");
-		sb.append(b).append(')');
-	    }
-	    output = sb.toString();
-	} 
-	return output;
+        if (output == null) {
+            StringBuilder sb = new StringBuilder("rgb(");
+            if (isPercent()) {
+                sb.append(fr).append("%, ");
+                sb.append(fg).append("%, ");
+                sb.append(fb).append("%)");
+            } else {
+                sb.append(r).append(", ");
+                sb.append(g).append(", ");
+                sb.append(b).append(')');
+            }
+            output = sb.toString();
+        }
+        return output;
     }
 }

Index: CssNumber.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssNumber.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CssNumber.java	5 Jan 2010 13:50:00 -0000	1.8
+++ CssNumber.java	6 Jan 2010 09:27:44 -0000	1.9
@@ -54,11 +54,9 @@
         try {
             new Integer(s);
             isInt = true;
-        }
-        catch (NumberFormatException e) {
+        } catch (NumberFormatException e) {
             isInt = false;
-        }
-        finally {
+        } finally {
             value = new Float(s);
         }
         this.ac = ac;

Index: HSLA.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/HSLA.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- HSLA.java	5 Jan 2010 13:50:01 -0000	1.6
+++ HSLA.java	6 Jan 2010 09:27:44 -0000	1.7
@@ -29,45 +29,49 @@
     }
 
     public void setHue(float hue) {
-	this.fh = (float)((((double)hue%360.0)+360.0)%360.0);
+        this.fh = (float) ((((double) hue % 360.0) + 360.0) % 360.0);
     }
+
     public void setHue(CssNumber hue) {
-	setHue(hue.getValue());
+        setHue(hue.getValue());
     }
 
     public void setSaturation(float sat) {
-	this.fs = sat;
+        this.fs = sat;
     }
+
     public void setSaturation(CssNumber sat) {
-	setSaturation(sat.getValue());
+        setSaturation(sat.getValue());
     }
 
     public void setLightness(float light) {
-	this.fl = light;
+        this.fl = light;
     }
+
     public void setLightness(CssNumber light) {
-	setLightness(light.getValue());
+        setLightness(light.getValue());
     }
 
     public void setAlpha(float alpha) {
-	this.fa = alpha;
+        this.fa = alpha;
     }
+
     public void setAlpha(CssNumber alpha) {
-	setAlpha(alpha.getValue());
+        setAlpha(alpha.getValue());
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	if (output == null) {
-	    StringBuilder sb = new StringBuilder("hsl(");
-	    sb.append(Util.displayFloat(fh)).append(", ");
-	    sb.append(Util.displayFloat(fs)).append("%, ");
-	    sb.append(Util.displayFloat(fl)).append("%, ");
-	    sb.append(Util.displayFloat(fa)).append(")");
-	    output = sb.toString();
-	}
-	return output;
+        if (output == null) {
+            StringBuilder sb = new StringBuilder("hsl(");
+            sb.append(Util.displayFloat(fh)).append(", ");
+            sb.append(Util.displayFloat(fs)).append("%, ");
+            sb.append(Util.displayFloat(fl)).append("%, ");
+            sb.append(Util.displayFloat(fa)).append(")");
+            output = sb.toString();
+        }
+        return output;
     }
 }
Received on Wednesday, 6 January 2010 09:27:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:41 UTC