Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / tools / resources / upgrade / FrameArrayAttribute.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/upgrade/FrameArrayAttribute.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/upgrade/FrameArrayAttribute.java
new file mode 100644 (file)
index 0000000..6d6e722
--- /dev/null
@@ -0,0 +1,54 @@
+\r
+// FrameArrayAttribute.java\r
+// $Id: FrameArrayAttribute.java,v 1.1 2010/06/15 12:22:50 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.upgrade ;\r
+\r
+import java.io.DataInputStream;\r
+import java.io.DataOutputStream;\r
+import java.io.IOException;\r
+\r
+import org.w3c.tools.resources.ResourceFrame;\r
+import org.w3c.tools.resources.UnknownFrame;\r
+\r
+public class FrameArrayAttribute extends Attribute {\r
+\r
+    public boolean checkValue(Object value) {\r
+       return value instanceof ResourceFrame[];\r
+    }\r
+\r
+    public int getPickleLength(Object value) {\r
+       throw new RuntimeException("unused for upgrade");\r
+    }\r
+\r
+    public void pickle(DataOutputStream out, Object obj)\r
+       throws IOException\r
+    {\r
+       throw new RuntimeException("unused for upgrade");\r
+    }\r
+\r
+    public Object unpickle(DataInputStream in) \r
+       throws IOException\r
+    {\r
+       int cnt = in.readInt();\r
+       if ( cnt == 0 )\r
+           return null;\r
+       ResourceFrame frames[] = new ResourceFrame[cnt];\r
+       for (int i = 0 ; i < cnt ; i++) {\r
+           try {\r
+               frames[i] = (ResourceFrame) Upgrader.readResource(in);\r
+           } catch (UpgradeException ex) {\r
+               frames[i] = new UnknownFrame();\r
+           }\r
+       }\r
+       return frames;\r
+    }\r
+\r
+    public FrameArrayAttribute(String name, ResourceFrame def[],\r
+                               Integer flags) {\r
+       super(name, def, flags);\r
+    }\r
+\r
+}\r