X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2Fcomponents%2Fatomic%2FModelMerger.java;h=6efc9ad3a49e420b2dbf3539d0e72bf88c747583;hb=6af791df52c447197af6dcccf9e8c5ccfdd6d805;hp=71523921d5085f6940858f7661029e39a56d686c;hpb=92862c4723c5eff22257e8de06166a124efb5d77;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelMerger.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelMerger.java index 71523921..6efc9ad3 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelMerger.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelMerger.java @@ -8,6 +8,8 @@ import net.mograsim.logic.core.types.BitVectorFormatter; import net.mograsim.logic.core.wires.CoreWire.ReadEnd; import net.mograsim.logic.model.model.LogicModelModifiable; import net.mograsim.logic.model.model.components.ModelComponent; +import net.mograsim.logic.model.model.components.Orientation; +import net.mograsim.logic.model.model.components.atomic.ModelSplitter.SplitterParams; import net.mograsim.logic.model.model.wires.Pin; import net.mograsim.logic.model.model.wires.PinUsage; import net.mograsim.logic.model.modeladapter.LogicCoreAdapter; @@ -18,6 +20,7 @@ import net.mograsim.preferences.ColorDefinition; import net.mograsim.preferences.ColorManager; import net.mograsim.preferences.Preferences; +//TODO delete this legacy class public class ModelMerger extends ModelComponent { private static final double width = 10; @@ -41,8 +44,8 @@ public class ModelMerger extends ModelComponent setSize(width, (logicWidth - 1) * heightPerPin); double inputHeight = (logicWidth - 1) * heightPerPin; for (int i = 0; i < logicWidth; i++, inputHeight -= 10) - addPin(new Pin(model, this, "I" + i, 1, PinUsage.TRISTATE, 0, inputHeight)); - addPin(this.outputPin = new Pin(model, this, "O", logicWidth, PinUsage.TRISTATE, width, (logicWidth - 1) * heightPerPin / 2)); + addPin(new Pin(model, this, "O" + i, 1, PinUsage.TRISTATE, 0, inputHeight)); + addPin(this.outputPin = new Pin(model, this, "I", logicWidth, PinUsage.TRISTATE, width, (logicWidth - 1) * heightPerPin / 2)); inputEnds = new ReadEnd[logicWidth]; init(); @@ -81,16 +84,26 @@ public class ModelMerger extends ModelComponent gc.setLineCap(oldLineCap); } + @Override + public Pin getPin(String name) + { + Pin pin = getPinOrNull(name); + return pin == null ? getPin(name.replace('O', 'i').replace('I', 'O').replace('i', 'I')) : pin; + } + @Override public String getIDForSerializing(IdentifyParams idParams) { - return "Merger"; + return "Splitter"; } @Override - public Integer getParamsForSerializing(IdentifyParams idParams) + public SplitterParams getParamsForSerializing(IdentifyParams idParams) { - return logicWidth; + SplitterParams splitterParams = new SplitterParams(); + splitterParams.logicWidth = logicWidth; + splitterParams.orientation = Orientation.LEFT; + return splitterParams; } public void setCoreModelBinding(ReadEnd[] inputEnds, ReadEnd outputEnd)