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