|
1 | 1 | package org.cobolt.model.utils;
|
2 | 2 |
|
3 |
| -import java.util.ArrayList; |
4 |
| -import java.util.Comparator; |
5 |
| -import java.util.HashMap; |
6 |
| -import java.util.HashSet; |
7 |
| -import java.util.List; |
8 |
| -import java.util.Map; |
9 |
| -import java.util.Set; |
10 |
| - |
11 | 3 | import org.cobolt.model.Edge;
|
12 | 4 | import org.cobolt.model.EdgeState;
|
13 | 5 | import org.cobolt.model.Node;
|
@@ -87,67 +79,6 @@ public static Edge addUndirectedEdge(final Topology topology, final String idFwd
|
87 | 79 | return addUndirectedEdge(topology, idFwd, idBwd, node1, node2, distance, Double.NaN);
|
88 | 80 | }
|
89 | 81 |
|
90 |
| - /** |
91 |
| - * Creates a summary of the edge states of the given {@link Topology}. |
92 |
| - * |
93 |
| - * For instance, this method can be used during debugging as follows: |
94 |
| - * |
95 |
| - * de.tudarmstadt.maki.tc.cbctc.model.utils.TopologyUtils.formatEdgeStateReport(unclassifiedEdge.getTopology()) |
96 |
| - * |
97 |
| - * de.tudarmstadt.maki.tc.cbctc.model.utils.TopologyUtils.formatEdgeStateReport(topology) |
98 |
| - * |
99 |
| - * @param topology |
100 |
| - * @return |
101 |
| - */ |
102 |
| - public static String formatEdgeStateReport(final Topology topology) { |
103 |
| - final StringBuilder builder = new StringBuilder(); |
104 |
| - final Set<Edge> processedEdges = new HashSet<>(); |
105 |
| - final List<Edge> edges = new ArrayList<>(topology.getEdges()); |
106 |
| - edges.sort(new Comparator<Edge>() { |
107 |
| - @Override |
108 |
| - public int compare(final Edge o1, final Edge o2) { |
109 |
| - return o1.getId().compareTo(o2.getId()); |
110 |
| - } |
111 |
| - |
112 |
| - }); |
113 |
| - final Map<EdgeState, Integer> stateCounts = new HashMap<>(); |
114 |
| - stateCounts.put(EdgeState.ACTIVE, 0); |
115 |
| - stateCounts.put(EdgeState.INACTIVE, 0); |
116 |
| - stateCounts.put(EdgeState.UNCLASSIFIED, 0); |
117 |
| - |
118 |
| - for (final Edge link : edges) { |
119 |
| - if (!processedEdges.contains(link)) { |
120 |
| - final Edge revLink = link.getReverseEdge(); |
121 |
| - final EdgeState linkState = link.getState(); |
122 |
| - builder.append(String.format("%6s", link.getId()) + " : " + linkState.toString().substring(0, 1)); |
123 |
| - processedEdges.add(link); |
124 |
| - stateCounts.put(linkState, stateCounts.get(linkState) + 1); |
125 |
| - |
126 |
| - if (revLink != null) { |
127 |
| - final EdgeState revLinkState = revLink.getState(); |
128 |
| - builder.append(" || " + String.format("%6s", revLink.getId()) + " : " |
129 |
| - + revLinkState.toString().substring(0, 1)); |
130 |
| - processedEdges.add(revLink); |
131 |
| - stateCounts.put(revLinkState, stateCounts.get(revLinkState) + 1); |
132 |
| - } |
133 |
| - |
134 |
| - builder.append("\n"); |
135 |
| - |
136 |
| - } |
137 |
| - } |
138 |
| - |
139 |
| - builder.insert(0, String.format("#A : %d || #I : %d || #U : %d || Sum : %d\n", // |
140 |
| - stateCounts.get(EdgeState.ACTIVE), // |
141 |
| - stateCounts.get(EdgeState.INACTIVE), // |
142 |
| - stateCounts.get(EdgeState.UNCLASSIFIED), // |
143 |
| - stateCounts.get(EdgeState.ACTIVE) + stateCounts.get(EdgeState.INACTIVE) |
144 |
| - + stateCounts.get(EdgeState.UNCLASSIFIED)// |
145 |
| - )); |
146 |
| - |
147 |
| - return builder.toString().trim(); |
148 |
| - |
149 |
| - } |
150 |
| - |
151 | 82 | /**
|
152 | 83 | * Returns true if the topology contains at least one unclassified edge
|
153 | 84 | *
|
|
0 commit comments