01: // DoubleAttribute.java
02: // $Id: DoubleAttribute.java,v 1.5 2002/06/09 10:14:29 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.resources;
07:
08: /**
09: * The generic description of an DoubleAttribute.
10: */
11:
12: public class DoubleAttribute extends SimpleAttribute {
13:
14: /**
15: * Is the given object a valid DoubleAttribute value ?
16: * @param obj The object to test.
17: * @return A boolean <strong>true</strong> if okay.
18: * @exception IllegalAttributeAccess If the provided value doesn't pass the
19: * test.
20: */
21:
22: public boolean checkValue(Object obj) {
23: return (obj instanceof Double);
24: }
25:
26: /**
27: * Pickle an integer to the given output stream.
28: * @param obj The object to pickle.
29: */
30:
31: public String pickle(Object obj) {
32: return ((Double) obj).toString();
33: }
34:
35: /**
36: * Unpickle an integer from the given input stream.
37: * @param value the string representation of this integer
38: * @return An instance of Integer.
39: */
40:
41: public Object unpickle(String value) {
42: return Double.valueOf(value);
43: }
44:
45: /**
46: * Create a description for a generic Double attribute.
47: * @param name The attribute name.
48: * @param def The default value for these attributes.
49: * @param flags The associated flags.
50: */
51:
52: public DoubleAttribute(String name, Double def, int flags) {
53: super (name, def, flags);
54: this .type = "java.lang.Double".intern();
55: }
56:
57: public DoubleAttribute() {
58: super();
59: }
60:
61: }
|