diff options
Diffstat (limited to 'ddl/out/java/LambdaCube/PipelineSchema/JSON.java')
-rw-r--r-- | ddl/out/java/LambdaCube/PipelineSchema/JSON.java | 135 |
1 files changed, 134 insertions, 1 deletions
diff --git a/ddl/out/java/LambdaCube/PipelineSchema/JSON.java b/ddl/out/java/LambdaCube/PipelineSchema/JSON.java index 1fec7e8..1667518 100644 --- a/ddl/out/java/LambdaCube/PipelineSchema/JSON.java +++ b/ddl/out/java/LambdaCube/PipelineSchema/JSON.java | |||
@@ -1,11 +1,12 @@ | |||
1 | // generated file, do not modify! | 1 | // generated file, do not modify! |
2 | // 2016-03-21T14:06:55.360355000000Z | 2 | // 2016-03-21T15:32:17.702608000000Z |
3 | 3 | ||
4 | package LambdaCube.PipelineSchema; | 4 | package LambdaCube.PipelineSchema; |
5 | 5 | ||
6 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
7 | import java.util.HashMap; | 7 | import java.util.HashMap; |
8 | import java.util.Iterator; | 8 | import java.util.Iterator; |
9 | import java.util.Map; | ||
9 | import org.json.*; | 10 | import org.json.*; |
10 | import RT.*; | 11 | import RT.*; |
11 | 12 | ||
@@ -120,4 +121,136 @@ public class JSON { | |||
120 | } | 121 | } |
121 | throw new Exception("unknown type"); | 122 | throw new Exception("unknown type"); |
122 | } | 123 | } |
124 | |||
125 | public static Object toJSON(Type type, Object rawObj) throws JSONException, Exception { | ||
126 | switch (type) { | ||
127 | case StreamType: { | ||
128 | StreamType v = (StreamType)rawObj; | ||
129 | JSONObject obj = new JSONObject(); | ||
130 | switch (v.tag) { | ||
131 | case Attribute_Word: | ||
132 | obj.put("tag", "Attribute_Word"); | ||
133 | break; | ||
134 | case Attribute_V2U: | ||
135 | obj.put("tag", "Attribute_V2U"); | ||
136 | break; | ||
137 | case Attribute_V3U: | ||
138 | obj.put("tag", "Attribute_V3U"); | ||
139 | break; | ||
140 | case Attribute_V4U: | ||
141 | obj.put("tag", "Attribute_V4U"); | ||
142 | break; | ||
143 | case Attribute_Int: | ||
144 | obj.put("tag", "Attribute_Int"); | ||
145 | break; | ||
146 | case Attribute_V2I: | ||
147 | obj.put("tag", "Attribute_V2I"); | ||
148 | break; | ||
149 | case Attribute_V3I: | ||
150 | obj.put("tag", "Attribute_V3I"); | ||
151 | break; | ||
152 | case Attribute_V4I: | ||
153 | obj.put("tag", "Attribute_V4I"); | ||
154 | break; | ||
155 | case Attribute_Float: | ||
156 | obj.put("tag", "Attribute_Float"); | ||
157 | break; | ||
158 | case Attribute_V2F: | ||
159 | obj.put("tag", "Attribute_V2F"); | ||
160 | break; | ||
161 | case Attribute_V3F: | ||
162 | obj.put("tag", "Attribute_V3F"); | ||
163 | break; | ||
164 | case Attribute_V4F: | ||
165 | obj.put("tag", "Attribute_V4F"); | ||
166 | break; | ||
167 | case Attribute_M22F: | ||
168 | obj.put("tag", "Attribute_M22F"); | ||
169 | break; | ||
170 | case Attribute_M23F: | ||
171 | obj.put("tag", "Attribute_M23F"); | ||
172 | break; | ||
173 | case Attribute_M24F: | ||
174 | obj.put("tag", "Attribute_M24F"); | ||
175 | break; | ||
176 | case Attribute_M32F: | ||
177 | obj.put("tag", "Attribute_M32F"); | ||
178 | break; | ||
179 | case Attribute_M33F: | ||
180 | obj.put("tag", "Attribute_M33F"); | ||
181 | break; | ||
182 | case Attribute_M34F: | ||
183 | obj.put("tag", "Attribute_M34F"); | ||
184 | break; | ||
185 | case Attribute_M42F: | ||
186 | obj.put("tag", "Attribute_M42F"); | ||
187 | break; | ||
188 | case Attribute_M43F: | ||
189 | obj.put("tag", "Attribute_M43F"); | ||
190 | break; | ||
191 | case Attribute_M44F: | ||
192 | obj.put("tag", "Attribute_M44F"); | ||
193 | break; | ||
194 | } | ||
195 | return obj; | ||
196 | } | ||
197 | case ObjectArraySchema: { | ||
198 | ObjectArraySchema v = (ObjectArraySchema)rawObj; | ||
199 | JSONObject obj = new JSONObject(); | ||
200 | switch (v.tag) { | ||
201 | case ObjectArraySchema: | ||
202 | obj.put("tag", "ObjectArraySchema"); | ||
203 | { | ||
204 | ObjectArraySchema.ObjectArraySchema_ tv = (ObjectArraySchema.ObjectArraySchema_)v; | ||
205 | obj.put("primitive", toJSON(Type.FetchPrimitive,tv.primitive)); | ||
206 | obj.put("attributes", toJSON(Type.Map_String_StreamType,tv.attributes)); | ||
207 | } | ||
208 | break; | ||
209 | } | ||
210 | return obj; | ||
211 | } | ||
212 | case PipelineSchema: { | ||
213 | PipelineSchema v = (PipelineSchema)rawObj; | ||
214 | JSONObject obj = new JSONObject(); | ||
215 | switch (v.tag) { | ||
216 | case PipelineSchema: | ||
217 | obj.put("tag", "PipelineSchema"); | ||
218 | { | ||
219 | PipelineSchema.PipelineSchema_ tv = (PipelineSchema.PipelineSchema_)v; | ||
220 | obj.put("objectArrays", toJSON(Type.Map_String_ObjectArraySchema,tv.objectArrays)); | ||
221 | obj.put("uniforms", toJSON(Type.Map_String_InputType,tv.uniforms)); | ||
222 | } | ||
223 | break; | ||
224 | } | ||
225 | return obj; | ||
226 | } | ||
227 | |||
228 | case String: { return rawObj; } | ||
229 | case Map_String_InputType: { | ||
230 | HashMap<String, InputType> v = (HashMap<String, InputType>)rawObj; | ||
231 | JSONObject obj = new JSONObject(); | ||
232 | for (Map.Entry<String,InputType> i : v.entrySet()) { | ||
233 | obj.put(i.getKey(), toJSON(Type.InputType,i.getValue())); | ||
234 | } | ||
235 | return obj; | ||
236 | } | ||
237 | case Map_String_ObjectArraySchema: { | ||
238 | HashMap<String, ObjectArraySchema> v = (HashMap<String, ObjectArraySchema>)rawObj; | ||
239 | JSONObject obj = new JSONObject(); | ||
240 | for (Map.Entry<String,ObjectArraySchema> i : v.entrySet()) { | ||
241 | obj.put(i.getKey(), toJSON(Type.ObjectArraySchema,i.getValue())); | ||
242 | } | ||
243 | return obj; | ||
244 | } | ||
245 | case Map_String_StreamType: { | ||
246 | HashMap<String, StreamType> v = (HashMap<String, StreamType>)rawObj; | ||
247 | JSONObject obj = new JSONObject(); | ||
248 | for (Map.Entry<String,StreamType> i : v.entrySet()) { | ||
249 | obj.put(i.getKey(), toJSON(Type.StreamType,i.getValue())); | ||
250 | } | ||
251 | return obj; | ||
252 | } | ||
253 | } | ||
254 | return null; | ||
255 | } | ||
123 | } \ No newline at end of file | 256 | } \ No newline at end of file |