Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / tools / resources / FileAttribute.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/FileAttribute.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/FileAttribute.java
new file mode 100644 (file)
index 0000000..18b97e6
--- /dev/null
@@ -0,0 +1,57 @@
+// FileAttribute.java\r
+// $Id: FileAttribute.java,v 1.1 2010/06/15 12:20:24 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
+import java.io.File;\r
+\r
+/**\r
+ * The generic description of an FileAttribute.\r
+ */\r
+\r
+public class FileAttribute extends SimpleAttribute {\r
+\r
+    /**\r
+     * Is the given object a valid FileAttribute value ?\r
+     * @param obj The object to test.\r
+     * @return A boolean <strong>true</strong> if okay.\r
+     */\r
+\r
+    public boolean checkValue(Object obj) {\r
+       return (obj instanceof File);\r
+    }\r
+\r
+    /**\r
+     * Pickle an integer to the given output stream.\r
+     * @param obj The object to pickle.\r
+     */\r
+\r
+    public String pickle(Object obj) {\r
+       if (obj instanceof String)\r
+           return (String) obj;\r
+       else\r
+           return ((File) obj).getPath();\r
+    }\r
+\r
+    /**\r
+     * Unpickle an integer from the given input stream.\r
+     * @param value the string representation of this integer\r
+     * @return An instance of Integer.\r
+     */\r
+\r
+    public Object unpickle (String value) {\r
+       return new File(value);\r
+    }\r
+\r
+    public FileAttribute(String name, File def, int flags) {\r
+       super(name, def, flags) ;\r
+       this.type = "java.io.File".intern();\r
+    }\r
+\r
+    public FileAttribute() {\r
+       super() ;\r
+    }\r
+\r
+}\r