All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.util.PTimerSpec
java.lang.Object
|
+----com.sun.util.PTimerSpec
- public class PTimerSpec
- extends Object
A class representing a timer specification. A timer
specification declares when a PTimerWentOffEvent should be sent. These
events are sent to the listeners registered on the
specification.
PTimer specifications may be absolute or delayed.
Absolute specifications go off at the specified time. Delayed
specifications go off after waiting the specified amount of time.
Delayed specifications may be repeating or non-repeating.
Repeating specifications automatically reschedule theselves after
going off.
Repeating specifications may be regular or non-regular. Regular
specifications attempt to go off at fixed intervals of time,
irrespective of system load or how long it takes to notify the
listeners. Non-regular specifications wait the specified amount of
time after all listeners have been called before firing again.
For example, create a repeating specification going off every
100ms. Imagine that it takes 5ms to notify the listeners. If the
specification is regular, the listeners will be notified after
100ms, 200ms, 300ms, and so on. If the specification is
non-regular, the listeners will be notified after 100ms, 205ms,
310ms, and so on.
-
listeners
-
-
PTimerSpec()
- Creates a timer specification.
-
addPTimerWentOffListener(PTimerWentOffListener)
- Adds a listener to this timer specification.
-
getTime()
- Returns the absolute or delay time when this specification
will go off.
-
isAbsolute()
- Checks if this specification is absolute.
-
isRegular()
- Checks if this specification is regular
-
isRepeat()
- Checks if this specification is repeating
-
notifyListeners(PTimer)
- Calls all listeners registered on this timer specification.
-
removePTimerWentOffListener(PTimerWentOffListener)
- Removes a listener to this timer specification.
-
setAbsolute(boolean)
- Sets this specification to be absolute or delayed.
-
setAbsoluteTime(long)
- Sets this specification to go off at the given absolute time.
-
setDelayTime(long)
- Sets this specification to go off after the given delay time.
-
setRegular(boolean)
- Sets this specification to be regular or non-regular
-
setRepeat(boolean)
- Sets this specification to be repeating or non-repeating
-
setTime(long)
- Sets when this specification should go off.
listeners
protected Object listeners
PTimerSpec
public PTimerSpec()
- Creates a timer specification. It initially is absolute,
non-repeating, regular specification set to go off at time 0.
setAbsolute
public void setAbsolute(boolean absolute)
- Sets this specification to be absolute or delayed.
isAbsolute
public boolean isAbsolute()
- Checks if this specification is absolute.
setRepeat
public void setRepeat(boolean repeat)
- Sets this specification to be repeating or non-repeating
isRepeat
public boolean isRepeat()
- Checks if this specification is repeating
setRegular
public void setRegular(boolean regular)
- Sets this specification to be regular or non-regular
isRegular
public boolean isRegular()
- Checks if this specification is regular
setTime
public void setTime(long time)
- Sets when this specification should go off. For absolute
specifications, this is a time in milliseconds since midnight,
January 1, 1970 UTC. For delayed specifications, this is a
delay time in milliseconds.
getTime
public long getTime()
- Returns the absolute or delay time when this specification
will go off.
addPTimerWentOffListener
public void addPTimerWentOffListener(PTimerWentOffListener l)
- Adds a listener to this timer specification.
- Parameters:
- l - the listener to add
removePTimerWentOffListener
public void removePTimerWentOffListener(PTimerWentOffListener l)
- Removes a listener to this timer specification. Silently does nothing
if the listener was not listening on this specification.
- Parameters:
- l - the listener to remove
setAbsoluteTime
public void setAbsoluteTime(long when)
- Sets this specification to go off at the given absolute time.
This is a convenience function equivalent to setAbsolute(true),
setTime(when), setRepeat(false).
- Parameters:
- when - the absolute time for the specification to go off
setDelayTime
public void setDelayTime(long delay)
- Sets this specification to go off after the given delay time.
This is a convenience function equivalent to setAbsolute(false),
setTime(delay), setRepeat(false).
- Parameters:
- delay - the relative time for the specification to go off
notifyListeners
public void notifyListeners(PTimer source)
- Calls all listeners registered on this timer specification.
This function is primarily for the benefit of those writing
implementations of PTimers.
- Parameters:
- source - the PTimer that decided that this specification should go off
All Packages Class Hierarchy This Package Previous Next Index