1 package net.mograsim.logic.ui.model.components;
3 import java.io.IOException;
6 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
7 import net.mograsim.logic.ui.util.JsonHandler;
10 * This class contains all the information necessary to create a new {@link SubmodelComponent}
12 public class SubmodelComponentParams
16 InterfacePinParams[] interfacePins;
17 ComponentCompositionParams composition;
18 Map<String, Object> specialized;
20 public static class InterfacePinParams
22 public Point location;
23 public int logicWidth;
26 public static class InnerWireParams
28 public InnerPinParams pin1, pin2;
32 public static class InnerPinParams
34 public int compId, pinIndex;
37 public static class ComponentCompositionParams
40 InnerComponentParams[] subComps;
41 InnerWireParams[] innerWires;
43 public static class InnerComponentParams
47 public int logicWidth;
51 public static SubmodelComponentParams readJson(String path) throws IOException
53 return JsonHandler.readJson(path, SubmodelComponentParams.class);
57 * Writes this {@link SubmodelComponentParams} object into a file in json format. The correct file extension is important! Check
58 * {@link SubmodelComponentParams}.fileExtension
60 public void writeJson(String path)
64 JsonHandler.writeJson(this, path);
68 System.err.println("Failed to write SubComponentParams to file");