1 Commits

Author SHA1 Message Date
cda144aa2a Refactor List and Tree 2022-04-04 12:48:13 +02:00
4 changed files with 81 additions and 79 deletions

View File

@ -105,3 +105,50 @@ public class BodyForceTreeMap {
return toString(root); return toString(root);
} }
} }
class BodyForceTreeMapItem {
private final Body key;
private Vector3 value;
private BodyForceTreeMapItem parent;
private BodyForceTreeMapItem left;
private BodyForceTreeMapItem right;
public BodyForceTreeMapItem(Body key, Vector3 value) {
this.key = key;
this.value = value;
}
public Body key() {
return this.key;
}
public void setValue(Vector3 value) {
this.value = value;
}
public Vector3 value() {
return this.value;
}
public BodyForceTreeMapItem left() {
return this.left;
}
public BodyForceTreeMapItem right() {
return this.right;
}
public BodyForceTreeMapItem parent() {
return this.parent;
}
public void setLeft(BodyForceTreeMapItem left) {
this.left = left;
if (left != null) left.parent = this;
}
public void setRight(BodyForceTreeMapItem right) {
this.right = right;
if (right != null) right.parent = this;
}
}

View File

@ -1,46 +0,0 @@
class BodyForceTreeMapItem {
private final Body key;
private Vector3 value;
private BodyForceTreeMapItem parent;
private BodyForceTreeMapItem left;
private BodyForceTreeMapItem right;
public BodyForceTreeMapItem(Body key, Vector3 value) {
this.key = key;
this.value = value;
}
public Body key() {
return this.key;
}
public void setValue(Vector3 value) {
this.value = value;
}
public Vector3 value() {
return this.value;
}
public BodyForceTreeMapItem left() {
return this.left;
}
public BodyForceTreeMapItem right() {
return this.right;
}
public BodyForceTreeMapItem parent() {
return this.parent;
}
public void setLeft(BodyForceTreeMapItem left) {
this.left = left;
if (left != null) left.parent = this;
}
public void setRight(BodyForceTreeMapItem right) {
this.right = right;
if (right != null) right.parent = this;
}
}

View File

@ -225,3 +225,37 @@ public class BodyLinkedList implements Iterable<Body> {
}; };
} }
} }
class BodyLinkedListItem {
private final Body body;
private BodyLinkedListItem prev;
private BodyLinkedListItem next;
public BodyLinkedListItem(Body body) {
this.body = body;
this.prev = null;
this.next = null;
}
public Body body() {
return body;
}
public BodyLinkedListItem prev() {
return prev;
}
public void setPrev(BodyLinkedListItem prev) {
this.prev = prev;
if (prev != null) prev.next = this;
}
public BodyLinkedListItem next() {
return next;
}
public void setNext(BodyLinkedListItem next) {
this.next = next;
if (next != null) next.prev = this;
}
}

View File

@ -1,33 +0,0 @@
class BodyLinkedListItem {
private final Body body;
private BodyLinkedListItem prev;
private BodyLinkedListItem next;
public BodyLinkedListItem(Body body) {
this.body = body;
this.prev = null;
this.next = null;
}
public Body body() {
return body;
}
public BodyLinkedListItem prev() {
return prev;
}
public void setPrev(BodyLinkedListItem prev) {
this.prev = prev;
if (prev != null) prev.next = this;
}
public BodyLinkedListItem next() {
return next;
}
public void setNext(BodyLinkedListItem next) {
this.next = next;
if (next != null) next.prev = this;
}
}