Fix AB6, code style

This commit is contained in:
2022-06-02 14:28:43 +02:00
parent eab0db8e40
commit d718ba90e3

View File

@ -138,15 +138,13 @@ public class HierarchicalSystem implements CosmicSystem, MassiveIterable {
public Massive next() {
if (cur != null && cur.hasNext()) return cur.next();
for (; i < all.length; i++) {
CosmicSystem sys = all[i];
while (i < all.length) {
CosmicSystem sys = all[i++];
if (sys instanceof NamedBodyForcePair m) {
i++;
return m.getBody();
} else if (sys instanceof HierarchicalSystem hs) {
cur = hs.iterator();
if (cur.hasNext()) {
i++;
return cur.next();
}
}
@ -159,14 +157,14 @@ public class HierarchicalSystem implements CosmicSystem, MassiveIterable {
public boolean hasNext() {
if (cur != null && cur.hasNext()) return true;
for (; i < all.length; i++) {
while (i < all.length) {
CosmicSystem sys = all[i];
if (sys instanceof NamedBodyForcePair) {
return true;
} else if (sys instanceof HierarchicalSystem hs) {
if (sys instanceof NamedBodyForcePair) return true;
i++;
if (sys instanceof HierarchicalSystem hs) {
cur = hs.iterator();
if (cur.hasNext()) {
i++;
return true;
}
}