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.

Field Summary

static short
SAC_ATTR
Attribute: attr(...).
static short
SAC_CENTIMETER
Absolute length cm.
static short
SAC_COUNTERS_FUNCTION
function counters.
static short
SAC_COUNTER_FUNCTION
function counter.
static short
SAC_DEGREE
Angle deg.
static short
SAC_DIMENSION
unknown dimension.
static short
SAC_EM
Relative lengthem.
static short
SAC_EX
Relative lengthex.
static short
SAC_FUNCTION
unknown function.
static short
SAC_GRADIAN
Angle grad.
static short
SAC_HERTZ
Frequency Hz.
static short
SAC_IDENT
any identifier except inherit.
static short
SAC_INCH
Absolute length in.
static short
SAC_INHERIT
identifier inherit.
static short
SAC_INTEGER
Integers.
static short
SAC_KILOHERTZ
Frequency kHz.
static short
SAC_MILLIMETER
Absolute length mm.
static short
SAC_MILLISECOND
Time ms.
static short
SAC_OPERATOR_COMMA
,
static short
SAC_OPERATOR_EXP
^
static short
SAC_OPERATOR_GE
>=
static short
SAC_OPERATOR_GT
>
static short
SAC_OPERATOR_LE
<=
static short
SAC_OPERATOR_LT
<10
static short
SAC_OPERATOR_MINUS
-
static short
SAC_OPERATOR_MOD
%
static short
SAC_OPERATOR_MULTIPLY
*
static short
SAC_OPERATOR_PLUS
+
static short
SAC_OPERATOR_SLASH
/
static short
SAC_OPERATOR_TILDE
~
static short
SAC_PERCENTAGE
Percentage.
static short
SAC_PICA
Absolute length pc.
static short
SAC_PIXEL
Relative length px.
static short
SAC_POINT
Absolute length pt.
static short
SAC_RADIAN
Angle rad.
static short
SAC_REAL
reals.
static short
SAC_RECT_FUNCTION
function rect.
static short
SAC_RGBCOLOR
RGB Colors.
static short
SAC_SECOND
Time s.
static short
SAC_STRING_VALUE
A string.
static short
SAC_SUB_EXPRESSION
sub expressions (a) (a + b) (normal/none)
static short
SAC_UNICODERANGE
A unicode range.
static short
SAC_URI
URI: uri(...).

Method Summary

String
getDimensionUnitText()
Returns the string representation of the unit.
float
getFloatValue()
Returns the float value.
String
getFunctionName()
Returns the name of the function.
int
getIntegerValue()
Returns the integer value.
short
getLexicalUnitType()
An integer indicating the type of LexicalUnit.
LexicalUnit
getNextLexicalUnit()
Returns the next value or null if any.
LexicalUnit
getParameters()
The function parameters including operators (like the comma).
LexicalUnit
getPreviousLexicalUnit()
Returns the previous value or null if any.
String
getStringValue()
Returns the string value.
LexicalUnit
getSubValues()
Returns a list of values inside the sub expression.

Field Details

SAC_ATTR

public static final short SAC_ATTR
Attribute: attr(...).
Field Value:
37

SAC_CENTIMETER

public static final short SAC_CENTIMETER
Absolute length cm.
Field Value:
19

SAC_COUNTERS_FUNCTION

public static final short SAC_COUNTERS_FUNCTION
function counters.
Field Value:
26

SAC_COUNTER_FUNCTION

public static final short SAC_COUNTER_FUNCTION
function counter.
Field Value:
25

SAC_DEGREE

public static final short SAC_DEGREE
Angle deg.
Field Value:
28

SAC_DIMENSION

public static final short SAC_DIMENSION
unknown dimension.
Field Value:
42

SAC_EM

public static final short SAC_EM
Relative lengthem.
Field Value:
15

SAC_EX

public static final short SAC_EX
Relative lengthex.
Field Value:
16

