KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cypress > CssFloat


1 /*
2 ** Cypress - CSS Parser
3 ** Copyright (c) 2001, 2002, 2003 by Gerald Bauer
4 **
5 ** This program is free software.
6 **
7 ** You may redistribute it and/or modify it under the terms of the GNU
8 ** Lesser General Public License as published by the Free Software Foundation.
9 ** Version 2.1 of the license should be included with this distribution in
10 ** the file LICENSE, as well as License.html. If the license is not
11 ** included with this distribution, you may find a copy at the FSF web
12 ** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
13 ** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
14 **
15 ** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
16 ** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
17 ** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
18 ** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
19 ** REDISTRIBUTION OF THIS SOFTWARE.
20 **
21 */

22
23 package cypress;
24
25 public class CssFloat extends CssValue
26 {
27
28    private float _value;
29
30    private CssFloat( float value, int type, CssValue prev )
31    {
32       super( type, prev );
33       _value = value;
34    }
35
36    public float getFloatValue()
37    {
38       return _value;
39    }
40
41    public static CssFloat createCentimeter( float value, CssValue prev )
42    {
43       return new CssFloat( value, CENTIMETER, prev );
44    }
45
46    public static CssFloat createEm( float value, CssValue prev )
47    {
48       return new CssFloat( value, EM, prev );
49    }
50
51    public static CssFloat createEx( float value, CssValue prev )
52    {
53       return new CssFloat( value, EX, prev );
54    }
55
56
57    public static CssFloat createInch( float value, CssValue prev )
58    {
59       return new CssFloat( value, INCH, prev );
60    }
61
62    public static CssFloat createMillimeter( float value, CssValue prev )
63    {
64       return new CssFloat( value, MILLIMETER, prev );
65    }
66
67    public static CssFloat createPercentage( float value, CssValue prev )
68    {
69       return new CssFloat( value, PERCENTAGE, prev );
70    }
71
72    public static CssFloat createPica( float value, CssValue prev )
73    {
74       return new CssFloat( value, PICA, prev );
75    }
76
77    public static CssFloat createPixel( float value, CssValue prev )
78    {
79       return new CssFloat( value, PIXEL, prev );
80    }
81
82    public static CssFloat createPoint( float value, CssValue prev )
83    {
84       return new CssFloat( value, POINT, prev );
85    }
86
87    public static CssFloat createReal( float value, CssValue prev )
88    {
89       return new CssFloat( value, REAL, prev );
90    }
91
92    public String JavaDoc toString()
93    {
94       return "float: " + _value;
95    }
96 }
97
Popular Tags