global: format code

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2020-03-09 12:36:47 -06:00
parent 40ebf8006e
commit 2e55e5fd05
19 changed files with 305 additions and 292 deletions
@@ -16,10 +16,11 @@ import java.util.Map;
@NonNullForAll
public class Statistics {
private long lastTouched = SystemClock.elapsedRealtime();
private final Map<Key, Pair<Long, Long>> peerBytes = new HashMap<>();
private long lastTouched = SystemClock.elapsedRealtime();
Statistics() { }
Statistics() {
}
void add(final Key key, final long rx, final long tx) {
peerBytes.put(key, Pair.create(rx, tx));
@@ -30,10 +31,6 @@ public class Statistics {
return SystemClock.elapsedRealtime() - lastTouched > 900;
}
public Key[] peers() {
return peerBytes.keySet().toArray(new Key[0]);
}
public long peerRx(final Key peer) {
if (!peerBytes.containsKey(peer))
return 0;
@@ -46,6 +43,10 @@ public class Statistics {
return peerBytes.get(peer).second;
}
public Key[] peers() {
return peerBytes.keySet().toArray(new Key[0]);
}
public long totalRx() {
long rx = 0;
for (final Pair<Long, Long> val : peerBytes.values()) {