org.w3c.css.sac.LexicalUnit Maven / Gradle / Ivy
Show all versions of cookcc Show documentation
/*
* Copyright (c) 1999 World Wide Web Consortium
* (Massachusetts Institute of Technology, Institut National de Recherche
* en Informatique et en Automatique, Keio University).
* All Rights Reserved. http://www.w3.org/Consortium/Legal/
*
* $Id: LexicalUnit.java 477010 2006-11-20 02:54:38Z mrglavas $
*/
package org.w3c.css.sac;
/**
* This is a lexical unit for CSS values.
* Remarks: Not all the following lexical units are supported (or
* will be supported) by CSS.
*
All examples are CSS2 compliant.
*
* @version $Revision: 477010 $
* @author Philippe Le Hegaret
*/
public interface LexicalUnit {
/**
* ,
*/
public static final short SAC_OPERATOR_COMMA = 0;
/**
* +
*/
public static final short SAC_OPERATOR_PLUS = 1;
/**
* -
*/
public static final short SAC_OPERATOR_MINUS = 2;
/**
* *
*/
public static final short SAC_OPERATOR_MULTIPLY = 3;
/**
* /
*/
public static final short SAC_OPERATOR_SLASH = 4;
/**
* %
*/
public static final short SAC_OPERATOR_MOD = 5;
/**
* ^
*/
public static final short SAC_OPERATOR_EXP = 6;
/**
* <
*/
public static final short SAC_OPERATOR_LT = 7;
/**
* >
*/
public static final short SAC_OPERATOR_GT = 8;
/**
* <=
*/
public static final short SAC_OPERATOR_LE = 9;
/**
* >=
*/
public static final short SAC_OPERATOR_GE = 10;
/**
* ~
*/
public static final short SAC_OPERATOR_TILDE = 11;
/**
* identifier inherit
.
*/
public static final short SAC_INHERIT = 12;
/**
* Integers.
* @see #getIntegerValue
*/
public static final short SAC_INTEGER = 13;
/**
* reals.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_REAL = 14;
/**
* Relative lengthem
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_EM = 15;
/**
* Relative lengthex
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_EX = 16;
/**
* Relative length px
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_PIXEL = 17;
/**
* Absolute length in
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_INCH = 18;
/**
* Absolute length cm
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_CENTIMETER = 19;
/**
* Absolute length mm
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_MILLIMETER = 20;
/**
* Absolute length pt
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_POINT = 21;
/**
* Absolute length pc
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_PICA = 22;
/**
* Percentage.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_PERCENTAGE = 23;
/**
* URI: uri(...)
.
* @see #getStringValue
*/
public static final short SAC_URI = 24;
/**
* function counter
.
* @see #getFunctionName
* @see #getParameters
*/
public static final short SAC_COUNTER_FUNCTION = 25;
/**
* function counters
.
* @see #getFunctionName
* @see #getParameters
*/
public static final short SAC_COUNTERS_FUNCTION = 26;
/**
* RGB Colors.
* rgb(0, 0, 0)
and #000
* @see #getFunctionName
* @see #getParameters
*/
public static final short SAC_RGBCOLOR = 27;
/**
* Angle deg
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_DEGREE = 28;
/**
* Angle grad
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_GRADIAN = 29;
/**
* Angle rad
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_RADIAN = 30;
/**
* Time ms
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_MILLISECOND = 31;
/**
* Time s
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_SECOND = 32;
/**
* Frequency Hz
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_HERTZ = 33;
/**
* Frequency kHz
.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_KILOHERTZ = 34;
/**
* any identifier except inherit
.
* @see #getStringValue
*/
public static final short SAC_IDENT = 35;
/**
* A string.
* @see #getStringValue
*/
public static final short SAC_STRING_VALUE = 36;
/**
* Attribute: attr(...)
.
* @see #getStringValue
*/
public static final short SAC_ATTR = 37;
/**
* function rect
.
* @see #getFunctionName
* @see #getParameters
*/
public static final short SAC_RECT_FUNCTION = 38;
/**
* A unicode range. @@TO BE DEFINED
*/
public static final short SAC_UNICODERANGE = 39;
/**
* sub expressions
* (a)
(a + b)
(normal/none)
* @see #getSubValues
*/
public static final short SAC_SUB_EXPRESSION = 40;
/**
* unknown function.
* @see #getFunctionName
* @see #getParameters
*/
public static final short SAC_FUNCTION = 41;
/**
* unknown dimension.
* @see #getFloatValue
* @see #getDimensionUnitText
*/
public static final short SAC_DIMENSION = 42;
/**
* An integer indicating the type of LexicalUnit
.
*/
public short getLexicalUnitType();
/**
* Returns the next value or null
if any.
*/
public LexicalUnit getNextLexicalUnit();
/**
* Returns the previous value or null
if any.
*/
public LexicalUnit getPreviousLexicalUnit();
/**
* Returns the integer value.
* @see #SAC_INTEGER
*/
public int getIntegerValue();
/**
* Returns the float value.
*
If the type of LexicalUnit
is one of SAC_DEGREE,
* SAC_GRADIAN, SAC_RADIAN, SAC_MILLISECOND, SAC_SECOND, SAC_HERTZ
* or SAC_KILOHERTZ, the value can never be negative.
*
* @see #SAC_REAL
* @see #SAC_DIMENSION
* @see #SAC_EM
* @see #SAC_EX
* @see #SAC_PIXEL
* @see #SAC_INCH
* @see #SAC_CENTIMETER
* @see #SAC_MILLIMETER
* @see #SAC_POINT
* @see #SAC_PICA
* @see #SAC_PERCENTAGE
* @see #SAC_DEGREE
* @see #SAC_GRADIAN
* @see #SAC_RADIAN
* @see #SAC_MILLISECOND
* @see #SAC_SECOND
* @see #SAC_HERTZ
* @see #SAC_KILOHERTZ
*/
public float getFloatValue();
/**
* Returns the string representation of the unit.
* if this lexical unit represents a float, the dimension is an empty
* string.
* @see #SAC_REAL
* @see #SAC_DIMENSION
* @see #SAC_EM
* @see #SAC_EX
* @see #SAC_PIXEL
* @see #SAC_INCH
* @see #SAC_CENTIMETER
* @see #SAC_MILLIMETER
* @see #SAC_POINT
* @see #SAC_PICA
* @see #SAC_PERCENTAGE
* @see #SAC_DEGREE
* @see #SAC_GRADIAN
* @see #SAC_RADIAN
* @see #SAC_MILLISECOND
* @see #SAC_SECOND
* @see #SAC_HERTZ
* @see #SAC_KILOHERTZ
*/
public String getDimensionUnitText();
/**
* Returns the name of the function.
* @see #SAC_COUNTER_FUNCTION
* @see #SAC_COUNTERS_FUNCTION
* @see #SAC_RECT_FUNCTION
* @see #SAC_FUNCTION
* @see #SAC_RGBCOLOR
*/
public String getFunctionName();
/**
* The function parameters including operators (like the comma).
* #000
is converted to rgb(0, 0, 0)
* can return null
if SAC_FUNCTION
.
* @see #SAC_COUNTER_FUNCTION
* @see #SAC_COUNTERS_FUNCTION
* @see #SAC_RECT_FUNCTION
* @see #SAC_FUNCTION
* @see #SAC_RGBCOLOR
*/
public LexicalUnit getParameters();
/**
* Returns the string value.
* If the type is SAC_URI
, the return value doesn't contain
* uri(....)
or quotes.
*
If the type is SAC_ATTR
, the return value doesn't contain
* attr(....)
.
*
* @see #SAC_URI
* @see #SAC_ATTR
* @see #SAC_IDENT
* @see #SAC_STRING_VALUE
* @see #SAC_UNICODERANGE @@TO BE DEFINED
*/
public String getStringValue();
/**
* Returns a list of values inside the sub expression.
* @see #SAC_SUB_EXPRESSION
*/
public LexicalUnit getSubValues();
}