Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / tools / resources / StringAttribute.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/StringAttribute.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/StringAttribute.java
new file mode 100644 (file)
index 0000000..503137e
--- /dev/null
@@ -0,0 +1,49 @@
+// StringAttribute.java\r
+// $Id: StringAttribute.java,v 1.1 2010/06/15 12:20:20 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.tools.resources ;\r
+\r
+/**\r
+ * The generic description of an StringAttribute.\r
+ */\r
+\r
+public class StringAttribute extends SimpleAttribute {\r
+\r
+    /**\r
+     * Is the given object a valid StringAttribute value ?\r
+     * @param obj The object to test.\r
+     * @return A boolean <strong>true</strong> if value is valid.\r
+     */\r
+\r
+    public boolean checkValue(Object obj) {\r
+       return (obj instanceof String) || (obj == null) ;\r
+    }\r
+\r
+    public String pickle(Object obj) {\r
+       return (String)obj;\r
+    }\r
+\r
+    public Object unpickle (String value) {\r
+       return value;\r
+    }\r
+\r
+    /**\r
+     * Create a description for a generic String attribute.\r
+     * @param name The attribute name.\r
+     * @param def The default value for these attributes.\r
+     * @param flags The associated flags.\r
+     */\r
+\r
+    public StringAttribute(String name, String def, int flags) {\r
+       super(name, def, flags) ;\r
+       this.type = "java.lang.String".intern();\r
+    }\r
+\r
+    public StringAttribute() {\r
+       super();\r
+    }\r
+}\r
+\r
+\r