1 package net.mograsim.logic.model.serializing;
3 import com.google.gson.JsonElement;
5 import net.mograsim.logic.model.model.LogicModelModifiable;
6 import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
7 import net.mograsim.logic.model.model.wires.MovablePin;
8 import net.mograsim.logic.model.model.wires.Pin;
9 import net.mograsim.logic.model.snippets.HighLevelStateHandler;
10 import net.mograsim.logic.model.snippets.Renderer;
12 public class DeserializedSubmodelComponent extends SubmodelComponent
15 * If a DeserializedSubmodelComponent is part of another SubmodelComponent, when it it serialized, it should not return its internal
16 * structure, but rather the component ID used to create it.
18 * @see SubmodelComponentSerializer#deserialize(LogicModelModifiable, SubmodelComponentParams, String, String, JsonElement)
19 * SubmodelComponentSerializer.deserialize(...)
20 * @see SubmodelComponentSerializer#serialize(SubmodelComponent, java.util.function.Function) SubmodelComponentSerializer.serialize(...)
22 public final String idForSerializingOverride;
24 * See {@link #idForSerializingOverride}
26 public final JsonElement paramsForSerializingOverride;
28 public DeserializedSubmodelComponent(LogicModelModifiable model, String name, String idForSerializingOverride,
29 JsonElement paramsForSerializingOverride)
31 super(model, name, false);
32 this.idForSerializingOverride = idForSerializingOverride;
33 this.paramsForSerializingOverride = paramsForSerializingOverride;
38 public void setSymbolRenderer(Renderer symbolRenderer)
40 super.setSymbolRenderer(symbolRenderer);
44 public void setOutlineRenderer(Renderer outlineRenderer)
46 super.setOutlineRenderer(outlineRenderer);
50 public void setHighLevelStateHandler(HighLevelStateHandler handler)
52 super.setHighLevelStateHandler(handler);
55 public LogicModelModifiable getSubmodelModifiable()
57 return submodelModifiable;
61 public void setSubmodelScale(double submodelScale)
63 super.setSubmodelScale(submodelScale);
67 public void setSize(double width, double height)
69 super.setSize(width, height);
73 public Pin addSubmodelInterface(MovablePin supermodelPin)
75 return super.addSubmodelInterface(supermodelPin);
79 public void removeSubmodelInterface(String name)
81 super.removeSubmodelInterface(name);