List of usage examples for java.util Calendar SATURDAY
int SATURDAY
To view the source code for java.util Calendar SATURDAY.
Click Source Link
From source file:org.infoscoop.util.Holiday.java
public int getFreshDays(Calendar cal, int freshDays) { if (isHoliday(cal) || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) { freshDays++;/*from www . j a v a2 s.com*/ cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), (cal.get(Calendar.DATE) - 1)); freshDays = getFreshDays(cal, freshDays); } return freshDays; }
From source file:org.openmrs.module.pharmacyapi.api.prescription.util.NewPrescriptionItemGenerator.java
private Date getExpirationDateMinus2Days(final PrescriptionItem item) { final Calendar calendar = Calendar.getInstance(); calendar.setTime(item.getDrugOrder().getEncounter().getDateCreated()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.DAY_OF_MONTH, 10); while ((calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)) { calendar.add(Calendar.DAY_OF_MONTH, 1); }//w w w .j a va2 s . c o m return calendar.getTime(); }
From source file:com.autentia.tnt.manager.holiday.UserHolidaysStateManager.java
/** * @return Indica si un da es festivo//from ww w . j a v a2 s. c om */ private boolean isHoliday(List<Holiday> fiestas, Date date) { // Es fin de semana ? Calendar cActual = Calendar.getInstance(); cActual.setTime(date); if ((cActual.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) || (cActual.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) { return true; } Iterator<Holiday> ite = fiestas.iterator(); Holiday current; while (ite.hasNext()) { current = ite.next(); if (DateUtils.isSameDay(current.getDate(), date)) { return true; } } return false; }
From source file:org.kuali.student.r2.core.scheduling.util.SchedulingServiceUtil.java
/** * Converts a list of Calendar constants (i.e. Calendar.MONDAY, Calendar.FRIDAY) into a string of characters representing those days * Used in DTO/Entity translations for TimeSlot * * @param weekdaysList//from w w w .j av a 2 s .c o m * @return */ public static String weekdaysList2WeekdaysString(List<Integer> weekdaysList) { StringBuilder result = new StringBuilder(); for (Integer day : weekdaysList) { switch (day) { case Calendar.MONDAY: { result.append(SchedulingServiceConstants.MONDAY_TIMESLOT_DAY_CODE); break; } case Calendar.TUESDAY: { result.append(SchedulingServiceConstants.TUESDAY_TIMESLOT_DAY_CODE); break; } case Calendar.WEDNESDAY: { result.append(SchedulingServiceConstants.WEDNESDAY_TIMESLOT_DAY_CODE); break; } case Calendar.THURSDAY: { result.append(SchedulingServiceConstants.THURSDAY_TIMESLOT_DAY_CODE); break; } case Calendar.FRIDAY: { result.append(SchedulingServiceConstants.FRIDAY_TIMESLOT_DAY_CODE); break; } case Calendar.SATURDAY: { result.append(SchedulingServiceConstants.SATURDAY_TIMESLOT_DAY_CODE); break; } case Calendar.SUNDAY: { result.append(SchedulingServiceConstants.SUNDAY_TIMESLOT_DAY_CODE); break; } } } return result.toString(); }
From source file:com.karthikb351.vitinfo2.fragment.schedule.ScheduleFragment.java
private int getEquivalentDay(int day) { switch (day) { case Calendar.SUNDAY: day = 6;//from w w w. j av a 2 s . com break; case Calendar.MONDAY: case Calendar.TUESDAY: case Calendar.WEDNESDAY: case Calendar.THURSDAY: case Calendar.FRIDAY: case Calendar.SATURDAY: day -= 2; break; default: day = 0; } return day; }
From source file:calendar.services.transformers.EntryToWeekRowTransformer.java
private BigDecimal setEntryToDayInWeekRow(Entry entry, WeekRow weekRow) { Date date = entry.getDate();// w w w . j a va 2 s . c o m Calendar cal = Calendar.getInstance(); cal.setTime(date); Integer dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); BigDecimal entryHours = entry.getHours(); switch (cal.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: weekRow.setDay7Total(weekRow.getDay7Total().add(entryHours)); weekRow.setDay7(entry.getDate()); break; case Calendar.MONDAY: weekRow.setDay1Total(weekRow.getDay1Total().add(entryHours)); weekRow.setDay1(entry.getDate()); break; case Calendar.TUESDAY: weekRow.setDay2Total(weekRow.getDay2Total().add(entryHours)); weekRow.setDay2(entry.getDate()); break; case Calendar.WEDNESDAY: weekRow.setDay3Total(weekRow.getDay3Total().add(entryHours)); weekRow.setDay3(entry.getDate()); break; case Calendar.THURSDAY: weekRow.setDay4Total(weekRow.getDay4Total().add(entryHours)); weekRow.setDay4(entry.getDate()); break; case Calendar.FRIDAY: weekRow.setDay5Total(weekRow.getDay5Total().add(entryHours)); weekRow.setDay5(entry.getDate()); break; case Calendar.SATURDAY: weekRow.setDay6Total(weekRow.getDay6Total().add(entryHours)); weekRow.setDay6(entry.getDate()); break; } return entryHours; }
From source file:com.netflix.simianarmy.basic.BasicCalendar.java
/** {@inheritDoc} */ @Override// www .j a va 2 s. co m public boolean isMonkeyTime(Monkey monkey) { if (cfg != null && cfg.getStrOrElse("simianarmy.calendar.isMonkeyTime", null) != null) { return cfg.getBool("simianarmy.calendar.isMonkeyTime"); } Calendar now = now(); int dow = now.get(Calendar.DAY_OF_WEEK); if (dow == Calendar.SATURDAY || dow == Calendar.SUNDAY) { return false; } int hour = now.get(Calendar.HOUR_OF_DAY); if (hour < openHour || hour > closeHour) { return false; } if (isHoliday(now)) { return false; } return true; }
From source file:com.shalzz.attendance.adapter.TimeTablePagerAdapter.java
public int getPositionForDate(Date date) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext); boolean show = sharedPref.getBoolean(mContext.getString(R.string.pref_key_show_weekends), true); if (!show) {//from w w w.j a v a2s . c o m Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) { calendar.add(Calendar.DATE, 1); } if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { calendar.add(Calendar.DATE, 1); } date = calendar.getTime(); } return positions.get(date); }
From source file:JapaneseCalendar.java
public void paintComponent(Graphics g) { int width = 400; int height = 400; Calendar cal = Calendar.getInstance(locale); cal.setTime(new Date()); String header = cal.getDisplayName(Calendar.MONTH, Calendar.LONG, locale); header += " " + cal.get(Calendar.YEAR); FontMetrics fm = g.getFontMetrics(); Insets insets = getInsets();/*from w w w . j a v a 2 s.c om*/ g.setColor(Color.black); g.drawString(header, (width - fm.stringWidth(header)) / 2, insets.top + fm.getHeight()); DateFormatSymbols dfs = new DateFormatSymbols(locale); String[] weekdayNames = dfs.getShortWeekdays(); int fieldWidth = (width - insets.left - insets.right) / 7; g.drawString(weekdayNames[Calendar.SUNDAY], insets.left + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.SUNDAY])) / 2, insets.top + 3 * fm.getHeight()); g.drawString(weekdayNames[Calendar.MONDAY], insets.left + fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.MONDAY])) / 2, insets.top + 3 * fm.getHeight()); g.drawString(weekdayNames[Calendar.TUESDAY], insets.left + 2 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.TUESDAY])) / 2, insets.top + 3 * fm.getHeight()); g.drawString(weekdayNames[Calendar.WEDNESDAY], insets.left + 3 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.WEDNESDAY])) / 2, insets.top + 3 * fm.getHeight()); g.drawString(weekdayNames[Calendar.THURSDAY], insets.left + 4 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.THURSDAY])) / 2, insets.top + 3 * fm.getHeight()); g.drawString(weekdayNames[Calendar.FRIDAY], insets.left + 5 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.FRIDAY])) / 2, insets.top + 3 * fm.getHeight()); g.drawString(weekdayNames[Calendar.SATURDAY], insets.left + 6 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.SATURDAY])) / 2, insets.top + 3 * fm.getHeight()); int dom = cal.get(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, 1); int col = 0; switch (cal.get(Calendar.DAY_OF_WEEK)) { case Calendar.MONDAY: col = 1; break; case Calendar.TUESDAY: col = 2; break; case Calendar.WEDNESDAY: col = 3; break; case Calendar.THURSDAY: col = 4; break; case Calendar.FRIDAY: col = 5; break; case Calendar.SATURDAY: col = 6; } cal.set(Calendar.DAY_OF_MONTH, dom); int row = 5 * fm.getHeight(); for (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) { g.drawString("" + i, insets.left + fieldWidth * col + (fieldWidth - fm.stringWidth("" + i)) / 2, row); if (++col > 6) { col = 0; row += fm.getHeight(); } } }
From source file:org.ohmage.reminders.types.time.TimeTrigDesc.java
private void initialize(boolean repeatStatus) { mIsRandomized = false;//w w w . j a v a 2s. c om mIsRangeEnabled = false; mRepeatList.put(getDayOfWeekString(Calendar.SUNDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.MONDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.TUESDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.WEDNESDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.THURSDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.FRIDAY), repeatStatus); mRepeatList.put(getDayOfWeekString(Calendar.SATURDAY), repeatStatus); }