From: Fabian Stemmler Date: Mon, 24 Jun 2019 14:25:25 +0000 (+0200) Subject: Merge branch 'development' of https://gitlab.lrz.de/lrr-tum/students/eragp-misim... X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=10ce5cc888d0b781069822cecd85e33e6be8f54b;hp=-c;p=Mograsim.git Merge branch 'development' of https://gitlab.lrz.de/lrr-tum/students/eragp-misim-2019.git into development --- 10ce5cc888d0b781069822cecd85e33e6be8f54b diff --combined net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java index 6e566c48,4c86ae1d..2c8324af --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java @@@ -12,6 -12,7 +12,7 @@@ import java.util.function.Supplier import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.ui.model.ViewModelModifiable; + import net.mograsim.logic.ui.model.Visitable; import net.mograsim.logic.ui.model.wires.Pin; /** @@@ -20,7 -21,7 +21,7 @@@ * * @author Daniel Kirschten */ - public abstract class GUIComponent + public abstract class GUIComponent implements Visitable { /** * The model this component is a part of. @@@ -43,7 -44,7 +44,7 @@@ private final Runnable redrawListenerForSubcomponents; // Defines how the GUIComponent is referenced in SubmodelComponentParams - protected Supplier identifierDelegate = () -> "class:".concat(getClass().getCanonicalName()); + protected Supplier identifierDelegate = () -> getClass().getSimpleName(); // creation and destruction diff --combined net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java index 59d800a4,04a6fcc2..2fd94c6a --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java @@@ -12,6 -12,7 +12,7 @@@ import net.haspamelodica.swt.helper.gcs import net.haspamelodica.swt.helper.swtobjectwrappers.Font; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; + import net.mograsim.logic.ui.model.ModelVisitor; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.wires.MovablePin; import net.mograsim.logic.ui.model.wires.Pin; @@@ -128,8 -129,8 +129,8 @@@ public class SimpleRectangularSubmodelC ret.type = SimpleRectangularSubmodelComponent.class.getSimpleName(); Map m = new TreeMap<>(); m.put(kLabel, label); - m.put(kInCount, inputPinNames.size()); - m.put(kOutCount, outputPinNames.size()); + m.put(kInCount, inputPinNames.toArray()); + m.put(kOutCount, outputPinNames.toArray()); m.put(kLogicWidth, logicWidth); ret.specialized = m; return ret; @@@ -155,4 -156,10 +156,10 @@@ throw new UnsupportedOperationException( "Can't set the size of a SimpleRectangularSubmodelComponent directly, call setInputPins / setOutputPins instead"); } + + @Override + public void accept(ModelVisitor mv) + { + mv.visit(this); + } } diff --combined net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SubmodelComponent.java index 6f34cd26,bb6cca17..3db44fdf --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SubmodelComponent.java @@@ -331,7 -331,6 +331,7 @@@ public abstract class SubmodelComponen public SubmodelComponentParams calculateParams() { SubmodelComponentParams params = new SubmodelComponentParams(); + params.name = getIdentifier(); params.type = SubmodelComponent.class.getSimpleName(); params.composition = calculateCompositionParams(); @@@ -369,8 -368,8 +369,8 @@@ InnerComponentParams inner = new InnerComponentParams(); comps[i] = inner; inner.params = component.getInstantiationParameters(); - inner.pos = new Point(getPosX(), getPosY()); - inner.type = component.getIdentifier(); + inner.pos = new Point(component.getPosX(), component.getPosY()); + inner.name = component.getIdentifier(); i++; } params.subComps = comps; @@@ -397,6 -396,16 +397,16 @@@ return params; } + public List getComponents() + { + return submodel.getComponents(); + } + + public List getWires() + { + return submodel.getWires(); + } + // operations no longer supported @Override