diff options
Diffstat (limited to 'ddl/out/java/LambdaCube/PipelineSchema/JSON.java')
-rw-r--r-- | ddl/out/java/LambdaCube/PipelineSchema/JSON.java | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/ddl/out/java/LambdaCube/PipelineSchema/JSON.java b/ddl/out/java/LambdaCube/PipelineSchema/JSON.java new file mode 100644 index 0000000..4303a7f --- /dev/null +++ b/ddl/out/java/LambdaCube/PipelineSchema/JSON.java | |||
@@ -0,0 +1,122 @@ | |||
1 | // generated file, do not modify! | ||
2 | // 2016-03-21T11:41:52.343859000000Z | ||
3 | |||
4 | package LambdaCube.PipelineSchema; | ||
5 | |||
6 | import java.util.ArrayList; | ||
7 | import java.util.HashMap; | ||
8 | import org.json.*; | ||
9 | import RT.*; | ||
10 | |||
11 | import LambdaCube.IR.*; | ||
12 | |||
13 | public class JSON { | ||
14 | // JSON deserializer | ||
15 | public enum Type { | ||
16 | String, | ||
17 | Map_String_InputType, | ||
18 | Map_String_ObjectArraySchema, | ||
19 | Map_String_StreamType, | ||
20 | FetchPrimitive, | ||
21 | InputType, | ||
22 | ObjectArraySchema, | ||
23 | PipelineSchema, | ||
24 | StreamType | ||
25 | } | ||
26 | |||
27 | public static Object fromJSON(Type type, Object rawObj) throws JSONException, Exception { | ||
28 | switch (type) { | ||
29 | case String: return (String)rawObj; | ||
30 | /* | ||
31 | case Map_String_InputType: { | ||
32 | var map = new HashMap<String, InputType> (); | ||
33 | foreach(var i in (JSONObject)rawObj) { | ||
34 | map.Add( (String)fromJSON(Type.String,i.Key) | ||
35 | , (InputType)fromJSON(Type.InputType,i.Value)); | ||
36 | } | ||
37 | return map; | ||
38 | } | ||
39 | */ | ||
40 | /* | ||
41 | case Map_String_ObjectArraySchema: { | ||
42 | var map = new HashMap<String, ObjectArraySchema> (); | ||
43 | foreach(var i in (JSONObject)rawObj) { | ||
44 | map.Add( (String)fromJSON(Type.String,i.Key) | ||
45 | , (ObjectArraySchema)fromJSON(Type.ObjectArraySchema,i.Value)); | ||
46 | } | ||
47 | return map; | ||
48 | } | ||
49 | */ | ||
50 | /* | ||
51 | case Map_String_StreamType: { | ||
52 | var map = new HashMap<String, StreamType> (); | ||
53 | foreach(var i in (JSONObject)rawObj) { | ||
54 | map.Add( (String)fromJSON(Type.String,i.Key) | ||
55 | , (StreamType)fromJSON(Type.StreamType,i.Value)); | ||
56 | } | ||
57 | return map; | ||
58 | } | ||
59 | */ | ||
60 | |||
61 | case StreamType: { | ||
62 | JSONObject obj = (JSONObject)rawObj; | ||
63 | String tag = obj.getString("tag"); | ||
64 | StreamType.Tag tagType; | ||
65 | switch (tag) { | ||
66 | case "Attribute_Word": tagType = StreamType.Tag.Attribute_Word; break; | ||
67 | case "Attribute_V2U": tagType = StreamType.Tag.Attribute_V2U; break; | ||
68 | case "Attribute_V3U": tagType = StreamType.Tag.Attribute_V3U; break; | ||
69 | case "Attribute_V4U": tagType = StreamType.Tag.Attribute_V4U; break; | ||
70 | case "Attribute_Int": tagType = StreamType.Tag.Attribute_Int; break; | ||
71 | case "Attribute_V2I": tagType = StreamType.Tag.Attribute_V2I; break; | ||
72 | case "Attribute_V3I": tagType = StreamType.Tag.Attribute_V3I; break; | ||
73 | case "Attribute_V4I": tagType = StreamType.Tag.Attribute_V4I; break; | ||
74 | case "Attribute_Float": tagType = StreamType.Tag.Attribute_Float; break; | ||
75 | case "Attribute_V2F": tagType = StreamType.Tag.Attribute_V2F; break; | ||
76 | case "Attribute_V3F": tagType = StreamType.Tag.Attribute_V3F; break; | ||
77 | case "Attribute_V4F": tagType = StreamType.Tag.Attribute_V4F; break; | ||
78 | case "Attribute_M22F": tagType = StreamType.Tag.Attribute_M22F; break; | ||
79 | case "Attribute_M23F": tagType = StreamType.Tag.Attribute_M23F; break; | ||
80 | case "Attribute_M24F": tagType = StreamType.Tag.Attribute_M24F; break; | ||
81 | case "Attribute_M32F": tagType = StreamType.Tag.Attribute_M32F; break; | ||
82 | case "Attribute_M33F": tagType = StreamType.Tag.Attribute_M33F; break; | ||
83 | case "Attribute_M34F": tagType = StreamType.Tag.Attribute_M34F; break; | ||
84 | case "Attribute_M42F": tagType = StreamType.Tag.Attribute_M42F; break; | ||
85 | case "Attribute_M43F": tagType = StreamType.Tag.Attribute_M43F; break; | ||
86 | case "Attribute_M44F": tagType = StreamType.Tag.Attribute_M44F; break; | ||
87 | default: throw new Exception("unknown constructor: " + tag); | ||
88 | } | ||
89 | StreamType o = new StreamType(); | ||
90 | o.tag = tagType; | ||
91 | return o; | ||
92 | } | ||
93 | case ObjectArraySchema: { | ||
94 | JSONObject obj = (JSONObject)rawObj; | ||
95 | String tag = obj.getString("tag"); | ||
96 | switch (tag) { | ||
97 | case "ObjectArraySchema": { | ||
98 | ObjectArraySchema.ObjectArraySchema_ tv = new ObjectArraySchema().new ObjectArraySchema_(); | ||
99 | tv.primitive = (FetchPrimitive)fromJSON(Type.FetchPrimitive,obj.get("primitive")); | ||
100 | tv.attributes = (HashMap<String, StreamType>)fromJSON(Type.Map_String_StreamType,obj.get("attributes")); | ||
101 | return tv; | ||
102 | } | ||
103 | default: throw new Exception("unknown constructor: " + tag); | ||
104 | } | ||
105 | } | ||
106 | case PipelineSchema: { | ||
107 | JSONObject obj = (JSONObject)rawObj; | ||
108 | String tag = obj.getString("tag"); | ||
109 | switch (tag) { | ||
110 | case "PipelineSchema": { | ||
111 | PipelineSchema.PipelineSchema_ tv = new PipelineSchema().new PipelineSchema_(); | ||
112 | tv.objectArrays = (HashMap<String, ObjectArraySchema>)fromJSON(Type.Map_String_ObjectArraySchema,obj.get("objectArrays")); | ||
113 | tv.uniforms = (HashMap<String, InputType>)fromJSON(Type.Map_String_InputType,obj.get("uniforms")); | ||
114 | return tv; | ||
115 | } | ||
116 | default: throw new Exception("unknown constructor: " + tag); | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | throw new Exception("unknown type"); | ||
121 | } | ||
122 | } \ No newline at end of file | ||