2002/css-validator/org/w3c/css/properties/css3 CssWhiteSpace.java,1.2,1.3

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

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

Index: CssWhiteSpace.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssWhiteSpace.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssWhiteSpace.java	15 Aug 2012 05:15:32 -0000	1.2
+++ CssWhiteSpace.java	24 Aug 2012 07:16:22 -0000	1.3
@@ -11,87 +11,77 @@
 import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
-import java.util.HashMap;
-
 /**
  * @version $Revision$
  * @spec http://www.w3.org/TR/2012/WD-css3-text-20120814/#white-space0
  */
 public class CssWhiteSpace extends org.w3c.css.properties.css.CssWhiteSpace {
 
-    CssValue value;
 
-    public static HashMap<String, CssIdent> allowed_values;
+	public static CssIdent[] allowed_values;
 
-    static {
-        allowed_values = new HashMap<String, CssIdent>();
-        String[] WHITESPACE = {
-                "normal", "pre", "nowrap", "pre-wrap", "pre-line"
-        };
+	static {
+		String[] WHITESPACE = {
+				"normal", "pre", "nowrap", "pre-wrap", "pre-line"
+		};
+		allowed_values = new CssIdent[WHITESPACE.length];
+		int i = 0;
+		for (String aWS : WHITESPACE) {
+			allowed_values[i++] = CssIdent.getIdent(aWS);
+		}
+	}
 
-        for (String aWS : WHITESPACE) {
-            allowed_values.put(aWS, CssIdent.getIdent(aWS));
-        }
-    }
+	public static final CssIdent getMatchingIdent(CssIdent ident) {
+		for (CssIdent id : allowed_values) {
+			if (id.equals(ident)) {
+				return id;
+			}
+		}
+		return null;
+	}
 
-    /*
+	/*
     * Create a new CssWhiteSpace
     */
-    public CssWhiteSpace() {
-        value = initial;
-    }
-
-    /**
-     * 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 (check && expression.getCount() > 1) {
-            throw new InvalidParamException("unrecognize", ac);
-        }
-
-        CssValue val = expression.getValue();
-        setByUser();
+	public CssWhiteSpace() {
+		value = initial;
+	}
 
-        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);
-    }
+	/**
+	 * 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 {
 
-    public CssWhiteSpace(ApplContext ac, CssExpression expression)
-            throws InvalidParamException {
-        this(ac, expression, false);
-    }
+		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);
+	}
 
 }

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