X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fserializing%2FSubmodelComponentParams.java;h=97b3c7c16299a9d74bcd9ccc24ab74232c7e97c0;hb=8bed58cd47f4e53a0a83e066d38864aa6875502f;hp=afce226c787dda3a8914d1be8566fe7e3f5e5a36;hpb=b5d8c2d71e27350ea7c9314e40df5bb0584271cd;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/SubmodelComponentParams.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/SubmodelComponentParams.java index afce226c..97b3c7c1 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/SubmodelComponentParams.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/SubmodelComponentParams.java @@ -1,83 +1,43 @@ package net.mograsim.logic.model.serializing; -import java.io.IOException; - import com.google.gson.JsonElement; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.mograsim.logic.model.model.components.submodels.SubmodelComponent; -import net.mograsim.logic.model.util.JsonHandler; +import net.mograsim.logic.model.model.wires.PinUsage; +import net.mograsim.logic.model.util.Version; /** * This class contains all the information necessary to create a new {@link SubmodelComponent} */ -public class SubmodelComponentParams +public class SubmodelComponentParams extends SerializablePojo { // basic stuff public double width, height; public InterfacePinParams[] interfacePins; - public SubmodelParameters submodel; + public double innerScale; + public LogicModelParams submodel; // functionality that needs to be expressed in Java code - public String outlineRendererSnippetID; - public JsonElement outlineRendererParams; - public String symbolRendererSnippetID; public JsonElement symbolRendererParams; - public static class InterfacePinParams - { - public Point location; - public String name; - public int logicWidth; - } - - public static class SubmodelParameters - { - public double innerScale; - public InnerComponentParams[] subComps; - public InnerWireParams[] innerWires; - - public static class InnerComponentParams - { - public Point pos; - public String id; - public String name; - public JsonElement params; - } - - public static class InnerWireParams - { - public InnerPinParams pin1, pin2; - public Point[] path; + public String outlineRendererSnippetID; + public JsonElement outlineRendererParams; - public static class InnerPinParams - { - public String compName; - public String pinName; - } - } - } + public String highLevelStateHandlerSnippetID; + public JsonElement highLevelStateHandlerParams; - public static SubmodelComponentParams readJson(String path) throws IOException + public SubmodelComponentParams(Version version) { - return JsonHandler.readJson(path, SubmodelComponentParams.class); + super(version); } - /** - * Writes this {@link SubmodelComponentParams} object into a file in json format. The correct file extension is important! Check - * {@link SubmodelComponentParams}.fileExtension - */ - public void writeJson(String path) + public static class InterfacePinParams { - try - { - JsonHandler.writeJson(this, path); - } - catch (IOException e) - { - System.err.println("Failed to write SubComponentParams to file"); - e.printStackTrace(); - } + public Point location; + public String name; + public int logicWidth; + public PinUsage usage; } } \ No newline at end of file