From 9fc0c12bf991c9c1fc9068630652d981e52b3317 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 28 Nov 2024 12:42:18 +0100 Subject: [PATCH] clean up the dump command's output --- .../prettypipes/network/PipeNetwork.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index 9c84a4a..b6f3371 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -104,13 +104,12 @@ public boolean isDirty() { @Override public String toString() { - return "PipeNetwork{" + - "\ngraph=" + this.graph + - ",\nnodeToConnectedNodes=" + this.nodeToConnectedNodes + - ",\ntileCache=" + this.tileCache.keySet() + - ",\npipeItems=" + this.pipeItems + - ",\nnetworkLocks=" + this.networkLocks + - ",\nactiveCrafts=" + this.activeCrafts + '}'; + return "graph:\n\tnodes: " + this.graph.edgeSet() + "\n\tedges: " + this.graph.edgeSet() + + "\nnodeToConnectedNodes:\n" + PipeNetwork.toNewlineDelimitedString(this.nodeToConnectedNodes.entrySet()) + + "\ntileCache:\n" + PipeNetwork.toNewlineDelimitedString(this.tileCache.keySet()) + + "\npipeItems:\n" + PipeNetwork.toNewlineDelimitedString(this.pipeItems.entries()) + + "\nnetworkLocks:\n" + PipeNetwork.toNewlineDelimitedString(this.networkLocks.entries()) + + "\nactiveCrafts:\n" + PipeNetwork.toNewlineDelimitedString(this.activeCrafts.entries()); } @Override @@ -594,4 +593,8 @@ public static PipeNetwork get(Level level) { } } + private static String toNewlineDelimitedString(Collection collection) { + return collection.stream().map(c -> "\t" + c.toString()).collect(Collectors.joining("\n")); + } + }