Skip to content

Commit eca4202

Browse files
author
Tilmann Zäschke
committed
AVG fix
1 parent 2618c7c commit eca4202

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/org/scion/multiping/PingAll.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ public static void main(String[] args) throws IOException {
103103
println(" ICMP=" + config.tryICMP);
104104
println(" printOnlyICMP=" + SHOW_ONLY_ICMP);
105105

106-
long localAS = Scion.defaultService().getLocalIsdAs();
107106
PingAll demo = new PingAll();
108-
List<ParseAssignments.HostEntry> list = DownloadAssignmentsFromWeb.getList();
109-
for (ParseAssignments.HostEntry e : list) {
110-
if (e.getIsdAs() == localAS) {
111-
continue;
112-
}
107+
List<ParseAssignments.HostEntry> allASes = DownloadAssignmentsFromWeb.getList();
108+
// remove entry for local AS
109+
long localAS = Scion.defaultService().getLocalIsdAs();
110+
allASes = allASes.stream().filter(e -> e.getIsdAs() != localAS).collect(Collectors.toList());
111+
// Process all ASes
112+
for (ParseAssignments.HostEntry e : allASes) {
113113
print(ScionUtil.toStringIA(e.getIsdAs()) + " \"" + e.getName() + "\" ");
114114
demo.runDemo(e);
115115
listedAs.add(e.getIsdAs());
@@ -446,13 +446,13 @@ private static double avg(Predicate<Result> filter, ToDoubleFunction<Result> map
446446
return results.stream().filter(filter).mapToDouble(mapper).average().orElse(-1);
447447
}
448448

449-
450449
private static Result max(Predicate<Result> filter, Comparator<Result> comparator) {
451450
return results.stream().filter(filter).max(comparator).orElseThrow(NoSuchElementException::new);
452451
}
453452

454453
private static <T> double median(Predicate<Result> filter, Function<Result, T> mapper) {
455-
List<T> list = results.stream().filter(filter).map(mapper).sorted().collect(Collectors.toList());
454+
List<T> list =
455+
results.stream().filter(filter).map(mapper).sorted().collect(Collectors.toList());
456456
if (list.isEmpty()) {
457457
return -1;
458458
}

0 commit comments

Comments
 (0)