SAC_FUNCTION

public static final short SAC_FUNCTION
unknown function.
Field Value:
41

SAC_GRADIAN

public static final short SAC_GRADIAN
Angle grad.
Field Value:
29

SAC_HERTZ

public static final short SAC_HERTZ
Frequency Hz.
Field Value:
33

SAC_IDENT

public static final short SAC_IDENT
any identifier except inherit.
Field Value:
35

SAC_INCH

public static final short SAC_INCH
Absolute length in.
Field Value:
18

SAC_INHERIT

public static final short SAC_INHERIT
identifier inherit.
Field Value:
12

SAC_INTEGER

public static final short SAC_INTEGER
Integers.
Field Value:
13

SAC_KILOHERTZ

public static final short SAC_KILOHERTZ
Frequency kHz.
Field Value:
34

SAC_MILLIMETER

public static final short SAC_MILLIMETER
Absolute length mm.
Field Value:
20

SAC_MILLISECOND

public static final short SAC_MILLISECOND
Time ms.
Field Value:
31

SAC_OPERATOR_COMMA

public static final short SAC_OPERATOR_COMMA
,
Field Value:
0

SAC_OPERATOR_EXP

public static final short SAC_OPERATOR_EXP
^
Field Value:
6

SAC_OPERATOR_GE

public static final short SAC_OPERATOR_GE
>=
Field Value:
10

SAC_OPERATOR_GT

public static final short SAC_OPERATOR_GT
>
Field Value:
8

SAC_OPERATOR_LE

public static final short SAC_OPERATOR_LE
<=
Field Value:
9

SAC_OPERATOR_LT

public static final short SAC_OPERATOR_LT
<10
Field Value:
7

SAC_OPERATOR_MINUS

public static final short SAC_OPERATOR_MINUS
-
Field Value:
2

SAC_OPERATOR_MOD

public static final short SAC_OPERATOR_MOD
%
Field Value:
5

SAC_OPERATOR_MULTIPLY

public static final short SAC_OPERATOR_MULTIPLY
*
Field Value:
3

SAC_OPERATOR_PLUS

public static final short SAC_OPERATOR_PLUS
+
Field Value:
1

SAC_OPERATOR_SLASH

public static final short SAC_OPERATOR_SLASH
/
Field Value:
4

SAC_OPERATOR_TILDE

public static final short SAC_OPERATOR_TILDE
~
Field Value:
11

SAC_PERCENTAGE

public static final short SAC_PERCENTAGE
Percentage.
Field Value:
23

SAC_PICA

public static final short SAC_PICA
Absolute length pc.
Field Value:
22

SAC_PIXEL

public static final short SAC_PIXEL
Relative length px.
Field Value:
17

SAC_POINT

public static final short SAC_POINT
Absolute length pt.
Field Value:
21

SAC_RADIAN

public static final short SAC_RADIAN
Angle rad.
Field Value:
30

SAC_REAL

public static final short SAC_REAL
reals.
Field Value:
14

SAC_RECT_FUNCTION

public static final short SAC_RECT_FUNCTION
function rect.
Field Value:
38

SAC_RGBCOLOR

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

SAC_SECOND

public static final short SAC_SECOND
Time s.
Field Value:
32

SAC_STRING_VALUE

public static final short SAC_STRING_VALUE
A string.
Field Value:
36

SAC_SUB_EXPRESSION

public static final short SAC_SUB_EXPRESSION
sub expressions (a) (a + b) (normal/none)
Field Value:
40

SAC_UNICODERANGE

public static final short SAC_UNICODERANGE
A unicode range. @@TO BE DEFINED
Field Value:
39

SAC_URI

public static final short SAC_URI
URI: uri(...).
Field Value:
24

Method Details

getDimensionUnitText

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

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


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.


getFunctionName

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

getIntegerValue

public int getIntegerValue()
Returns the integer value.

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.

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(....).


getSubValues

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