|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.util.Timer
Implements A timer that can be set to a specified number of seconds or milliseconds before it times out, and can be checked for the time elapsed since the start or time remaining until the timeout.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Field Summary | |
static java.util.Date |
APOCALYPSE
|
Constructor Summary | |
Timer()
Creates and starts a new timer that will run forever. |
|
Timer(int timeAlloted)
Creates and starts a new timer that will run the specified number of seconds before timing out. |
|
Timer(long timeAlloted)
Creates and starts a new timer that will run the specified number of milliseconds before timing out. |
Method Summary | |
void |
checkForTimeOut()
Throws a @see TimeOutException if this timer has been running longer than the timeOut. |
long |
getElapsedMilliSeconds()
Returns the number of milliseconds that this timer has been running. |
int |
getElapsedSeconds()
Returns the number of seconds that this timer has been running. |
long |
getRemainingMilliSeconds()
Returns the number of milliseconds remaining till the timeout of this timer. |
int |
getRemainingSeconds()
Returns the number of seconds remaining till the timeout of this timer. |
boolean |
isTimedOut()
Returns true if this timer is timed out, false otherwise. |
void |
start()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.util.Date APOCALYPSE
Constructor Detail |
public Timer(int timeAlloted)
timeAlloted
- the number of seconds the timer will run before timing
out.public Timer(long timeAlloted)
timeAlloted
- the number of milliseconds the timer will run before
timing out.public Timer()
Method Detail |
public void start()
public int getElapsedSeconds()
public long getElapsedMilliSeconds()
public int getRemainingSeconds()
public long getRemainingMilliSeconds()
public boolean isTimedOut()
true
if this timer is timed out, false
otherwise.true
if this timer is timed out, false
otherwise.public void checkForTimeOut() throws TimeOutException
TimeOutException
- if this timer has run the specifier number of
seconds.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |