Skip to content

Commit

Permalink
clean up the dump command's output
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Nov 28, 2024
1 parent 887bfed commit 9fc0c12
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"));
}

}

0 comments on commit 9fc0c12

Please sign in to comment.