|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.utils.Cooldown
public class Cooldown
Constructor Summary | |
---|---|
Cooldown(long cooldownMillis)
|
|
Cooldown(long cooldownTime,
TimeUnit timeUnit)
|
Method Summary | |
---|---|
void |
clear()
Cools down totally. |
long |
getRemainingTime()
How much time we need to wait before the effect will cool down. |
boolean |
isCool()
Whether you may use the effect, i.e., it was never used before or has cooled down. |
boolean |
isHot()
Whether we're not isCool() . |
boolean |
tryUse()
Check whether it is isCool() , if so, save current time as the time of the use and returns true,
otherwise (== effect needs more cooldown, see getRemainingTime() ) returns false. |
void |
use()
Force use of the effect == sets lastUsedMillis to current time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cooldown(long cooldownMillis)
public Cooldown(long cooldownTime, TimeUnit timeUnit)
Method Detail |
---|
public boolean tryUse()
isCool()
, if so, save current time as the time of the use and returns true,
otherwise (== effect needs more cooldown, see getRemainingTime()
) returns false.
public void use()
lastUsedMillis
to current time.
public boolean isCool()
public boolean isHot()
isCool()
.
public long getRemainingTime()
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |