org.w3c.css.sac

Interface LexicalUnit

public interface LexicalUnit

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

Field Summary
static shortSAC_ATTR
Attribute: attr(...).
static shortSAC_CENTIMETER
Absolute length cm.
static shortSAC_COUNTERS_FUNCTION
function counters.
static shortSAC_COUNTER_FUNCTION
function counter.
static shortSAC_DEGREE
Angle deg.
static shortSAC_DIMENSION
unknown dimension.
static shortSAC_EM
Relative lengthem.
static shortSAC_EX
Relative lengthex.
static shortSAC_FUNCTION
unknown function.
static shortSAC_GRADIAN
Angle grad.
static shortSAC_HERTZ
Frequency Hz.
static shortSAC_IDENT
any identifier except inherit.
static shortSAC_INCH
Absolute length in.
static shortSAC_INHERIT
identifier inherit.
static shortSAC_INTEGER
Integers.
static shortSAC_KILOHERTZ
Frequency kHz.
static shortSAC_MILLIMETER
Absolute length mm.
static shortSAC_MILLISECOND
Time ms.
static shortSAC_OPERATOR_COMMA
,
static shortSAC_OPERATOR_EXP
^
static shortSAC_OPERATOR_GE
>=
static shortSAC_OPERATOR_GT
>
static shortSAC_OPERATOR_LE
<=
static shortSAC_OPERATOR_LT
<
static shortSAC_OPERATOR_MINUS
-
static shortSAC_OPERATOR_MOD
%
static shortSAC_OPERATOR_MULTIPLY
*
static shortSAC_OPERATOR_PLUS
+
static shortSAC_OPERATOR_SLASH
/
static shortSAC_OPERATOR_TILDE
~
static shortSAC_PERCENTAGE
Percentage.
static shortSAC_PICA
Absolute length pc.
static shortSAC_PIXEL
Relative length px.
static shortSAC_POINT
Absolute length pt.
static shortSAC_RADIAN
Angle rad.
static shortSAC_REAL
reals.
static shortSAC_RECT_FUNCTION
function rect.
static shortSAC_RGBCOLOR
RGB Colors.
static shortSAC_SECOND
Time s.
static shortSAC_STRING_VALUE
A string.
static shortSAC_SUB_EXPRESSION
sub expressions (a) (a + b) (normal/none)
static shortSAC_UNICODERANGE
A unicode range.
static shortSAC_URI
URI: uri(...).
Method Summary
StringgetDimensionUnitText()
Returns the string representation of the unit.
floatgetFloatValue()
Returns the float value.
StringgetFunctionName()
Returns the name of the function.
intgetIntegerValue()
Returns the integer value.
shortgetLexicalUnitType()
An integer indicating the type of LexicalUnit.
LexicalUnitgetNextLexicalUnit()
Returns the next value or null if any.
LexicalUnitgetParameters()
The function parameters including operators (like the comma).
LexicalUnitgetPreviousLexicalUnit()
Returns the previous value or null if any.
StringgetStringValue()
Returns the string value.
LexicalUnitgetSubValues()
Returns a list of values inside the sub expression.

Field Detail

SAC_ATTR

public static final short SAC_ATTR
Attribute: attr(...).

See Also: LexicalUnit

SAC_CENTIMETER

public static final short SAC_CENTIMETER
Absolute length cm.

See Also: LexicalUnit LexicalUnit

SAC_COUNTERS_FUNCTION

public static final short SAC_COUNTERS_FUNCTION
function counters.

See Also: LexicalUnit LexicalUnit

SAC_COUNTER_FUNCTION

public static final short SAC_COUNTER_FUNCTION
function counter.

See Also: LexicalUnit LexicalUnit

SAC_DEGREE

public static final short SAC_DEGREE
Angle deg.

See Also: LexicalUnit LexicalUnit

SAC_DIMENSION

public static final short SAC_DIMENSION
unknown dimension.

See Also: LexicalUnit LexicalUnit

SAC_EM

public static final short SAC_EM
Relative lengthem.

See Also: LexicalUnit LexicalUnit

SAC_EX

public static final short SAC_EX
Relative lengthex.

See Also: LexicalUnit LexicalUnit

SAC_FUNCTION

public static final short SAC_FUNCTION
unknown function.

See Also: LexicalUnit LexicalUnit

SAC_GRADIAN

public static final short SAC_GRADIAN
Angle grad.

See Also: LexicalUnit LexicalUnit

SAC_HERTZ

public static final short SAC_HERTZ
Frequency Hz.

See Also: LexicalUnit LexicalUnit

SAC_IDENT

public static final short SAC_IDENT
any identifier except inherit.

See Also: LexicalUnit

SAC_INCH

public static final short SAC_INCH
Absolute length in.

See Also: LexicalUnit LexicalUnit

SAC_INHERIT

public static final short SAC_INHERIT
identifier inherit.

SAC_INTEGER

public static final short SAC_INTEGER
Integers.

See Also: LexicalUnit

SAC_KILOHERTZ

public static final short SAC_KILOHERTZ
Frequency kHz.

See Also: LexicalUnit LexicalUnit

SAC_MILLIMETER

public static final short SAC_MILLIMETER
Absolute length mm.

See Also: LexicalUnit LexicalUnit

SAC_MILLISECOND

