2002/css-validator/org/w3c/css/properties/css2 CssWhiteSpace.java,1.1,1.2

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

Modified Files:
	CssWhiteSpace.java 
Log Message:
ident case sensitivity

Index: CssWhiteSpace.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssWhiteSpace.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssWhiteSpace.java	9 Feb 2012 17:36:31 -0000	1.1
+++ CssWhiteSpace.java	24 Aug 2012 07:16:22 -0000	1.2
@@ -11,79 +11,69 @@
 import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
-import java.util.HashMap;
-
 /**
  * @version $Revision$
  * @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/text.html#white-space-prop
  */
 public class CssWhiteSpace extends org.w3c.css.properties.css.CssWhiteSpace {
 
-    CssValue value;
-
-    public static HashMap<String, CssIdent> allowed_values;
-
-    static {
-        allowed_values = new HashMap<String, CssIdent>();
-        String[] WHITESPACE = {
-                "normal", "pre", "nowrap"
-        };
-
-        for (String aWS : WHITESPACE) {
-            allowed_values.put(aWS, CssIdent.getIdent(aWS));
-        }
-    }
+	public static CssIdent[] allowed_values;
 
-    /**
-     * Create a new CssWhiteSpace
-     *
-     * @param expression The expression for this property
-     * @throws org.w3c.css.util.InvalidParamException
-     *          values are incorrect
-     */
-    public CssWhiteSpace(ApplContext ac, CssExpression expression, boolean check)
-            throws InvalidParamException {
+	static {
+		String[] WHITESPACE = {
+				"normal", "pre", "nowrap"
+		};
+		allowed_values = new CssIdent[WHITESPACE.length];
+		int i = 0;
+		for (String aWS : WHITESPACE) {
+			allowed_values[i++] = CssIdent.getIdent(aWS);
+		}
+	}
 
-        if (check && expression.getCount() > 1) {
-            throw new InvalidParamException("unrecognize", ac);
-        }
+	public static final CssIdent getMatchingIdent(CssIdent ident) {
+		for (CssIdent id : allowed_values) {
+			if (id.equals(ident)) {
+				return id;
+			}
+		}
+		return null;
+	}
 
-        CssValue val = expression.getValue();
-        setByUser();
+	/**
+	 * Create a new CssWhiteSpace
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          values are incorrect
+	 */
+	public CssWhiteSpace(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
 
-        if (val.getType() == CssTypes.CSS_IDENT) {
-            if (inherit.equals(val)) {
-                value = inherit;
-            } else {
-                value = allowed_values.get(val.toString());
-            }
-            if (value != null) {
-                expression.next();
-                return;
-            }
-        }
-        throw new InvalidParamException("value", expression.getValue(),
-                getPropertyName(), ac);
-    }
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
 
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-        return (inherit == value);
-    }
+		CssValue val = expression.getValue();
+		setByUser();
 
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-        return value.toString();
-    }
+		if (val.getType() == CssTypes.CSS_IDENT) {
+			if (inherit.equals(val)) {
+				value = inherit;
+			} else {
+				value = getMatchingIdent((CssIdent) val);
+			}
+			if (value != null) {
+				expression.next();
+				return;
+			}
+		}
+		throw new InvalidParamException("value", expression.getValue(),
+				getPropertyName(), ac);
+	}
 
-    public CssWhiteSpace(ApplContext ac, CssExpression expression)
-            throws InvalidParamException {
-        this(ac, expression, false);
-    }
+	public CssWhiteSpace(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
 }

Received on Friday, 24 August 2012 07:16:32 UTC