Fixed a bug in Am2900; created dlatch8/80; relayouted some components
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / components / submodels / SubmodelComponent.java
index ffe6ed6..9388e2f 100644 (file)
@@ -115,7 +115,7 @@ public abstract class SubmodelComponent extends ModelComponent
                this.supermodelPins = new HashMap<>();
                this.supermodelMovablePinsUnmodifiable = Collections.unmodifiableMap(supermodelPins);
                this.supermodelUnmovablePinsUnmodifiable = Collections.unmodifiableMap(supermodelPins);
-               this.submodelInterface = new SubmodelInterface(submodelModifiable, SUBMODEL_INTERFACE_NAME);
+               this.submodelInterface = new SubmodelInterface(submodelModifiable);
 
                this.submodelScale = 1;
                this.maxVisibleRegionFillRatioForAlpha0 = 0.8;
@@ -167,7 +167,7 @@ public abstract class SubmodelComponent extends ModelComponent
                default:
                        throw new IllegalArgumentException("Unknown enum constant: " + supermodelPin.usage);
                }
-               MovablePin submodelPin = new MovablePin(model, submodelInterface, name, supermodelPin.logicWidth, submodelPinUsage,
+               MovablePin submodelPin = new MovablePin(submodelModifiable, submodelInterface, name, supermodelPin.logicWidth, submodelPinUsage,
                                supermodelPin.getRelX() / submodelScale, supermodelPin.getRelY() / submodelScale);
 
                submodelPin.addPinMovedListener(p ->
@@ -429,14 +429,28 @@ public abstract class SubmodelComponent extends ModelComponent
 
        // serializing
 
+       /**
+        * {@link SubmodelComponent}'s implementation of {@link ModelComponent#getIDForSerializing(IdentifyParams)} returns "submodel". It is
+        * recommended to override this behaviour.
+        * 
+        * @see ModelComponent#getIDForSerializing(IdentifyParams)
+        * @see ModelComponent#getParamsForSerializing(IdentifyParams)
+        */
        @Override
        public String getIDForSerializing(IdentifyParams idParams)
        {
                return "submodel";// TODO what ID?
        }
 
+       /**
+        * {@link SubmodelComponent}'s implementation of {@link ModelComponent#getParamsForSerializing(IdentifyParams)} returns an instance of
+        * {@link SubmodelComponentParams}. It is recommended to override this behaviour.
+        * 
+        * @see ModelComponent#getIDForSerializing(IdentifyParams)
+        * @see ModelComponent#getParamsForSerializing(IdentifyParams)
+        */
        @Override
-       public SubmodelComponentParams getParamsForSerializing(IdentifyParams idParams)
+       public Object getParamsForSerializing(IdentifyParams idParams)
        {
                return SubmodelComponentSerializer.serialize(this, idParams);
        }