GUI & Tasking utils

This commit is contained in:
Daniel Mills
2020-08-24 08:03:05 -04:00
parent e9544bb610
commit 273f7c7a73
50 changed files with 3937 additions and 55 deletions

View File

@@ -4,18 +4,28 @@ public class ChronoLatch
{
private long interval;
private long since;
public ChronoLatch(long interval, boolean openedAtStart)
{
this.interval = interval;
since = System.currentTimeMillis() - (openedAtStart ? interval * 2 : 0);
}
public ChronoLatch(long interval)
{
this(interval, true);
}
public void flipDown()
{
since = System.currentTimeMillis();
}
public boolean couldFlip()
{
return System.currentTimeMillis() - since > interval;
}
public boolean flip()
{
if(System.currentTimeMillis() - since > interval)
@@ -23,7 +33,7 @@ public class ChronoLatch
since = System.currentTimeMillis();
return true;
}
return false;
}
}