- // As SubmodelComponent is abstract, for now SubmodelComponents are instantiated as SimpleRectangularSubmodelComponents
- CustomRectComponent comp = new CustomRectComponent(model, 0, "", path);
- comp.setSubmodelScale(params.composition.innerScale);
- comp.setSize(params.width, params.height);
- for (InterfacePinParams iPinParams : params.interfacePins)
+ // TODO: Clean up this mess
+ SubmodelComponent comp = null;
+ if (rectC.equals(params.type))
+ {
+ try
+ {
+ Map<String, Object> m = params.specialized;
+ SimpleRectangularSubmodelComponent rect = new CustomRectComponent(model,
+ ((Number) m.get(SimpleRectangularSubmodelComponent.kLogicWidth)).intValue(),
+ (String) m.get(SimpleRectangularSubmodelComponent.kLabel), path);
+ rect.setSubmodelScale(params.composition.innerScale);
+ rect.setSize(params.width, params.height);
+ rect.setInputCount(((Number) m.get(SimpleRectangularSubmodelComponent.kInCount)).intValue());
+ rect.setOutputCount(((Number) m.get(SimpleRectangularSubmodelComponent.kOutCount)).intValue());
+ comp = rect;
+ }
+ catch (ClassCastException | NullPointerException e)
+ {
+ System.err.println("Failed to specialize component!");
+ e.printStackTrace();
+ }
+ }
+ if (comp == null)