Skip to content

Commit 7c33452

Browse files
refactor(dot): extract method
1 parent 8eae740 commit 7c33452

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/main/java/org/schemaspy/output/dot/schemaspy/DotTableFormatter.java

+20-10
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,7 @@ private void writeTableRelationships() {
167167
}
168168
}
169169

170-
// now directly connect the loose ends to the title of the
171-
// 2nd degree of separation tables
172-
for (Edge edge : allCousinEdges) {
173-
if (this.isCousinTable(edge.getParentTable(), allCousins, relatedTables)) {
174-
edge.connectToParentTitle();
175-
}
176-
if (this.isCousinTable(edge.getChildTable(), allCousins, relatedTables)) {
177-
edge.connectToChildTitle();
178-
}
179-
}
170+
connectLooseEnds(allCousinEdges, allCousins, relatedTables);
180171

181172
// include the table itself
182173
nodes.put(table, new DotNode(table, false, new DotNodeConfig(true, true), runtimeDotConfig));
@@ -313,6 +304,25 @@ private boolean isCousinEdge(
313304
return twoDegreesOfSeparation && (allCousins.contains(participantA) || allCousins.contains(participantB));
314305
}
315306

307+
/**
308+
* Directly connect the loose ends to the title of the 2nd degree of
309+
* separation tables.
310+
*/
311+
private void connectLooseEnds(
312+
final Set<Edge> allCousinEdges,
313+
final Set<Table> allCousins,
314+
final Set<Table> relatedTables
315+
) {
316+
for (Edge edge : allCousinEdges) {
317+
if (this.isCousinTable(edge.getParentTable(), allCousins, relatedTables)) {
318+
edge.connectToParentTitle();
319+
}
320+
if (this.isCousinTable(edge.getChildTable(), allCousins, relatedTables)) {
321+
edge.connectToChildTitle();
322+
}
323+
}
324+
}
325+
316326
private boolean isCousinTable(
317327
final Table candidate,
318328
final Set<Table> allCousins,

0 commit comments

Comments
 (0)