File: LexicalUnit.java

package info (click to toggle)
sacjava 1.3%2Bdfsg-5.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 240 kB
  • sloc: java: 480; xml: 31; makefile: 11
file content (370 lines) | stat: -rw-r--r-- 9,560 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
/*
 * 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,v 1.9 2000/03/08 20:55:33 plehegar Exp $
 */
package org.w3c.css.sac;

/**
 * This is a lexical unit for CSS values.
 * <p><b>Remarks</b>: Not all the following lexical units are supported (or
 * will be supported) by CSS.
 * <p>All examples are CSS2 compliant.
 *
 * @version $Revision: 1.9 $
 * @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 <code>inherit</code>.
     */
    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 length<code>em</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_EM		= 15;
    /**
     * Relative length<code>ex</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_EX		= 16;
    /**
     * Relative length <code>px</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_PIXEL		= 17;
    /**
     * Absolute length <code>in</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_INCH		= 18;
    /**
     * Absolute length <code>cm</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_CENTIMETER	= 19;
    /**
     * Absolute length <code>mm</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_MILLIMETER	= 20;
    /**
     * Absolute length <code>pt</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_POINT		= 21;
    /**
     * Absolute length <code>pc</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_PICA		= 22;
    /**
     * Percentage.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_PERCENTAGE		= 23;
    /**
     * URI: <code>uri(...)</code>.
     * @see #getStringValue
     */
    public static final short SAC_URI		        = 24;
    /**
     * function <code>counter</code>.
     * @see #getFunctionName
     * @see #getParameters
     */
    public static final short SAC_COUNTER_FUNCTION	= 25;
    /**
     * function <code>counters</code>.
     * @see #getFunctionName
     * @see #getParameters
     */
    public static final short SAC_COUNTERS_FUNCTION	= 26;
    /**
     * RGB Colors.
     * <code>rgb(0, 0, 0)</code> and <code>#000</code>
     * @see #getFunctionName
     * @see #getParameters
     */
    public static final short SAC_RGBCOLOR		= 27;
    /**
     * Angle <code>deg</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_DEGREE		= 28;
    /**
     * Angle <code>grad</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_GRADIAN		= 29;
    /**
     * Angle <code>rad</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_RADIAN		= 30;
    /**
     * Time <code>ms</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_MILLISECOND		= 31;
    /**
     * Time <code>s</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_SECOND		= 32;
    /**
     * Frequency <code>Hz</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_HERTZ		        = 33;
    /**
     * Frequency <code>kHz</code>.
     * @see #getFloatValue
     * @see #getDimensionUnitText
     */
    public static final short SAC_KILOHERTZ		= 34;
    
    /**
     * any identifier except <code>inherit</code>.
     * @see #getStringValue
     */
    public static final short SAC_IDENT		        = 35;
    /**
     * A string.
     * @see #getStringValue
     */
    public static final short SAC_STRING_VALUE		= 36;
    /**
     * Attribute: <code>attr(...)</code>.
     * @see #getStringValue
     */
    public static final short SAC_ATTR		        = 37;
    /**
     * function <code>rect</code>.
     * @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
     * <code>(a)</code> <code>(a + b)</code> <code>(normal/none)</code>
     * @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 <code>LexicalUnit</code>.
     */
    public short       getLexicalUnitType();
    
    /**
     * Returns the next value or <code>null</code> if any.
     */
    public LexicalUnit getNextLexicalUnit();
    
    /**
     * Returns the previous value or <code>null</code> if any.
     */
    public LexicalUnit getPreviousLexicalUnit();
    
    /**
     * Returns the integer value.
     * @see #SAC_INTEGER
     */
    public int getIntegerValue();
    
    
    /**
     * Returns the float value.
     * <p>If the type of <code>LexicalUnit</code> is one of SAC_DEGREE,
     * SAC_GRADIAN, SAC_RADIAN, SAC_MILLISECOND, SAC_SECOND, SAC_HERTZ
     * or SAC_KILOHERTZ, the value can never be negative.</p>
     *
     * @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.
     * <p>if this lexical unit represents a float, the dimension is an empty
     * string.</p>
     * @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).
     * <code>#000</code> is converted to <code>rgb(0, 0, 0)</code>
     * can return <code>null</code> if <code>SAC_FUNCTION</code>.
     * @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.
     * <p>If the type is <code>SAC_URI</code>, the return value doesn't contain
     * <code>uri(....)</code> or quotes.
     * <p>If the type is <code>SAC_ATTR</code>, the return value doesn't contain
     * <code>attr(....)</code>.
     *
     * @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();
    
}