public static final short SAC_MILLISECOND
Time ms.

See Also: LexicalUnit LexicalUnit

SAC_OPERATOR_COMMA

public static final short SAC_OPERATOR_COMMA
,

SAC_OPERATOR_EXP

public static final short SAC_OPERATOR_EXP
^

SAC_OPERATOR_GE

public static final short SAC_OPERATOR_GE
>=

SAC_OPERATOR_GT

public static final short SAC_OPERATOR_GT
>

SAC_OPERATOR_LE

public static final short SAC_OPERATOR_LE
<=

SAC_OPERATOR_LT

public static final short SAC_OPERATOR_LT
<

SAC_OPERATOR_MINUS

public static final short SAC_OPERATOR_MINUS
-

SAC_OPERATOR_MOD

public static final short SAC_OPERATOR_MOD
%

SAC_OPERATOR_MULTIPLY

public static final short SAC_OPERATOR_MULTIPLY
*

SAC_OPERATOR_PLUS

public static final short SAC_OPERATOR_PLUS
+

SAC_OPERATOR_SLASH

public static final short SAC_OPERATOR_SLASH
/

SAC_OPERATOR_TILDE

public static final short SAC_OPERATOR_TILDE
~

SAC_PERCENTAGE

public static final short SAC_PERCENTAGE
Percentage.

See Also: LexicalUnit LexicalUnit

SAC_PICA

public static final short SAC_PICA
Absolute length pc.

See Also: LexicalUnit LexicalUnit

SAC_PIXEL

public static final short SAC_PIXEL
Relative length px.

See Also: LexicalUnit LexicalUnit

SAC_POINT

public static final short SAC_POINT
Absolute length pt.

See Also: LexicalUnit LexicalUnit

SAC_RADIAN

public static final short SAC_RADIAN
Angle rad.

See Also: LexicalUnit LexicalUnit

SAC_REAL

public static final short SAC_REAL
reals.

See Also: LexicalUnit LexicalUnit

SAC_RECT_FUNCTION

public static final short SAC_RECT_FUNCTION
function rect.

See Also: LexicalUnit LexicalUnit

SAC_RGBCOLOR

public static final short SAC_RGBCOLOR
RGB Colors. rgb(0, 0, 0) and #000

See Also: LexicalUnit LexicalUnit

SAC_SECOND

public static final short SAC_SECOND
Time s.

See Also: LexicalUnit LexicalUnit

SAC_STRING_VALUE

public static final short SAC_STRING_VALUE
A string.

See Also: LexicalUnit

SAC_SUB_EXPRESSION

public static final short SAC_SUB_EXPRESSION
sub expressions (a) (a + b) (normal/none)

See Also: LexicalUnit

SAC_UNICODERANGE

public static final short SAC_UNICODERANGE
A unicode range. @@TO BE DEFINED

SAC_URI

public static final short SAC_URI
URI: uri(...).

See Also: LexicalUnit

Method Detail

getDimensionUnitText

public String getDimensionUnitText()
Returns the string representation of the unit.

if this lexical unit represents a float, the dimension is an empty string.

See Also: SAC_REAL SAC_DIMENSION SAC_EM SAC_EX SAC_PIXEL SAC_INCH SAC_CENTIMETER SAC_MILLIMETER SAC_POINT SAC_PICA SAC_PERCENTAGE SAC_DEGREE SAC_GRADIAN SAC_RADIAN SAC_MILLISECOND SAC_SECOND SAC_HERTZ SAC_KILOHERTZ

getFloatValue

public float getFloatValue()
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 Also: SAC_REAL SAC_DIMENSION SAC_EM SAC_EX SAC_PIXEL SAC_INCH SAC_CENTIMETER SAC_MILLIMETER SAC_POINT SAC_PICA SAC_PERCENTAGE SAC_DEGREE SAC_GRADIAN SAC_RADIAN SAC_MILLISECOND SAC_SECOND SAC_HERTZ SAC_KILOHERTZ

getFunctionName

public String getFunctionName()
Returns the name of the function.

See Also: SAC_COUNTER_FUNCTION SAC_COUNTERS_FUNCTION SAC_RECT_FUNCTION SAC_FUNCTION SAC_RGBCOLOR

getIntegerValue

public int getIntegerValue()
Returns the integer value.

See Also: SAC_INTEGER

getLexicalUnitType

public short getLexicalUnitType()
An integer indicating the type of LexicalUnit.

getNextLexicalUnit

public LexicalUnit getNextLexicalUnit()
Returns the next value or null if any.

getParameters

public LexicalUnit getParameters()
The function parameters including operators (like the comma). #000 is converted to rgb(0, 0, 0) can return null if SAC_FUNCTION.

See Also: SAC_COUNTER_FUNCTION SAC_COUNTERS_FUNCTION SAC_RECT_FUNCTION SAC_FUNCTION SAC_RGBCOLOR

getPreviousLexicalUnit

public LexicalUnit getPreviousLexicalUnit()
Returns the previous value or null if any.

getStringValue

public String getStringValue()
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 Also: SAC_URI SAC_ATTR SAC_IDENT SAC_STRING_VALUE @@TO BE DEFINED

getSubValues

public LexicalUnit getSubValues()
Returns a list of values inside the sub expression.

See Also: SAC_SUB_EXPRESSION