W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2012

2002/css-validator/org/w3c/css/values CssHashIdent.java,NONE,1.1 CssColor.java,1.22,1.23 CssTypes.java,1.6,1.7

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 18 Oct 2012 09:39:54 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TOma2-0003Wz-Cz@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/values
In directory hutz:/tmp/cvs-serv13553

Modified Files:
	CssColor.java CssTypes.java 
Added Files:
	CssHashIdent.java 
Log Message:
new values hashident

--- NEW FILE: CssHashIdent.java ---
//
// $Id: CssHashIdent.java,v 1.1 2012/10/18 09:39:52 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.values;

import org.w3c.css.util.ApplContext;

/**
 * @version $Revision: 1.1 $
 */
public class CssHashIdent extends CssValue implements Comparable<CssHashIdent> {

    /**
     * Get a cached CssIdent, useful for common values like "inherit"
     *
     * @param name, the ident name
     * @return a CssIdent
     */


    public static final int type = CssTypes.CSS_HASH_IDENT;

	public int compareTo(CssHashIdent other) {
		int hash, ohash;
		hash = hashCode();
		ohash = other.hashCode();
		if (hash == ohash) {
			return 0;
		}
		return (hash < ohash) ? 1 : -1;
	}

    private int hashcode = 0;

    public final int getType() {
        return type;
    }

    /**
     * Create a new CssIdent
     */
    public CssHashIdent() {
    }

    /**
     * Create a new CssIdent
     *
     * @param s The identificator
     */
    public CssHashIdent(String s) {
        value = s;
    }

    /**
     * Set the value of this ident.
     *
     * @param s  the string representation of the identificator.
     * @param ac For errors and warnings reports.
     */
    public void set(String s, ApplContext ac) {
        value = s;
        hashcode = 0;
    }

    /**
     * Returns the internal value.
     */
    public Object get() {
        return value;
    }

    /**
     * Returns a string representation of the object.
     */
    public String toString() {
        return value;
    }

    /**
     * Compares two values for equality.
     *
     * @param value The other value.
     */
    public boolean equals(Object value) {
        return ((value instanceof CssHashIdent) && (value.hashCode()==hashCode()));
    }

    /**
     * Compares two values for equality.
     *
     * @param value The other value.
     * @return true is the two values are matching
     */
    public boolean equals(CssHashIdent value) {
        return (value.hashCode() == hashCode());
    }

    /**
     * Returns a hashcode for this ident.
     */
    public int hashCode() {
        // we cache, as we use toLowerCase and don't store the resulting string
        if (hashcode == 0) {
            hashcode = value.toLowerCase().hashCode();
        }
        return hashcode;
    }

    private String value;
}

Index: CssTypes.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssTypes.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssTypes.java	28 Aug 2012 18:30:31 -0000	1.6
+++ CssTypes.java	18 Oct 2012 09:39:52 -0000	1.7
@@ -26,6 +26,7 @@
     public static final int CSS_UNICODE_RANGE = 13;
     public static final int CSS_RATIO         = 14;
     public static final int CSS_SWITCH        = 15;
+	public static final int CSS_HASH_IDENT    = 16;
 
     // not generated by the parser
     public static final int CSS_VALUE_LIST    = 20;

Index: CssColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssColor.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- CssColor.java	29 Sep 2011 09:09:00 -0000	1.22
+++ CssColor.java	18 Oct 2012 09:39:51 -0000	1.23
@@ -186,7 +186,7 @@
      * Parse a RGB color.
      * format #(3-6)<hexnum>
      */
-    private void setShortRGBColor(String s, ApplContext ac)
+    public void setShortRGBColor(String s, ApplContext ac)
             throws InvalidParamException {
         int r;
         int g;
Received on Thursday, 18 October 2012 09:39:55 UTC

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