net.mograsim.logic.model.am2900.components,
net.mograsim.logic.model.am2900.components.am2904,
net.mograsim.logic.model.am2900.components.am2910,
- net.mograsim.logic.model.am2900.machine,
net.mograsim.logic.model.examples
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: net.mograsim.machine;bundle-version="0.1.0";visibility:=reexport,
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
-import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-import java.util.function.Supplier;
-
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
private static final Map<String, ComponentSupplier> componentSuppliers = new HashMap<>();
private static final Map<String, ResourceLoader> resourceLoaders = new HashMap<>();
+ private static final Map<String, JsonObject> componentCache = new HashMap<>();
static
{
{
if (id != null)
{
+ if (componentCache.containsKey(id))
+ return loadComponentFromJsonObject(model, id, name, componentCache.get(id));
String resolvedID = resolveID(id);
if (resolvedID != null)
{
JsonObject jsonContents = JsonHandler.readJson(loader.loadResource(resID), JsonObject.class);
return loadComponentFromJsonObject(model, id, name, jsonContents);
}
- loader.loadClass(resID);
+ if (!componentSuppliers.containsKey(resID))
+ loader.loadClass(resID);
ComponentSupplier componentSupplier = componentSuppliers.get(resID);
if (componentSupplier != null)
return componentSupplier.create(model, params, name);
private static SubmodelComponent loadComponentFromJsonObject(ViewModelModifiable model, String id, String name, JsonObject jsonContents)
{
+ componentCache.putIfAbsent(id, jsonContents);
SerializablePojo jsonContentsAsSerializablePojo = JsonHandler.parser.fromJson(jsonContents, SerializablePojo.class);
if (jsonContentsAsSerializablePojo.version == null)
return LegacySubmodelComponentSerializer.deserialize(model,
Bundle-Vendor: Mograsim Team
Automatic-Module-Name: net.mograsim.machine
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: net.mograsim.logic.core;bundle-version="0.1.0",
- net.mograsim.logic.model;bundle-version="0.1.0",
- net.mograsim.preferences
+Require-Bundle: net.mograsim.logic.core;bundle-version="0.1.0";visibility:=reexport,
+ net.mograsim.logic.model;bundle-version="0.1.0";visibility:=reexport,
+ net.mograsim.preferences;visibility:=reexport
Export-Package: net.mograsim.machine,
net.mograsim.machine.isa,
net.mograsim.machine.isa.types,