|
15 | 15 | import com.gs.dmn.runtime.Pair; |
16 | 16 |
|
17 | 17 | import java.io.IOException; |
18 | | -import java.io.StringWriter; |
19 | 18 | import java.io.Writer; |
20 | 19 | import java.util.*; |
21 | 20 | import java.util.function.Function; |
@@ -156,18 +155,18 @@ public void printNodes(Writer writer, Function<T, String> nodeInfo) throws IOExc |
156 | 155 | } |
157 | 156 | } |
158 | 157 |
|
159 | | - public void printBF(T rootNode, StringWriter writer, Function<T, String> nodeInfo) { |
| 158 | + public void printBF(T rootNode, Writer writer, Function<T, String> nodeInfo) throws IOException { |
160 | 159 | printBF(rootNode, writer, nodeInfo, x -> true); |
161 | 160 | } |
162 | 161 |
|
163 | | - public void printBF(T rootNode, StringWriter writer, Function<T, String> nodeInfo, Predicate<T> filter) { |
| 162 | + public void printBF(T rootNode, Writer writer, Function<T, String> nodeInfo, Predicate<T> filter) throws IOException { |
164 | 163 | Set<T> visited = new LinkedHashSet<>(); |
165 | 164 | if (filter.test(rootNode)) { |
166 | 165 | printBF(rootNode, writer, nodeInfo, filter, 0, visited); |
167 | 166 | } |
168 | 167 | } |
169 | 168 |
|
170 | | - private void printBF(T node, StringWriter writer, Function<T, String> nodeInfo, Predicate<T> filter, int level, Set<T> visited) { |
| 169 | + private void printBF(T node, Writer writer, Function<T, String> nodeInfo, Predicate<T> filter, int level, Set<T> visited) throws IOException { |
171 | 170 | String indent = "\t".repeat(level); |
172 | 171 | writer.write(indent + nodeInfo.apply(node) + "\n"); |
173 | 172 | if (!visited.contains(node)) { |
|
0 commit comments