org.crosswire.common.util
Class TimeGate

java.lang.Object
  extended by org.crosswire.common.util.TimeGate

public class TimeGate
extends Object

A TimeGate when entered will cause the gate to be closed for a specified period of time.

Author:
DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.

Field Summary
private  int closeTime
          The interval during which the gate is closed.
private  long then
          The time in milliseconds that the gate last closed.
 
Constructor Summary
TimeGate(int count)
          Build a TimeGate that will allow entry no more often than count milliseconds
 
Method Summary
 boolean open()
          Determine whether entry through the gate is allowed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closeTime

private int closeTime
The interval during which the gate is closed.


then

private long then
The time in milliseconds that the gate last closed.

Constructor Detail

TimeGate

public TimeGate(int count)
Build a TimeGate that will allow entry no more often than count milliseconds

Parameters:
count - the length of time to keep the gate shut after opening it.
Method Detail

open

public boolean open()
Determine whether entry through the gate is allowed. Opening the gate will close it until the TimeGate's interval has passed.

Returns:
true if one may enter.

Copyright ยจ 2003-2007