AB3: Fix toString()
This commit is contained in:
@ -86,13 +86,14 @@ public class BodyForceTreeMap {
|
|||||||
return this.size;
|
return this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toString(BodyForceTreeMapItem item, String indent) {
|
private String toString(BodyForceTreeMapItem item) {
|
||||||
|
String s = "";
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return "";
|
return s;
|
||||||
}
|
}
|
||||||
String s = String.format("%s{%s: %s}\n", indent, item.key(), item.value());
|
s += this.toString(item.right());
|
||||||
s += this.toString(item.left(), indent + "| ");
|
s += String.format("{%s: %s}\n", item.key(), item.value());
|
||||||
s += this.toString(item.right(), indent + "| ");
|
s += this.toString(item.left());
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +102,6 @@ public class BodyForceTreeMap {
|
|||||||
* descending according to the mass of the bodies.
|
* descending according to the mass of the bodies.
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toString(root, "");
|
return toString(root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user