removes genericCode from generated concrete circuits

This commit is contained in:
hneemann 2021-01-07 11:27:35 +01:00
parent fed6329dce
commit 17b6b904e8
2 changed files with 16 additions and 2 deletions

View File

@ -318,4 +318,16 @@ public class ElementAttributes implements HGSMap {
return null;
return cache.get(key);
}
/**
* Removes an entry from the cache.
*
* @param key the key to remove
* @return the previous value associated with key, or null if there was no mapping for key.
*/
public Object removeFromCache(String key) {
if (cache == null)
return null;
return cache.remove(key);
}
}

View File

@ -253,7 +253,9 @@ public class ResolveGenerics {
* @return this for chained calls
*/
public CircuitHolder cleanupConcreteCircuit() {
for (VisualElement gic : circuit.getElements(v -> v.equalsDescription(GenericInitCode.DESCRIPTION)))
for (VisualElement gic : circuit.getElements(v ->
v.equalsDescription(GenericInitCode.DESCRIPTION)
|| v.equalsDescription(GenericCode.DESCRIPTION)))
circuit.delete(gic);
for (VisualElement v : circuit.getElements()) {
try {
@ -266,7 +268,7 @@ public class ResolveGenerics {
// can not happen
e.printStackTrace();
}
v.getElementAttributes().putToCache(GEN_ARGS_KEY, null);
v.getElementAttributes().removeFromCache(GEN_ARGS_KEY);
}
circuit.getAttributes().set(Keys.IS_GENERIC, false);