static
{
- IndirectGUIComponentCreator.setComponentProvider(GUI_rsLatch.class.getCanonicalName(), (m, p) -> new GUI_rsLatch(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUI_rsLatch.class.getCanonicalName(), (m, p) -> new GUI_rsLatch(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIand.class.getCanonicalName(), (m, p) -> new GUIand(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIand.class.getCanonicalName(), (m, p) -> new GUIand(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIand41.class.getCanonicalName(), (m, p) -> new GUIand41(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIand41.class.getCanonicalName(), (m, p) -> new GUIand41(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIandor414.class.getCanonicalName(), (m, p) -> new GUIandor414(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIandor414.class.getCanonicalName(), (m, p) -> new GUIandor414(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIdemux2.class.getCanonicalName(), (m, p) -> new GUIdemux2(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIdemux2.class.getCanonicalName(), (m, p) -> new GUIdemux2(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIdff.class.getCanonicalName(), (m, p) -> new GUIdff(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIdff.class.getCanonicalName(), (m, p) -> new GUIdff(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIdlatch.class.getCanonicalName(), (m, p) -> new GUIdlatch(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIdlatch.class.getCanonicalName(), (m, p) -> new GUIdlatch(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIdlatch4.class.getCanonicalName(), (m, p) -> new GUIdlatch4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIdlatch4.class.getCanonicalName(), (m, p) -> new GUIdlatch4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIfulladder.class.getCanonicalName(), (m, p) -> new GUIfulladder(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIfulladder.class.getCanonicalName(), (m, p) -> new GUIfulladder(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIhalfadder.class.getCanonicalName(), (m, p) -> new GUIhalfadder(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIhalfadder.class.getCanonicalName(), (m, p) -> new GUIhalfadder(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUImux1.class.getCanonicalName(), (m, p) -> new GUImux1(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUImux1.class.getCanonicalName(), (m, p) -> new GUImux1(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUImux1_4.class.getCanonicalName(), (m, p) -> new GUImux1_4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUImux1_4.class.getCanonicalName(), (m, p) -> new GUImux1_4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUInand3.class.getCanonicalName(), (m, p) -> new GUInand3(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUInand3.class.getCanonicalName(), (m, p) -> new GUInand3(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUInot4.class.getCanonicalName(), (m, p) -> new GUInot4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUInot4.class.getCanonicalName(), (m, p) -> new GUInot4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIor4.class.getCanonicalName(), (m, p) -> new GUIor4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIor4.class.getCanonicalName(), (m, p) -> new GUIor4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIor_4.class.getCanonicalName(), (m, p) -> new GUIor_4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIor_4.class.getCanonicalName(), (m, p) -> new GUIor_4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIram2.class.getCanonicalName(), (m, p) -> new GUIram2(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIram2.class.getCanonicalName(), (m, p) -> new GUIram2(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIram4.class.getCanonicalName(), (m, p) -> new GUIram4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIram4.class.getCanonicalName(), (m, p) -> new GUIram4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIsel2_4.class.getCanonicalName(), (m, p) -> new GUIsel2_4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIsel2_4.class.getCanonicalName(), (m, p) -> new GUIsel2_4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIsel3_4.class.getCanonicalName(), (m, p) -> new GUIsel3_4(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIsel3_4.class.getCanonicalName(), (m, p) -> new GUIsel3_4(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIxor.class.getCanonicalName(), (m, p) -> new GUIxor(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIxor.class.getCanonicalName(), (m, p) -> new GUIxor(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901.class.getCanonicalName(), (m, p) -> new GUIAm2901(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901.class.getCanonicalName(), (m, p) -> new GUIAm2901(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUFuncDecode.class.getCanonicalName(),
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUFuncDecode.class.getCanonicalName(),
(m, p) -> new GUIAm2901ALUFuncDecode(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUInclDecode.class.getCanonicalName(),
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUInclDecode.class.getCanonicalName(),
(m, p) -> new GUIAm2901ALUInclDecode(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUInclSourceDecodeInclFunctionDecode.class.getCanonicalName(),
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUInclSourceDecodeInclFunctionDecode.class.getCanonicalName(),
(m, p) -> new GUIAm2901ALUInclSourceDecodeInclFunctionDecode(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUOneBit.class.getCanonicalName(), (m, p) -> new GUIAm2901ALUOneBit(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901ALUOneBit.class.getCanonicalName(), (m, p) -> new GUIAm2901ALUOneBit(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901DestDecode.class.getCanonicalName(),
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901DestDecode.class.getCanonicalName(),
(m, p) -> new GUIAm2901DestDecode(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901QReg.class.getCanonicalName(), (m, p) -> new GUIAm2901QReg(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901QReg.class.getCanonicalName(), (m, p) -> new GUIAm2901QReg(m));
}
}
\ No newline at end of file
static
{
- IndirectGUIComponentCreator.setComponentProvider(GUIAm2901SourceDecode.class.getCanonicalName(),
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901SourceDecode.class.getCanonicalName(),
(m, p) -> new GUIAm2901SourceDecode(m));
}
}
\ No newline at end of file
static
{
ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(GUIAndGate.class, AndGate::new));
- IndirectGUIComponentCreator.setComponentProvider(GUIAndGate.class.getCanonicalName(), (m, p) -> new GUIAndGate(m, p.getAsInt()));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIAndGate.class.getCanonicalName(), (m, p) -> new GUIAndGate(m, p.getAsInt()));
}
}
\ No newline at end of file
static
{
ViewLogicModelAdapter.addComponentAdapter(new BitDisplayAdapter());
- IndirectGUIComponentCreator.setComponentProvider(GUIBitDisplay.class.getCanonicalName(), (m, p) -> new GUIBitDisplay(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIBitDisplay.class.getCanonicalName(), (m, p) -> new GUIBitDisplay(m));
}
}
\ No newline at end of file
static
{
ViewLogicModelAdapter.addComponentAdapter(new ManualSwitchAdapter());
- IndirectGUIComponentCreator.setComponentProvider(GUIManualSwitch.class.getName(), (m, p) -> new GUIManualSwitch(m));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIManualSwitch.class.getName(), (m, p) -> new GUIManualSwitch(m));
}
}
\ No newline at end of file
static
{
ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(GUINandGate.class, NandGate::new));
- IndirectGUIComponentCreator.setComponentProvider(GUINandGate.class.getCanonicalName(), (m, p) -> new GUINandGate(m, p.getAsInt()));
+ IndirectGUIComponentCreator.setComponentSupplier(GUINandGate.class.getCanonicalName(), (m, p) -> new GUINandGate(m, p.getAsInt()));
}
}
\ No newline at end of file
static
{
ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(GUINotGate.class, (t, p, o, i) -> new NotGate(t, p, i[0], o)));
- IndirectGUIComponentCreator.setComponentProvider(GUINotGate.class.getCanonicalName(), (m, p) -> new GUINotGate(m, p.getAsInt()));
+ IndirectGUIComponentCreator.setComponentSupplier(GUINotGate.class.getCanonicalName(), (m, p) -> new GUINotGate(m, p.getAsInt()));
}
}
\ No newline at end of file
static
{
ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(GUIOrGate.class, OrGate::new));
- IndirectGUIComponentCreator.setComponentProvider(GUIOrGate.class.getCanonicalName(), (m, p) -> new GUIOrGate(m, p.getAsInt()));
+ IndirectGUIComponentCreator.setComponentSupplier(GUIOrGate.class.getCanonicalName(), (m, p) -> new GUIOrGate(m, p.getAsInt()));
}
}
\ No newline at end of file
static\r
{\r
ViewLogicModelAdapter.addComponentAdapter(new NoLogicAdapter<>(TextComponent.class));\r
- IndirectGUIComponentCreator.setComponentProvider(TextComponent.class.getName(), (m, p) -> new TextComponent(m, p.getAsString()));\r
+ IndirectGUIComponentCreator.setComponentSupplier(TextComponent.class.getName(), (m, p) -> new TextComponent(m, p.getAsString()));\r
}\r
}\r
static
{
- IndirectGUIComponentCreator.setComponentProvider(WireCrossPoint.class.getCanonicalName(),
+ IndirectGUIComponentCreator.setComponentSupplier(WireCrossPoint.class.getCanonicalName(),
(m, p) -> new WireCrossPoint(m, p.getAsInt()));
}
}
\ No newline at end of file
public class CodeSnippetSupplier<S>
{
// public static members
- public static final CodeSnippetSupplier<Renderer> symbolRendererProviderSupplier;
- public static final CodeSnippetSupplier<Renderer> outlineRendererProviderSupplier;
+ public static final CodeSnippetSupplier<Renderer> symbolRendererSupplier;
+ public static final CodeSnippetSupplier<Renderer> outlineRendererSupplier;
static
{
- symbolRendererProviderSupplier = new CodeSnippetSupplier<>(SnippetSupplier.create(Void.class, DefaultSymbolRenderer::new));
- outlineRendererProviderSupplier = new CodeSnippetSupplier<>(SnippetSupplier.create(Void.class, DefaultOutlineRenderer::new));
+ symbolRendererSupplier = new CodeSnippetSupplier<>(SnippetSupplier.create(Void.class, DefaultSymbolRenderer::new));
+ outlineRendererSupplier = new CodeSnippetSupplier<>(SnippetSupplier.create(Void.class, DefaultOutlineRenderer::new));
}
// per-instance members
private final Map<String, String> standardSnippetIDClassNames = new HashMap<>();
- private final Map<String, SnippetSupplier<?, S>> snippetProvidersForClassNames = new HashMap<>();
- private final SnippetSupplier<?, S> defaultSnippetProvider;
+ private final Map<String, SnippetSupplier<?, S>> snippetSuppliersForClassNames = new HashMap<>();
+ private final SnippetSupplier<?, S> defaultSnippetSupplier;
- private CodeSnippetSupplier(SnippetSupplier<?, S> defaultSnippetProvider)
+ private CodeSnippetSupplier(SnippetSupplier<?, S> defaultSnippetSupplier)
{
- this.defaultSnippetProvider = defaultSnippetProvider;
+ this.defaultSnippetSupplier = defaultSnippetSupplier;
}
public void addStandardSnippetID(String standardSnippetID, String associatedSnippetClassName)
standardSnippetIDClassNames.put(standardSnippetID, associatedSnippetClassName);
}
- public void setSnippetProvider(String id, SnippetSupplier<?, S> snippetProvider)
+ public void setSnippetSupplier(String id, SnippetSupplier<?, S> snippetSupplier)
{
- snippetProvidersForClassNames.put(id, snippetProvider);
+ snippetSuppliersForClassNames.put(id, snippetSupplier);
}
// TODO report errors
- public SnippetSupplier<?, S> getSnippetProvider(String id)
+ public SnippetSupplier<?, S> getSnippetSupplier(String id)
{
if (id != null)
{
- String snippetProviderClassName;
+ String snippetClassName;
if (id.startsWith("class:"))
- snippetProviderClassName = id.substring(6);
+ snippetClassName = id.substring(6);
else
- snippetProviderClassName = standardSnippetIDClassNames.get(id);
- if (snippetProviderClassName != null)
+ snippetClassName = standardSnippetIDClassNames.get(id);
+ if (snippetClassName != null)
{
- tryLoadSnippetClass(snippetProviderClassName);
- SnippetSupplier<?, S> snippetProvider = snippetProvidersForClassNames.get(snippetProviderClassName);
- if (snippetProvider != null)
- return snippetProvider;
+ tryLoadSnippetClass(snippetClassName);
+ SnippetSupplier<?, S> snippetSupplier = snippetSuppliersForClassNames.get(snippetClassName);
+ if (snippetSupplier != null)
+ return snippetSupplier;
}
System.err.println("Couldn't load snippet " + id + "; using default");
}
- return defaultSnippetProvider;
+ return defaultSnippetSupplier;
}
// static helpers
if (s == null)
throw new IOException("Resource not found");
SnippetIDClassNames tmp = JsonHandler.readJson(s, SnippetIDClassNames.class);
- tmp.standardOutlineRendererProviders.forEach(outlineRendererProviderSupplier::addStandardSnippetID);
- tmp.standardSymbolRendererProviders.forEach(symbolRendererProviderSupplier::addStandardSnippetID);
+ tmp.standardOutlineRendererSuppliers.forEach(outlineRendererSupplier::addStandardSnippetID);
+ tmp.standardSymbolRendererSuppliers.forEach(symbolRendererSupplier::addStandardSnippetID);
}
catch (Exception e)
{
private static class SnippetIDClassNames
{
- public Map<String, String> standardOutlineRendererProviders;
- public Map<String, String> standardSymbolRendererProviders;
+ public Map<String, String> standardOutlineRendererSuppliers;
+ public Map<String, String> standardSymbolRendererSuppliers;
}
private static void tryLoadSnippetClass(String snippetClassName)
{
private static final Map<String, String> standardComponentIDs = new HashMap<>();
- private static final Map<String, ComponentProvider> componentProviders = new HashMap<>();
+ private static final Map<String, ComponentSupplier> componentSuppliers = new HashMap<>();
static
{
standardComponentIDs.put(standardComponentID, associatedComponentID);
}
- public static void setComponentProvider(String className, ComponentProvider componentProvider)
+ public static void setComponentSupplier(String className, ComponentSupplier componentSupplier)
{
- componentProviders.put(className, componentProvider);
+ componentSuppliers.put(className, componentSupplier);
}
public static GUIComponent createComponent(ViewModelModifiable model, String id)
{
String className = resolvedID.substring(6);
tryLoadComponentClass(className);
- ComponentProvider componentProvider = componentProviders.get(className);
- if (componentProvider != null)
- return componentProvider.create(model, params);
+ ComponentSupplier componentSupplier = componentSuppliers.get(className);
+ if (componentSupplier != null)
+ return componentSupplier.create(model, params);
} else
// we know id has to start with "file:" here
// because standardComponentIDs only contains strings starting with "class:" or "file:"
return SubmodelComponentDeserializer.create(model, resolvedID.substring(5));
}
- throw new RuntimeException("Could not get component provider for ID " + id);
+ throw new RuntimeException("Could not get component supplier for ID " + id);
}
private static void tryLoadComponentClass(String componentClassName)
CodeSnippetSupplier.tryInvokeStaticInitializer(componentClassName, "Error loading component class %s: %s\n");
}
- public static interface ComponentProvider
+ public static interface ComponentSupplier
{
public GUIComponent create(ViewModelModifiable model, JsonElement params);
}
{
DeserializedSubmodelComponent comp = new DeserializedSubmodelComponent(model);
comp.setSubmodelScale(params.submodel.innerScale);
- comp.setOutlineRenderer(CodeSnippetSupplier.outlineRendererProviderSupplier.getSnippetProvider(params.outlineRendererSnippetID)
- .create(comp, params.outlineRendererParams));
- comp.setSymbolRenderer(CodeSnippetSupplier.symbolRendererProviderSupplier.getSnippetProvider(params.symbolRendererSnippetID)
- .create(comp, params.symbolRendererParams));
+ comp.setOutlineRenderer(CodeSnippetSupplier.outlineRendererSupplier.getSnippetSupplier(params.outlineRendererSnippetID).create(comp,
+ params.outlineRendererParams));
+ comp.setSymbolRenderer(CodeSnippetSupplier.symbolRendererSupplier.getSnippetSupplier(params.symbolRendererSnippetID).create(comp,
+ params.symbolRendererParams));
// TODO high level states
comp.setSize(params.width, params.height);
for (InterfacePinParams iPinParams : params.interfacePins)
static
{
- CodeSnippetSupplier.outlineRendererProviderSupplier.setSnippetProvider(DefaultOutlineRenderer.class.getCanonicalName(),
+ CodeSnippetSupplier.outlineRendererSupplier.setSnippetSupplier(DefaultOutlineRenderer.class.getCanonicalName(),
SnippetSupplier.create(Void.class, DefaultOutlineRenderer::new));
}
}
\ No newline at end of file
static
{
- CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(CenteredTextSymbolRenderer.class.getCanonicalName(),
+ CodeSnippetSupplier.symbolRendererSupplier.setSnippetSupplier(CenteredTextSymbolRenderer.class.getCanonicalName(),
SnippetSupplier.create(CenteredTextParams.class, CenteredTextSymbolRenderer::new));
}
}
\ No newline at end of file
static
{
- CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(DefaultSymbolRenderer.class.getCanonicalName(),
+ CodeSnippetSupplier.symbolRendererSupplier.setSnippetSupplier(DefaultSymbolRenderer.class.getCanonicalName(),
SnippetSupplier.create(Void.class, DefaultSymbolRenderer::new));
}
}
\ No newline at end of file
static
{
- CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(SimpleRectangularLikeSymbolRenderer.class.getCanonicalName(),
+ CodeSnippetSupplier.symbolRendererSupplier.setSnippetSupplier(SimpleRectangularLikeSymbolRenderer.class.getCanonicalName(),
SnippetSupplier.create(SimpleRectangularLikeParams.class, SimpleRectangularLikeSymbolRenderer::new));
}
}
\ No newline at end of file
mograsim version: 0.1.3
{
- "standardOutlineRendererProviders": {},
- "standardSymbolRendererProviders": {
+ "standardOutlineRendererSuppliers": {},
+ "standardSymbolRendererSuppliers": {
"CenteredTextSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.CenteredTextSymbolRenderer",
"SimpleRectangularLikeSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRenderer"
}