|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
An interface for Alarm objects.
Alarms are objects which send AlarmEvents at regular intervals.
For example, an Alarm object may be used in a document editor to support an autosave operations. An alarm can be created to fire at ten minute intervals (10 * AlarmInterface.ONE_MINUTE) and the alarm listener can be an object which performs the autosave if the document has been modified since the last autosave.
| Name | interval |
| Type | long |
| Default value | 0 |
| Short description | alarm interval |
| Description | number of milliseconds the alarm waits between firing recurring AlarmEvents.
|
| Name | delay |
| Type | long |
| Default value | 0 |
| Short description | Initial delay before firing |
| Description | Number of milliseconds the alarm will wait before first firing an AlarmEvent.
|
| Name | count |
| Type | int |
| Default value | 0 |
| Short description | Number of times to fire the alarm |
| Description | Number of times to fire the alarm |
Alarm| Fields inherited from interface com.sas.util.TimeIntervals |
ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK |
| Method Summary | |
void |
addAlarmListener(AlarmListener listener)
Add a listener for the event. |
int |
getCount()
Get the numbre of times the Alarm will fire before stopping. |
long |
getDelay()
Get the amount of time the Alarm will wait before first firing. |
long |
getInterval()
Retrieve the alarm interval. |
void |
removeAlarmListener(AlarmListener listener)
Remove a listener for the event. |
void |
setCount(int count)
Set the number of times the alarm will fire. |
void |
setDelay(long delayMillis)
Set the amount of time the Alarm will wait before first firing. |
void |
setInterval(long newIntervalMillis)
Set the interval at which the alarm fires. |
void |
setStartTime(long startTime)
Set the timer's start time. |
void |
setStopTime(long stopTime)
Set the timer's stop time. |
| Methods inherited from interface com.sas.util.TimerInterface |
getDuration, getStartTime, getStopTime, isRunning, setRunning, start, stop |
| Methods inherited from interface com.sas.beans.PropertyChangeSource |
addPropertyChangeListener, removePropertyChangeListener |
| Method Detail |
public long getInterval()
public void setInterval(long newIntervalMillis)
ONE_HOUR
to ONE_SECOND;
you don't want to have to wait an hour for the new
interval to take effect.
If the new interval is larger
than the current interval and the alarm is running,
the alarm will still fire as previously scheduled, then
assume the new interval.
The interval is only approximate; not all
platforms support precise millisecond timing.newIntervalMillis - the new alarm interval, in milliseconds.public void setDelay(long delayMillis)
delayMillis - the alarm delay, in milliseconds.public long getDelay()
public void setCount(int count)
count - the number of times the alarm will fire.
count is valid only if the interval is non-zero.public int getCount()
public void addAlarmListener(AlarmListener listener)
AlarmEvent event.addAlarmListener in interface com.sas.util.AlarmSourcelistener - an object which handles AlarmEvent events
the listener is not added a second time if it already exists
in the list of listeners for this event.AlarmSourcepublic void removeAlarmListener(AlarmListener listener)
AlarmEvent event. Nothing
happens if the listener is not in the list of listeners for this event.removeAlarmListener in interface com.sas.util.AlarmSourcelistener - an object which handles AlarmEvent eventsAlarmSourcepublic void setStartTime(long startTime)
startTime - the time the timer should start, in number of milliseconds since
the Epochpublic void setStopTime(long stopTime)
stopTime - the time the timer should stop, in milliseconds since
the Epoch. If stopTime and count are 0
and interval is greater than zero, the timer will repeat indefinitely.
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||