2002/css-validator/org/w3c/css/values CssSwitch.java,NONE,1.1 CssOperator.java,1.4,1.5 CssTypes.java,1.4,1.5

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

Modified Files:
	CssOperator.java CssTypes.java 
Added Files:
	CssSwitch.java 
Log Message:
prepared to replace '/' instances from 'Operator' as in CSS2 to a 'switch' per css3. adapted some classes because of that (expect breakage on font before it's rewritten), fixed 'background' to be in sync with the http://www.w3.org/TR/2012/WD-css3-background-20120214/ spec

Index: CssOperator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssOperator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssOperator.java	5 Jan 2010 13:50:00 -0000	1.4
+++ CssOperator.java	3 Apr 2012 14:20:54 -0000	1.5
@@ -15,6 +15,5 @@
   public static final char COMMA = ',';
   public static final char MINUS = '-';
   public static final char PLUS = '+';
-  public static final char SLASH = '/';
   public static final char SPACE = ' ';
 }

--- NEW FILE: CssSwitch.java ---
// $Id: CssSwitch.java,v 1.1 2012/04/03 14:20:54 ylafon Exp $
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.values;

import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;

/**
 * @since CSS3
 * @spec http://www.w3.org/TR/2012/WD-css3-background-20120214/
 */
public class CssSwitch extends CssValue {

    public static final int type = CssTypes.CSS_SWITCH;

    public static final char SLASH = '/';

    public final int getType() {
        return type;
    }

    char switch_char;

    /**
     * Create a new CssSwitch.
     */
    public CssSwitch() {
    }

    /**
     * Set the value of this ratio.
     *
     * @param s  the string representation of the switch .
     * @param ac For errors and warnings reports.
     * @throws org.w3c.css.util.InvalidParamException (incorrect format)
     */
    public void set(String s, ApplContext ac) throws InvalidParamException {
        String _spec = s;
        if (_spec.length() != 1) {
            _spec.trim();
            if (_spec.length() != 1) {
                throw new InvalidParamException("value",
                        s, ac);
            }
        }
        switch_char = _spec.charAt(0);
        // currently, only '/' is defined for this.
        if (switch_char != SLASH) {
            throw new InvalidParamException("value",
                    s, ac);
        }
    }

    /**
     * Returns the current value
     */
    public Object get() {
        return toString();
    }

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

    /**
     * Compares two values for equality.
     *
     * @param value The other value.
     */
    public boolean equals(Object value) {
        try {
            CssSwitch other = (CssSwitch) value;
            // check that the ratio are the same
            return (switch_char == other.switch_char);
        } catch (ClassCastException cce) {
            return false;
        }
    }
}


Index: CssTypes.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssTypes.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssTypes.java	22 Oct 2011 13:36:23 -0000	1.4
+++ CssTypes.java	3 Apr 2012 14:20:54 -0000	1.5
@@ -25,6 +25,7 @@
     public static final int CSS_FUNCTION      = 12;
     public static final int CSS_UNICODE_RANGE = 13;
     public static final int CSS_RATIO         = 14;
+    public static final int CSS_SWITCH        = 15;
 
     // not generated by the parser
     public static final int CSS_VALUE_LIST    = 20;

Received on Tuesday, 3 April 2012 14:21:08 UTC