|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jdring.AlarmEntry
public class AlarmEntry
This class contains the attributes of an alarm.
Field Summary | |
---|---|
long |
alarmTime
|
int |
dayOfMonth
|
int |
dayOfWeek
|
int |
hour
|
boolean |
isRelative
|
boolean |
isRepetitive
|
AlarmListener |
listener
|
int |
minute
|
int |
month
|
static String |
REVISION
|
int |
year
|
Constructor Summary | |
---|---|
AlarmEntry(Date date,
AlarmListener listener)
Creates a new AlarmEntry. |
|
AlarmEntry(int delay,
boolean isRepetitive,
AlarmListener listener)
Creates a new AlarmEntry. |
|
AlarmEntry(int minute,
int hour,
int dayOfMonth,
int month,
int dayOfWeek,
int year,
AlarmListener listener)
Creates a new AlarmEntry. |
|
AlarmEntry(Schedule schedule,
AlarmListener listener)
Creates a new AlarmEntry. |
|
AlarmEntry(String schedule,
AlarmListener listener)
Creates a new AlarmEntry from a (simplified) cron-like schedule. |
Method Summary | |
---|---|
int |
compareTo(Object obj)
Compares this AlarmEntry with the specified AlarmEntry for order. |
boolean |
equals(Object obj)
Indicates whether some other AlarmEntry is "equal to" this one. |
AlarmListener |
getListener()
|
Date |
getNextAlarmDate()
Returns the next alarm date for this entry. |
String |
toString()
Returns a string representation of this alarm. |
void |
updateAlarmTime()
Updates the alarm time for repetitive alarms. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
public int minute
public int hour
public int dayOfMonth
public int month
public int dayOfWeek
public int year
public boolean isRelative
public boolean isRepetitive
public long alarmTime
public transient AlarmListener listener
Constructor Detail |
---|
public AlarmEntry(Date date, AlarmListener listener) throws PastDateException
date
- the alarm date to be added.listener
- the alarm listener.
PastDateException
- if the alarm date is in the past (or less than 1 second closed
to the current date).public AlarmEntry(int delay, boolean isRepetitive, AlarmListener listener) throws PastDateException
delay
- the alarm delay in minute (relative to now).isRepetitive
- true
if the alarm must be reactivated,
false
otherwise.listener
- the alarm listener.
PastDateException
- if the alarm date is in the past (or less than 1 second closed
to the current date).public AlarmEntry(int minute, int hour, int dayOfMonth, int month, int dayOfWeek, int year, AlarmListener listener) throws PastDateException
minute
- minute of the alarm. Allowed values 0-59.hour
- hour of the alarm. Allowed values 0-23.dayOfMonth
- day of month of the alarm (-1 if every day). This attribute is
exclusive with dayOfWeek
. Allowed values 1-31.month
- month of the alarm (-1 if every month). Allowed values 0-11 (0 =
January, 1 = February, ...). java.util.Calendar
constants can be used.dayOfWeek
- day of week of the alarm (-1 if every day). This attribute is
exclusive with dayOfMonth
. Allowed values 1-7 (1 =
Sunday, 2 = Monday, ...). java.util.Calendar
constants can be used.year
- year of the alarm. When this field is not set (i.e. -1) the alarm
is repetitive (i.e. it is rescheduled when reached).listener
- the alarm listener.
PastDateException
- if the alarm date is in the past (or less than 1 second closed
to the current date).public AlarmEntry(Schedule schedule, AlarmListener listener) throws PastDateException
schedule
- Schedule
linked to this alarmlistener
- the alarm listener.
PastDateException
- if the alarm date is in the past (or less than 1 second closed
to the current date).public AlarmEntry(String schedule, AlarmListener listener) throws PastDateException, ParseException
Minute Hour DayOfMonth Month DayOfWeek Year
Asterisks (*) specify when the listener is to be called in every instance
of the value of the field. For instance, an asterisk in the Month field
would mean that the listener should be called every month.
Example: 30 10 * * * *
: Every days at 10h30 30 10 * * 2 *
: Every monday at 10h30 30 10 1 * * *
: The first of the month at 10h30
schedule
- the schedule string in the cron format.listener
- the alarm listener.
PastDateException
- if the alarm date is in the past (or less than 1 second closed
to the current date).
ParseException
- if the schedule is not a valid schedule stringMethod Detail |
---|
public void updateAlarmTime()
public String toString()
toString
in class Object
public int compareTo(Object obj)
compareTo
in interface Comparable<Object>
obj
- the AlarmEntry with which to compare.
ClassCastException
- if the specified Object's type prevents it from being compared
to this AlarmEntry.public boolean equals(Object obj)
equals
in class Object
obj
- the AlarmEntry with which to compare.
true if this AlarmEntry has the same
alarmTime
as the alarmTime
of the obj argument;
false
otherwise.
public Date getNextAlarmDate()
public AlarmListener getListener()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |