2002/css-validator/org/w3c/css/values CssAngle.java,1.9,1.10 CssResolution.java,1.5,1.6

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

Modified Files:
	CssAngle.java CssResolution.java 
Log Message:
genericity + updated code to 5.0 stds

Index: CssResolution.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssResolution.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssResolution.java	5 Jan 2010 13:50:00 -0000	1.5
+++ CssResolution.java	29 Aug 2011 07:21:02 -0000	1.6
@@ -12,104 +12,105 @@
 import org.w3c.css.util.Util;
 
 /**
- *   <H3>
- *     &nbsp;&nbsp; Resolution units
- *   </H3>
- *   <P>
- *	 The dpi and dpcm units describe the resolution of an output device i.e. the density of
- *   the pixels. In dots per inch and dots per centimeter, respectively. These units are only used in the
- *   resolution media feature.
- *   </P>
+ * <H3>
+ * &nbsp;&nbsp; Resolution units
+ * </H3>
+ * <p/>
+ * The dpi and dpcm units describe the resolution of an output device i.e. the density of
+ * the pixels. In dots per inch and dots per centimeter, respectively. These units are only used in the
+ * resolution media feature.
+ * </P>
+ *
  * @version $Revision$
  */
 public class CssResolution extends CssValue {
 
     public static final int type = CssTypes.CSS_RESOLUTION;
-    
+
     public final int getType() {
-	return type;
+        return type;
     }
 
-  /**
-   * Create a new CssResolution
-   */
-  public CssResolution() {
-    value = defaultValue;
-  }
+    /**
+     * Create a new CssResolution
+     */
+    public CssResolution() {
+        value = defaultValue;
+    }
 
-  /**
-   * Set the value of this Resolution.
-   *
-   * @param s     the string representation of the Resolution.
-   * @param ac For errors and warnings reports.
-   * @exception InvalidParamException The unit is incorrect
-   */
-  public void set(String s, ApplContext ac) throws InvalidParamException {
-    s = s.toLowerCase();
-    int length = s.length();
-    String unit = "";
-    if (s.toUpperCase().indexOf("DPI") != -1) {
-		unit = s.substring(length-3, length);
-		this.value = new Float(s.substring(0, length-3));
-		if (unit.toUpperCase().equals("DPI")) {
-			this.unit = unit;
-		}
-		return;
-	} else if (s.toUpperCase().indexOf("DPCM") != -1) {
-		unit = s.substring(length-4, length);
-		this.value = new Float(s.substring(0, length-4));
-		if (unit.toUpperCase().equals("DPCM")) {
-			this.unit = unit;
-		}
-		return;
-	}
+    /**
+     * Set the value of this Resolution.
+     *
+     * @param s  the string representation of the Resolution.
+     * @param ac For errors and warnings reports.
+     * @throws InvalidParamException The unit is incorrect
+     */
+    public void set(String s, ApplContext ac) throws InvalidParamException {
+        s = s.toLowerCase();
+        int length = s.length();
+        String unit = "";
+        if (s.contains("dpi")) {
+            unit = s.substring(length - 3, length);
+            this.value = new Float(s.substring(0, length - 3));
+            if (unit.equals("dpi")) {
+                this.unit = unit;
+            }
+            return;
+        } else if (s.contains("dpcm")) {
+            unit = s.substring(length - 4, length);
+            this.value = new Float(s.substring(0, length - 4));
+            if (unit.equals("dpcm")) {
+                this.unit = unit;
+            }
+            return;
+        }
 
-    if (!ac.getCssVersion().equals("css3")) {
-		throw new InvalidParamException("unit", unit, ac);
-    }
+        if (!ac.getCssVersion().equals("css3")) {
+            throw new InvalidParamException("unit", unit, ac);
+        }
 
-    throw new InvalidParamException("unit", unit, ac);
-  }
+        throw new InvalidParamException("unit", unit, ac);
+    }
 
-  /**
-   * Returns the current value
-   */
-  public Object get() {
-    return value;
-  }
+    /**
+     * Returns the current value
+     */
+    public Object get() {
+        return value;
+    }
 
-  /**
-   * @return the current value
-   */
-  public String getUnit() {
-    return unit;
-  }
+    /**
+     * @return the current value
+     */
+    public String getUnit() {
+        return unit;
+    }
 
-  /**
-   * Returns a string representation of the object.
-   */
-  public String toString() {
-      if (value.floatValue() != 0.0) {
-	  return Util.displayFloat(value) + getUnit();
-      } else {
-	  return Util.displayFloat(value);
-      }
-  }
+    /**
+     * Returns a string representation of the object.
+     */
+    public String toString() {
+        if (value.floatValue() != 0.0) {
+            return Util.displayFloat(value) + unit;
+        } else {
+            return Util.displayFloat(value);
+        }
+    }
 
-  /**
-   * Compares two values for equality.
-   *
-   * @param value The other value.
-   */
-  public boolean equals(Object value) {
-    return (value instanceof CssResolution &&
-	    this.value.equals(((CssResolution) value).value) &&
-            unit.equals(((CssResolution) value).unit));
-  }
+    /**
+     * Compares two values for equality.
+     *
+     * @param value The other value.
+     */
+    public boolean equals(Object value) {
+        return (value instanceof CssResolution &&
+                this.value.equals(((CssResolution) value).value) &&
+                unit.equals(((CssResolution) value).unit));
+    }
 
-  private Float value;
-  private String unit;
-  private static Float defaultValue = new Float(0);
+    private Float value;
+    private String unit;
+    private static Float defaultValue = new Float(0);
 
 }
 

Index: CssAngle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssAngle.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CssAngle.java	6 Jan 2010 09:27:44 -0000	1.9
+++ CssAngle.java	29 Aug 2011 07:21:02 -0000	1.10
@@ -89,7 +89,7 @@
         int length = s.length();
         String unit;
         //float v;
-        if (s.indexOf("grad") == -1) {
+        if (!s.contains("grad")) {
             unit = s.substring(length - 3, length);
             unit = allowed_values.get(unit);
             if (unit == null) {

Received on Monday, 29 August 2011 07:21:12 UTC