public WeeklyCalendar(Calendar baseCalendar, TimeZone timeZone) { super(baseCalendar, timeZone); excludeDays[java.util.Calendar.SUNDAY] = true; excludeDays[java.util.Calendar.SATURDAY] = true; excludeAll = areAllDaysExcluded(); }
/** * <p> * Determine whether the given time (in milliseconds) is 'included' by the * Calendar. * </p> * * <p> * Note that this Calendar is only has full-day precision. * </p> */ @Override public boolean isTimeIncluded(long timeStamp) { if (excludeAll == true) { return false; } // Test the base calendar first. Only if the base calendar not already // excludes the time/date, continue evaluating this calendar instance. if (super.isTimeIncluded(timeStamp) == false) { return false; } java.util.Calendar cl = createJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); return !(isDayExcluded(wday)); }
java.util.Calendar cl = getStartOfDayJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); if (!isDayExcluded(wday)) { return timeStamp; // return the original value while (isDayExcluded(wday) == true) { cl.add(java.util.Calendar.DATE, 1); wday = cl.get(java.util.Calendar.DAY_OF_WEEK);
@Override public boolean isTimeIncluded(long timestamp) { WeeklyCalendar weeklyCalendar = new WeeklyCalendar(); weeklyCalendar.setDaysExcluded(new boolean[]{false,false,false,false,false,false,false}); weeklyCalendar.setDayExcluded(java.util.Calendar.THURSDAY,true); return weeklyCalendar.isTimeIncluded(timestamp); } };
weekdayCal = new WeeklyCalendar(holidayCal); String[] weekArray = weeks.split(","); for(String week : weekArray) { if(NumberUtils.isNumber(week)) { int w = Integer.parseInt(week); weekdayCal.setDayExcluded(w + 1, true); } else { log.warn("{} 不是合法的星期数值,请检查星期的配置在1~7内");
/** * <p> * Check if all week days are excluded. That is no day is included. * </p> * * @return boolean */ public boolean areAllDaysExcluded() { return isDayExcluded(java.util.Calendar.SUNDAY) && isDayExcluded(java.util.Calendar.MONDAY) && isDayExcluded(java.util.Calendar.TUESDAY) && isDayExcluded(java.util.Calendar.WEDNESDAY) && isDayExcluded(java.util.Calendar.THURSDAY) && isDayExcluded(java.util.Calendar.FRIDAY) && isDayExcluded(java.util.Calendar.SATURDAY); }
@Override public boolean isTimeIncluded(long timestamp) { WeeklyCalendar weeklyCalendar = new WeeklyCalendar(); weeklyCalendar.setDaysExcluded(new boolean[]{false,false,false,false,false,false,false}); return weeklyCalendar.isTimeIncluded(timestamp); } };
WeeklyCalendar calendar=new WeeklyCalendar(); calendar.setDayExcluded(java.util.Calendar.SUNDAY, false); calendar.setDayExcluded(java.util.Calendar.SATURDAY, false); if(dates!=null){ for(CalendarDate d:dates){ calendar.setDayExcluded(d.getDayOfWeek(),true);
/** * <p> * Check if all week days are excluded. That is no day is included. * </p> * * @return boolean */ public boolean areAllDaysExcluded() { return isDayExcluded(java.util.Calendar.SUNDAY) && isDayExcluded(java.util.Calendar.MONDAY) && isDayExcluded(java.util.Calendar.TUESDAY) && isDayExcluded(java.util.Calendar.WEDNESDAY) && isDayExcluded(java.util.Calendar.THURSDAY) && isDayExcluded(java.util.Calendar.FRIDAY) && isDayExcluded(java.util.Calendar.SATURDAY); }
/** * <p> * Determine whether the given time (in milliseconds) is 'included' by the * Calendar. * </p> * * <p> * Note that this Calendar is only has full-day precision. * </p> */ @Override public boolean isTimeIncluded(long timeStamp) { if (excludeAll == true) { return false; } // Test the base calendar first. Only if the base calendar not already // excludes the time/date, continue evaluating this calendar instance. if (super.isTimeIncluded(timeStamp) == false) { return false; } java.util.Calendar cl = createJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); return !(isDayExcluded(wday)); }
java.util.Calendar cl = getStartOfDayJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); if (!isDayExcluded(wday)) { return timeStamp; // return the original value while (isDayExcluded(wday) == true) { cl.add(java.util.Calendar.DATE, 1); wday = cl.get(java.util.Calendar.DAY_OF_WEEK);
/** * <p> * Redefine a certain day of the week to be excluded (true) or included * (false). Use java.util.Calendar's constants like MONDAY to determine the * wday. * </p> */ public void setDayExcluded(int wday, boolean exclude) { excludeDays[wday] = exclude; excludeAll = areAllDaysExcluded(); }
WeeklyCalendar calendar=new WeeklyCalendar(); calendar.setDayExcluded(java.util.Calendar.SUNDAY, false); calendar.setDayExcluded(java.util.Calendar.SATURDAY, false); if(dates!=null){ for(CalendarDate d:dates){ calendar.setDayExcluded(d.getDayOfWeek(),true);
/** * <p> * Check if all week days are excluded. That is no day is included. * </p> * * @return boolean */ public boolean areAllDaysExcluded() { return isDayExcluded(java.util.Calendar.SUNDAY) && isDayExcluded(java.util.Calendar.MONDAY) && isDayExcluded(java.util.Calendar.TUESDAY) && isDayExcluded(java.util.Calendar.WEDNESDAY) && isDayExcluded(java.util.Calendar.THURSDAY) && isDayExcluded(java.util.Calendar.FRIDAY) && isDayExcluded(java.util.Calendar.SATURDAY); }
/** * <p> * Determine whether the given time (in milliseconds) is 'included' by the * Calendar. * </p> * * <p> * Note that this Calendar is only has full-day precision. * </p> */ public boolean isTimeIncluded(long timeStamp) { if (excludeAll == true) { return false; } // Test the base calendar first. Only if the base calendar not already // excludes the time/date, continue evaluating this calendar instance. if (super.isTimeIncluded(timeStamp) == false) { return false; } java.util.Calendar cl = createJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); return !(isDayExcluded(wday)); }
java.util.Calendar cl = getStartOfDayJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); if (!isDayExcluded(wday)) { return timeStamp; // return the original value while (isDayExcluded(wday) == true) { cl.add(java.util.Calendar.DATE, 1); wday = cl.get(java.util.Calendar.DAY_OF_WEEK);
public WeeklyCalendar(Calendar baseCalendar, TimeZone timeZone) { super(baseCalendar, timeZone); excludeDays[java.util.Calendar.SUNDAY] = true; excludeDays[java.util.Calendar.SATURDAY] = true; excludeAll = areAllDaysExcluded(); }
/** * <p> * Check if all week days are excluded. That is no day is included. * </p> * * @return boolean */ public boolean areAllDaysExcluded() { return isDayExcluded(java.util.Calendar.SUNDAY) && isDayExcluded(java.util.Calendar.MONDAY) && isDayExcluded(java.util.Calendar.TUESDAY) && isDayExcluded(java.util.Calendar.WEDNESDAY) && isDayExcluded(java.util.Calendar.THURSDAY) && isDayExcluded(java.util.Calendar.FRIDAY) && isDayExcluded(java.util.Calendar.SATURDAY); }
/** * <p> * Determine whether the given time (in milliseconds) is 'included' by the * Calendar. * </p> * * <p> * Note that this Calendar is only has full-day precision. * </p> */ public boolean isTimeIncluded(long timeStamp) { if (excludeAll == true) { return false; } // Test the base calendar first. Only if the base calendar not already // excludes the time/date, continue evaluating this calendar instance. if (super.isTimeIncluded(timeStamp) == false) { return false; } java.util.Calendar cl = createJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); return !(isDayExcluded(wday)); }
java.util.Calendar cl = getStartOfDayJavaCalendar(timeStamp); int wday = cl.get(java.util.Calendar.DAY_OF_WEEK); if (!isDayExcluded(wday)) { return timeStamp; // return the original value while (isDayExcluded(wday) == true) { cl.add(java.util.Calendar.DATE, 1); wday = cl.get(java.util.Calendar.DAY_OF_WEEK);