| java.lang.Object com.sun.util.PTimerSpec
PTimerSpec | public class PTimerSpec (Code) | | 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.
Absolute
If the PTimerSpec is Absolute, then events will be dispatched at a
specified time. Otherwise the time value is relative to the time
at which the event is scheduled.
Repeat
If the PTimerSpec is repeating, events will be dispatched at
intervals specified by the timevalue. It is meaningless to
specify an Absolute event to repeat.
Regular
If a PTimerSpec is Regular, the PTimer will attempt to notify
its listener at the specified interval regardless of how much
time the event processing takes. Otherwise, the specified time
is the amount of time after all listeners have been called.
Compatibility
The PTimer and PTimerSpec classes are part of the Personal Java
Specification and are not part of J2SE. They are deprecated in
the Personal Profile as they have been replaced by the
java.util.timer class.
since: : PersonalJava1.0 |
Method Summary | |
public void | addPTimerWentOffListener(PTimerWentOffListener l) Adds a listener to this timer specification. | public long | getTime() Returns the absolute or delay time when this specification
will go off. | public boolean | isAbsolute() Checks if this specification is absolute. | public boolean | isRegular() Retrieves the "Regular" property of the PTimerSpec. | public boolean | isRepeat() | public void | notifyListeners(PTimer source) Calls all listeners registered on this timer specification. | public void | removePTimerWentOffListener(PTimerWentOffListener l) Removes a listener to this timer specification. | public void | setAbsolute(boolean absolute) Specifies that the timer should send an event at an absolute time
When a timer event is set to be absolute, the time value is specified
in milliseconds since since midnight, January 1, 1970. | public void | setAbsoluteTime(long when) Sets the PTimerSpec for an absolute, non-repeating time specified by when. | public void | setDelayTime(long delay) Sets the PTimerSpec for non-repeating, relative time specified by delay. | public void | setRegular(boolean regular) | public void | setRepeat(boolean repeat) Sets the repeat property of this PTimerSpec. | public void | setTime(long time) Sets when this specification should go off. |
PTimerSpec | public PTimerSpec()(Code) | | Creates timer with the following properties:
absolute = true
repeat = false
regular = true
interval = 0
|
addPTimerWentOffListener | public void addPTimerWentOffListener(PTimerWentOffListener l)(Code) | | Adds a listener to this timer specification.
Parameters: l - the listener to add |
getTime | public long getTime()(Code) | | Returns the absolute or delay time when this specification
will go off.
|
isAbsolute | public boolean isAbsolute()(Code) | | Checks if this specification is absolute.
the "Absolute" status of the PTimerSpec |
isRegular | public boolean isRegular()(Code) | | Retrieves the "Regular" property of the PTimerSpec.
|
isRepeat | public boolean isRepeat()(Code) | | Checks if this specification is repeating
the "Repeat" status of the PTimerSpec |
notifyListeners | public void notifyListeners(PTimer source)(Code) | | 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 |
removePTimerWentOffListener | public void removePTimerWentOffListener(PTimerWentOffListener l)(Code) | | 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 |
setAbsolute | public void setAbsolute(boolean absolute)(Code) | | Specifies that the timer should send an event at an absolute time
When a timer event is set to be absolute, the time value is specified
in milliseconds since since midnight, January 1, 1970. Otherwise, the
delay time is scheduled relative to the current time.
|
setAbsoluteTime | public void setAbsoluteTime(long when)(Code) | | Sets the PTimerSpec for an absolute, non-repeating time specified by when.
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)(Code) | | Sets the PTimerSpec for non-repeating, relative time specified by delay.
This is a convenience function equivalent to setAbsolute(false),
setTime(delay), setRepeat(false).
Parameters: delay - the relative time for the specification to go off |
setRegular | public void setRegular(boolean regular)(Code) | | Sets this specification to be regular or non-regular
|
setRepeat | public void setRepeat(boolean repeat)(Code) | | Sets the repeat property of this PTimerSpec.
|
setTime | public void setTime(long time)(Code) | | 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.
|
|
|