aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-27 11:53:57 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-27 11:53:57 -0500
commitb09f774d422263ce15b97d6d0804beddf856176d (patch)
treee542258481d7496b15679f3c329ef9e087c7d8fc /src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java
parent22cb02adbeb24b7ec98f843bcaba99cebe3e4f03 (diff)
downloadnotenoughupdates-b09f774d422263ce15b97d6d0804beddf856176d.tar.gz
notenoughupdates-b09f774d422263ce15b97d6d0804beddf856176d.tar.bz2
notenoughupdates-b09f774d422263ce15b97d6d0804beddf856176d.zip
feat: improve formating :)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java
index be42364a..15808a29 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Debouncer.java
@@ -7,28 +7,28 @@ package io.github.moulberry.notenoughupdates.util;
* within {@link #getDelayInNanoSeconds()} nanoseconds.
*/
public class Debouncer {
- private long lastPinged = 0L;
- private final long delay;
+ private long lastPinged = 0L;
+ private final long delay;
- public Debouncer(long minimumDelayInNanoSeconds) {
- this.delay = minimumDelayInNanoSeconds;
- }
+ public Debouncer(long minimumDelayInNanoSeconds) {
+ this.delay = minimumDelayInNanoSeconds;
+ }
- public long getDelayInNanoSeconds() {
- return delay;
- }
+ public long getDelayInNanoSeconds() {
+ return delay;
+ }
- public synchronized long timePassed() {
- // longs are technically not atomic reads since they use two 32 bit registers
- // so, yes, this technically has to be synchronized
- return System.nanoTime() - lastPinged;
- }
+ public synchronized long timePassed() {
+ // longs are technically not atomic reads since they use two 32 bit registers
+ // so, yes, this technically has to be synchronized
+ return System.nanoTime() - lastPinged;
+ }
- public synchronized boolean trigger() {
- long newPingTime = System.nanoTime();
- long newDelay = newPingTime - lastPinged;
- lastPinged = newPingTime;
- return newDelay >= this.delay;
- }
+ public synchronized boolean trigger() {
+ long newPingTime = System.nanoTime();
+ long newDelay = newPingTime - lastPinged;
+ lastPinged = newPingTime;
+ return newDelay >= this.delay;
+ }
}