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;
24 public int logicWidth;
27 public static class InnerWireParams
29 public InnerPinParams pin1, pin2;
33 public static class InnerPinParams
35 public int compId, pinIndex;
38 public static class ComponentCompositionParams
41 InnerComponentParams[] subComps;
42 InnerWireParams[] innerWires;
44 public static class InnerComponentParams
48 public int logicWidth;
52 public static SubmodelComponentParams readJson(String path) throws IOException
54 return JsonHandler.readJson(path, SubmodelComponentParams.class);
58 * Writes this {@link SubmodelComponentParams} object into a file in json format. The correct file extension is important! Check
59 * {@link SubmodelComponentParams}.fileExtension
61 public void writeJson(String path)
65 JsonHandler.writeJson(this, path);
69 System.err.println("Failed to write SubComponentParams to file");