AB8/1
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import codedraw.CodeDraw;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* A cosmic system that is composed of a central named body (of type 'NamedBodyForcePair')
|
||||
* and an arbitrary number of subsystems (of type 'CosmicSystem') in its orbit.
|
||||
@ -136,6 +138,7 @@ public class HierarchicalSystem implements CosmicSystem, MassiveIterable {
|
||||
|
||||
@Override
|
||||
public Massive next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
if (cur != null && cur.hasNext()) return cur.next();
|
||||
|
||||
while (i < all.length) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import codedraw.CodeDraw;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* A map that associates an object of 'Massive' with a Vector3. The number of key-value pairs
|
||||
* is not limited.
|
||||
@ -124,7 +126,8 @@ public class MassiveForceTreeMap implements MassiveSet {
|
||||
|
||||
@Override
|
||||
public Massive next() {
|
||||
if (next == null) return null;
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
|
||||
Massive m = next.key;
|
||||
Item newNext = (next.right != null) ? next.right.getLeftLeaf() : next.parent;
|
||||
while (newNext != null && newNext.right == next) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* A list of massive objects implemented as a linked list.
|
||||
@ -184,6 +185,7 @@ public class MassiveLinkedList implements MassiveIterable {
|
||||
|
||||
@Override
|
||||
public Massive next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
if (!yieldedFirst) {
|
||||
yieldedFirst = true;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user