projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The line dash of singlebit wires changes according to their value
[Mograsim.git]
/
plugins
/
net.mograsim.logic.model
/
src
/
net
/
mograsim
/
logic
/
model
/
serializing
/
IndirectModelComponentCreator.java
diff --git
a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectModelComponentCreator.java
b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectModelComponentCreator.java
index
d4b758c
..
13205b2
100644
(file)
--- a/
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectModelComponentCreator.java
+++ b/
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectModelComponentCreator.java
@@
-95,7
+95,7
@@
public class IndirectModelComponentCreator
if (id == null)
throw new NullPointerException("Component ID is null");
if (componentCache.containsKey(id))
if (id == null)
throw new NullPointerException("Component ID is null");
if (componentCache.containsKey(id))
- return loadComponentFromJsonObject(model, id, name, componentCache.get(id));
+ return loadComponentFromJsonObject(model, id, name, componentCache.get(id)
, false
);
String resolvedID = resolveID(id);
if (resolvedID == null)
throw new IllegalArgumentException("Unknown standard ID or illegal resolved ID: " + id);
String resolvedID = resolveID(id);
if (resolvedID == null)
throw new IllegalArgumentException("Unknown standard ID or illegal resolved ID: " + id);
@@
-113,7
+113,7
@@
public class IndirectModelComponentCreator
{
throw new UncheckedIOException("Error loading JSON file", e);
}
{
throw new UncheckedIOException("Error loading JSON file", e);
}
- return loadComponentFromJsonObject(model, id, name, jsonContents);
+ return loadComponentFromJsonObject(model, id, name, jsonContents
, false
);
}
ResourceLoader loader;
String resTypeID;
}
ResourceLoader loader;
String resTypeID;
@@
-149,7
+149,7
@@
public class IndirectModelComponentCreator
{
throw new UncheckedIOException("Error loading JSON resource", e);
}
{
throw new UncheckedIOException("Error loading JSON resource", e);
}
- return loadComponentFromJsonObject(model, id, name, jsonContents);
+ return loadComponentFromJsonObject(model, id, name, jsonContents
, true
);
} else if (resTypeID.equals("class"))
{
ComponentSupplier componentSupplier = componentSuppliers.get(resID);
} else if (resTypeID.equals("class"))
{
ComponentSupplier componentSupplier = componentSuppliers.get(resID);
@@
-184,12
+184,18
@@
public class IndirectModelComponentCreator
}
private static SubmodelComponent loadComponentFromJsonObject(LogicModelModifiable model, String id, String name,
}
private static SubmodelComponent loadComponentFromJsonObject(LogicModelModifiable model, String id, String name,
- SubmodelComponentParams jsonContents)
+ SubmodelComponentParams jsonContents
, boolean cache
)
{
{
- componentCache.putIfAbsent(id, jsonContents);
+ if (cache)
+ componentCache.putIfAbsent(id, jsonContents);
return SubmodelComponentSerializer.deserialize(model, jsonContents, name, id, null);
}
return SubmodelComponentSerializer.deserialize(model, jsonContents, name, id, null);
}
+ public static void clearComponentCache()
+ {
+ componentCache.clear();
+ }
+
public static void registerResourceLoader(ResourceLoader resourceLoader)
{
registerResourceLoader(resourceLoader, resourceLoader.getClass());
public static void registerResourceLoader(ResourceLoader resourceLoader)
{
registerResourceLoader(resourceLoader, resourceLoader.getClass());