Refactoring

This commit is contained in:
SiboVG 2023-01-17 22:48:28 +01:00
parent e1ff8fb39c
commit 738905d6d8
2 changed files with 6 additions and 8 deletions

View File

@ -427,7 +427,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
// constructs entry in-place if this component is active // constructs entry in-place if this component is active
if (this.isComponentActive(component)) { if (this.isComponentActive(component)) {
results.emplace(component, this.isComponentActive(component), currentInstanceNumber, currentTransform); results.emplace(component, currentInstanceNumber, currentTransform);
} }
for(RocketComponent child : component.getChildren()) { for(RocketComponent child : component.getChildren()) {

View File

@ -27,15 +27,13 @@ public class InstanceMap extends ConcurrentHashMap<RocketComponent, ArrayList<In
} }
} }
public void emplace(final RocketComponent component, boolean active, int number, final Transformation xform) { public void emplace(final RocketComponent component, int number, final Transformation transform) {
final RocketComponent key = component; if (!containsKey(component)) {
put(component, new ArrayList<>());
if(!containsKey(component)) {
put(key, new ArrayList<InstanceContext>());
} }
final InstanceContext context = new InstanceContext(component, number, xform); final InstanceContext context = new InstanceContext(component, number, transform);
get(key).add(context); get(component).add(context);
} }
public List<InstanceContext> getInstanceContexts(final RocketComponent key) { public List<InstanceContext> getInstanceContexts(final RocketComponent key) {