KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > css > sac > LexicalUnit


1 /*
2  * Copyright (c) 1999 World Wide Web Consortium
3  * (Massachusetts Institute of Technology, Institut National de Recherche
4  * en Informatique et en Automatique, Keio University).
5  * All Rights Reserved. http://www.w3.org/Consortium/Legal/
6  *
7  * $Id: LexicalUnit.java,v 1.1.1.1 2003/12/28 21:23:51 davidsch Exp $
8  */

9 package org.w3c.css.sac;
10
11 /**
12  * This is a lexical unit for CSS values.
13  * <p><b>Remarks</b>: Not all the following lexical units are supported (or
14  * will be supported) by CSS.
15  * <p>All examples are CSS2 compliant.
16  *
17  * @version $Revision: 1.1.1.1 $
18  * @author Philippe Le Hegaret
19  */

20 public interface LexicalUnit {
21     
22     /**
23      * ,
24      */

25     public static final short SAC_OPERATOR_COMMA = 0;
26     /**
27      * +
28      */

29     public static final short SAC_OPERATOR_PLUS = 1;
30     /**
31      * -
32      */

33     public static final short SAC_OPERATOR_MINUS = 2;
34     /**
35      * *
36      */

37     public static final short SAC_OPERATOR_MULTIPLY = 3;
38     /**
39      * /
40      */

41     public static final short SAC_OPERATOR_SLASH = 4;
42     /**
43      * %
44      */

45     public static final short SAC_OPERATOR_MOD = 5;
46     /**
47      * ^
48      */

49     public static final short SAC_OPERATOR_EXP = 6;
50     /**
51      * <
52      */

53     public static final short SAC_OPERATOR_LT = 7;
54     /**
55      * >
56      */

57     public static final short SAC_OPERATOR_GT = 8;
58     /**
59      * <=
60      */

61     public static final short SAC_OPERATOR_LE = 9;
62     /**
63      * >=
64      */

65     public static final short SAC_OPERATOR_GE = 10;
66     /**
67      * ~
68      */

69     public static final short SAC_OPERATOR_TILDE = 11;
70     
71     /**
72      * identifier <code>inherit</code>.
73      */

74     public static final short SAC_INHERIT = 12;
75     /**
76      * Integers.
77      * @see #getIntegerValue
78      */

79     public static final short SAC_INTEGER = 13;
80     /**
81      * reals.
82      * @see #getFloatValue
83      * @see #getDimensionUnitText
84      */

85     public static final short SAC_REAL = 14;
86     /**
87      * Relative length<code>em</code>.
88      * @see #getFloatValue
89      * @see #getDimensionUnitText
90      */

91     public static final short SAC_EM = 15;
92     /**
93      * Relative length<code>ex</code>.
94      * @see #getFloatValue
95      * @see #getDimensionUnitText
96      */

97     public static final short SAC_EX = 16;
98     /**
99      * Relative length <code>px</code>.
100      * @see #getFloatValue
101      * @see #getDimensionUnitText
102      */

103     public static final short SAC_PIXEL = 17;
104     /**
105      * Absolute length <code>in</code>.
106      * @see #getFloatValue
107      * @see #getDimensionUnitText
108      */

109     public static final short SAC_INCH = 18;
110     /**
111      * Absolute length <code>cm</code>.
112      * @see #getFloatValue
113      * @see #getDimensionUnitText
114      */

115     public static final short SAC_CENTIMETER = 19;
116     /**
117      * Absolute length <code>mm</code>.
118      * @see #getFloatValue
119      * @see #getDimensionUnitText
120      */

121     public static final short SAC_MILLIMETER = 20;
122     /**
123      * Absolute length <code>pt</code>.
124      * @see #getFloatValue
125      * @see #getDimensionUnitText
126      */

127     public static final short SAC_POINT = 21;
128     /**
129      * Absolute length <code>pc</code>.
130      * @see #getFloatValue
131      * @see #getDimensionUnitText
132      */

133     public static final short SAC_PICA = 22;
134     /**
135      * Percentage.
136      * @see #getFloatValue
137      * @see #getDimensionUnitText
138      */

139     public static final short SAC_PERCENTAGE = 23;
140     /**
141      * URI: <code>uri(...)</code>.
142      * @see #getStringValue
143      */

144     public static final short SAC_URI = 24;
145     /**
146      * function <code>counter</code>.
147      * @see #getFunctionName
148      * @see #getParameters
149      */

150     public static final short SAC_COUNTER_FUNCTION = 25;
151     /**
152      * function <code>counters</code>.
153      * @see #getFunctionName
154      * @see #getParameters
155      */

156     public static final short SAC_COUNTERS_FUNCTION = 26;
157     /**
158      * RGB Colors.
159      * <code>rgb(0, 0, 0)</code> and <code>#000</code>
160      * @see #getFunctionName
161      * @see #getParameters
162      */

163     public static final short SAC_RGBCOLOR = 27;
164     /**
165      * Angle <code>deg</code>.
166      * @see #getFloatValue
167      * @see #getDimensionUnitText
168      */

169     public static final short SAC_DEGREE = 28;
170     /**
171      * Angle <code>grad</code>.
172      * @see #getFloatValue
173      * @see #getDimensionUnitText
174      */

175     public static final short SAC_GRADIAN = 29;
176     /**
177      * Angle <code>rad</code>.
178      * @see #getFloatValue
179      * @see #getDimensionUnitText
180      */

181     public static final short SAC_RADIAN = 30;
182     /**
183      * Time <code>ms</code>.
184      * @see #getFloatValue
185      * @see #getDimensionUnitText
186      */

187     public static final short SAC_MILLISECOND = 31;
188     /**
189      * Time <code>s</code>.
190      * @see #getFloatValue
191      * @see #getDimensionUnitText
192      */

193     public static final short SAC_SECOND = 32;
194     /**
195      * Frequency <code>Hz</code>.
196      * @see #getFloatValue
197      * @see #getDimensionUnitText
198      */

199     public static final short SAC_HERTZ = 33;
200     /**
201      * Frequency <code>kHz</code>.
202      * @see #getFloatValue
203      * @see #getDimensionUnitText
204      */

205     public static final short SAC_KILOHERTZ = 34;
206     
207     /**
208      * any identifier except <code>inherit</code>.
209      * @see #getStringValue
210      */

211     public static final short SAC_IDENT = 35;
212     /**
213      * A string.
214      * @see #getStringValue
215      */

216     public static final short SAC_STRING_VALUE = 36;
217     /**
218      * Attribute: <code>attr(...)</code>.
219      * @see #getStringValue
220      */

221     public static final short SAC_ATTR = 37;
222     /**
223      * function <code>rect</code>.
224      * @see #getFunctionName
225      * @see #getParameters
226      */

227     public static final short SAC_RECT_FUNCTION = 38;
228     /**
229      * A unicode range. @@TO BE DEFINED
230      */

231     public static final short SAC_UNICODERANGE = 39;
232     
233     /**
234      * sub expressions
235      * <code>(a)</code> <code>(a + b)</code> <code>(normal/none)</code>
236      * @see #getSubValues
237      */

238     public static final short SAC_SUB_EXPRESSION = 40;
239     
240     /**
241      * unknown function.
242      * @see #getFunctionName
243      * @see #getParameters
244      */

245     public static final short SAC_FUNCTION = 41;
246     /**
247      * unknown dimension.
248      * @see #getFloatValue
249      * @see #getDimensionUnitText
250      */

251     public static final short SAC_DIMENSION = 42;
252     
253     /**
254      * An integer indicating the type of <code>LexicalUnit</code>.
255      */

256     public short getLexicalUnitType();
257     
258     /**
259      * Returns the next value or <code>null</code> if any.
260      */

261     public LexicalUnit getNextLexicalUnit();
262     
263     /**
264      * Returns the previous value or <code>null</code> if any.
265      */

266     public LexicalUnit getPreviousLexicalUnit();
267     
268     /**
269      * Returns the integer value.
270      * @see #SAC_INTEGER
271      */

272     public int getIntegerValue();
273     
274     
275     /**
276      * Returns the float value.
277      * <p>If the type of <code>LexicalUnit</code> is one of SAC_DEGREE,
278      * SAC_GRADIAN, SAC_RADIAN, SAC_MILLISECOND, SAC_SECOND, SAC_HERTZ
279      * or SAC_KILOHERTZ, the value can never be negative.</p>
280      *
281      * @see #SAC_REAL
282      * @see #SAC_DIMENSION
283      * @see #SAC_EM
284      * @see #SAC_EX
285      * @see #SAC_PIXEL
286      * @see #SAC_INCH
287      * @see #SAC_CENTIMETER
288      * @see #SAC_MILLIMETER
289      * @see #SAC_POINT
290      * @see #SAC_PICA
291      * @see #SAC_PERCENTAGE
292      * @see #SAC_DEGREE
293      * @see #SAC_GRADIAN
294      * @see #SAC_RADIAN
295      * @see #SAC_MILLISECOND
296      * @see #SAC_SECOND
297      * @see #SAC_HERTZ
298      * @see #SAC_KILOHERTZ
299      */

300     public float getFloatValue();
301     
302     /**
303      * Returns the string representation of the unit.
304      * <p>if this lexical unit represents a float, the dimension is an empty
305      * string.</p>
306      * @see #SAC_REAL
307      * @see #SAC_DIMENSION
308      * @see #SAC_EM
309      * @see #SAC_EX
310      * @see #SAC_PIXEL
311      * @see #SAC_INCH
312      * @see #SAC_CENTIMETER
313      * @see #SAC_MILLIMETER
314      * @see #SAC_POINT
315      * @see #SAC_PICA
316      * @see #SAC_PERCENTAGE
317      * @see #SAC_DEGREE
318      * @see #SAC_GRADIAN
319      * @see #SAC_RADIAN
320      * @see #SAC_MILLISECOND
321      * @see #SAC_SECOND
322      * @see #SAC_HERTZ
323      * @see #SAC_KILOHERTZ
324      */

325     public String JavaDoc getDimensionUnitText();
326     
327     /**
328      * Returns the name of the function.
329      * @see #SAC_COUNTER_FUNCTION
330      * @see #SAC_COUNTERS_FUNCTION
331      * @see #SAC_RECT_FUNCTION
332      * @see #SAC_FUNCTION
333      * @see #SAC_RGBCOLOR
334      */

335     public String JavaDoc getFunctionName();
336     
337     /**
338      * The function parameters including operators (like the comma).
339      * <code>#000</code> is converted to <code>rgb(0, 0, 0)</code>
340      * can return <code>null</code> if <code>SAC_FUNCTION</code>.
341      * @see #SAC_COUNTER_FUNCTION
342      * @see #SAC_COUNTERS_FUNCTION
343      * @see #SAC_RECT_FUNCTION
344      * @see #SAC_FUNCTION
345      * @see #SAC_RGBCOLOR
346      */

347     public LexicalUnit getParameters();
348
349     /**
350      * Returns the string value.
351      * <p>If the type is <code>SAC_URI</code>, the return value doesn't contain
352      * <code>uri(....)</code> or quotes.
353      * <p>If the type is <code>SAC_ATTR</code>, the return value doesn't contain
354      * <code>attr(....)</code>.
355      *
356      * @see #SAC_URI
357      * @see #SAC_ATTR
358      * @see #SAC_IDENT
359      * @see #SAC_STRING_VALUE
360      * @see #SAC_UNICODERANGE @@TO BE DEFINED
361      */

362     public String JavaDoc getStringValue();
363
364     /**
365      * Returns a list of values inside the sub expression.
366      * @see #SAC_SUB_EXPRESSION
367      */

368     public LexicalUnit getSubValues();
369     
370 }
371
Popular Tags