📄 dailycalendar.java
字号:
this(baseCalendar, rangeStartingHourOfDay, rangeStartingMinute, rangeStartingSecond, rangeStartingMillis, rangeEndingHourOfDay, rangeEndingMinute, rangeEndingSecond, rangeEndingMillis); this.name = name; } /** * @deprecated The use of <code>name</code> is no longer supported. * * @see DailyCalendar#DailyCalendar(Calendar, Calendar) */ public DailyCalendar(String name, Calendar rangeStartingCalendar, Calendar rangeEndingCalendar) { this(rangeStartingCalendar, rangeEndingCalendar); this.name = name; } /** * @deprecated The use of <code>name</code> is no longer supported. * * @see DailyCalendar#DailyCalendar(org.quartz.Calendar, Calendar, Calendar) */ public DailyCalendar(String name, org.quartz.Calendar baseCalendar, Calendar rangeStartingCalendar, Calendar rangeEndingCalendar) { this(baseCalendar, rangeStartingCalendar, rangeEndingCalendar); this.name = name; } /** * @deprecated The use of <code>name</code> is no longer supported. * * @see DailyCalendar#DailyCalendar(long, long) */ public DailyCalendar(String name, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis) { this(rangeStartingTimeInMillis, rangeEndingTimeInMillis); this.name = name; } /** * @deprecated The use of <code>name</code> is no longer supported. * * @see DailyCalendar#DailyCalendar(org.quartz.Calendar, long, long) */ public DailyCalendar(String name, org.quartz.Calendar baseCalendar, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis) { this(baseCalendar, rangeStartingTimeInMillis, rangeEndingTimeInMillis); this.name = name; } /** * @deprecated The use of <code>name</code> is no longer supported. * * @see DailyCalendar#DailyCalendar(TimeZone, long, long) */ public DailyCalendar(String name, TimeZone timeZone, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis) { this(timeZone, rangeStartingTimeInMillis, rangeEndingTimeInMillis); this.name = name; } /** * @deprecated The use of <code>name</code> is no longer supported. * * @see DailyCalendar#DailyCalendar(org.quartz.Calendar, TimeZone, long, long) */ public DailyCalendar(String name, org.quartz.Calendar baseCalendar, TimeZone timeZone, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis) { this(baseCalendar, timeZone, rangeStartingTimeInMillis, rangeEndingTimeInMillis); this.name = name; } /** * Returns the name of the <CODE>DailyCalendar</CODE> * * @return the name of the <CODE>DailyCalendar</CODE> * * @deprecated The use of <code>name</code> is no longer supported. */ public String getName() { return name; } /** * Determines whether the given time (in milliseconds) is 'included' by the * <CODE>BaseCalendar</CODE> * * @param timeInMillis the date/time to test * @return a boolean indicating whether the specified time is 'included' by * the <CODE>BaseCalendar</CODE> */ public boolean isTimeIncluded(long timeInMillis) { if ((getBaseCalendar() != null) && (getBaseCalendar().isTimeIncluded(timeInMillis) == false)) { return false; } long startOfDayInMillis = getStartOfDayJavaCalendar(timeInMillis).getTime().getTime(); long endOfDayInMillis = getEndOfDayJavaCalendar(timeInMillis).getTime().getTime(); long timeRangeStartingTimeInMillis = getTimeRangeStartingTimeInMillis(timeInMillis); long timeRangeEndingTimeInMillis = getTimeRangeEndingTimeInMillis(timeInMillis); if (!invertTimeRange) { return ((timeInMillis > startOfDayInMillis && timeInMillis < timeRangeStartingTimeInMillis) || (timeInMillis > timeRangeEndingTimeInMillis && timeInMillis < endOfDayInMillis)); } else { return ((timeInMillis >= timeRangeStartingTimeInMillis) && (timeInMillis <= timeRangeEndingTimeInMillis)); } } /** * Determines the next time included by the <CODE>DailyCalendar</CODE> * after the specified time. * * @param timeInMillis the initial date/time after which to find an * included time * @return the time in milliseconds representing the next time included * after the specified time. */ public long getNextIncludedTime(long timeInMillis) { long nextIncludedTime = timeInMillis + oneMillis; while (!isTimeIncluded(nextIncludedTime)) { if (!invertTimeRange) { //If the time is in a range excluded by this calendar, we can // move to the end of the excluded time range and continue // testing from there. Otherwise, if nextIncludedTime is // excluded by the baseCalendar, ask it the next time it // includes and begin testing from there. Failing this, add one // millisecond and continue testing. if ((nextIncludedTime >= getTimeRangeStartingTimeInMillis(nextIncludedTime)) && (nextIncludedTime <= getTimeRangeEndingTimeInMillis(nextIncludedTime))) { nextIncludedTime = getTimeRangeEndingTimeInMillis(nextIncludedTime) + oneMillis; } else if ((getBaseCalendar() != null) && (!getBaseCalendar().isTimeIncluded(nextIncludedTime))){ nextIncludedTime = getBaseCalendar().getNextIncludedTime(nextIncludedTime); } else { nextIncludedTime++; } } else { //If the time is in a range excluded by this calendar, we can // move to the end of the excluded time range and continue // testing from there. Otherwise, if nextIncludedTime is // excluded by the baseCalendar, ask it the next time it // includes and begin testing from there. Failing this, add one // millisecond and continue testing. if (nextIncludedTime < getTimeRangeStartingTimeInMillis(nextIncludedTime)) { nextIncludedTime = getTimeRangeStartingTimeInMillis(nextIncludedTime); } else if (nextIncludedTime > getTimeRangeEndingTimeInMillis(nextIncludedTime)) { //(move to start of next day) nextIncludedTime = getEndOfDayJavaCalendar(nextIncludedTime).getTime().getTime(); nextIncludedTime += 1l; } else if ((getBaseCalendar() != null) && (!getBaseCalendar().isTimeIncluded(nextIncludedTime))){ nextIncludedTime = getBaseCalendar().getNextIncludedTime(nextIncludedTime); } else { nextIncludedTime++; } } } return nextIncludedTime; } /** * Returns the start time of the time range (in milliseconds) of the day * specified in <CODE>timeInMillis</CODE> * * @param timeInMillis a time containing the desired date for the starting * time of the time range. * @return a date/time (in milliseconds) representing the start time of the * time range for the specified date. */ public long getTimeRangeStartingTimeInMillis(long timeInMillis) { Calendar rangeStartingTime = createJavaCalendar(timeInMillis); rangeStartingTime.set(Calendar.HOUR_OF_DAY, rangeStartingHourOfDay); rangeStartingTime.set(Calendar.MINUTE, rangeStartingMinute); rangeStartingTime.set(Calendar.SECOND, rangeStartingSecond); rangeStartingTime.set(Calendar.MILLISECOND, rangeStartingMillis); return rangeStartingTime.getTime().getTime(); } /** * Returns the end time of the time range (in milliseconds) of the day * specified in <CODE>timeInMillis</CODE> * * @param timeInMillis a time containing the desired date for the ending * time of the time range. * @return a date/time (in milliseconds) representing the end time of the * time range for the specified date. */ public long getTimeRangeEndingTimeInMillis(long timeInMillis) { Calendar rangeEndingTime = createJavaCalendar(timeInMillis); rangeEndingTime.set(Calendar.HOUR_OF_DAY, rangeEndingHourOfDay); rangeEndingTime.set(Calendar.MINUTE, rangeEndingMinute); rangeEndingTime.set(Calendar.SECOND, rangeEndingSecond); rangeEndingTime.set(Calendar.MILLISECOND, rangeEndingMillis); return rangeEndingTime.getTime().getTime(); } /** * Indicates whether the time range represents an inverted time range (see * class description). * * @return a boolean indicating whether the time range is inverted */ public boolean getInvertTimeRange() { return invertTimeRange; } /** * Indicates whether the time range represents an inverted time range (see * class description). * * @param flag the new value for the <CODE>invertTimeRange</CODE> flag. */ public void setInvertTimeRange(boolean flag) { this.invertTimeRange = flag; } /** * Returns a string representing the properties of the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -