cz.cuni.amis.utils
Class Cooldown

Package class diagram package Cooldown
java.lang.Object
  extended by cz.cuni.amis.utils.Cooldown

public class Cooldown
extends Object

Author:
Jimmy

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

Cooldown

public Cooldown(long cooldownMillis)

Cooldown

public Cooldown(long cooldownTime,
                TimeUnit timeUnit)
Method Detail

tryUse

public 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.

Returns:

use

public void use()
Force use of the effect == sets lastUsedMillis to current time.


isCool

public boolean isCool()
Whether you may use the effect, i.e., it was never used before or has cooled down.

Returns:

isHot

public boolean isHot()
Whether we're not isCool().


getRemainingTime

public long getRemainingTime()
How much time we need to wait before the effect will cool down.

Returns:

clear

public void clear()
Cools down totally.



Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.