List of usage examples for java.util Calendar THURSDAY
int THURSDAY
To view the source code for java.util Calendar THURSDAY.
Click Source Link
From source file:org.activequant.util.charting.IntradayMarketTimeline.java
private boolean isActiveDate(Calendar cal, Calendar cal2) { int day = cal.get(Calendar.DAY_OF_WEEK); long timeSinceStart = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000 + cal.get(Calendar.SECOND) * 1000; boolean firstDate = false; if (day == Calendar.SUNDAY) { firstDate = (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd); } else if (day == Calendar.MONDAY) { firstDate = (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd); } else if (day == Calendar.TUESDAY) { firstDate = (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd); } else if (day == Calendar.WEDNESDAY) { firstDate = (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd); } else if (day == Calendar.THURSDAY) { firstDate = (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd); } else if (day == Calendar.FRIDAY) { firstDate = (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd); } else if (day == Calendar.SATURDAY) { firstDate = (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd); } else {//from w w w. ja v a2 s . com firstDate = false; } int day2 = cal2.get(Calendar.DAY_OF_WEEK); timeSinceStart = cal2.get(Calendar.HOUR_OF_DAY) * 3600000 + cal2.get(Calendar.MINUTE) * 60000 + cal2.get(Calendar.SECOND) * 1000; boolean secondDate = false; if (day2 == Calendar.SUNDAY) { secondDate = (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd); } else if (day2 == Calendar.MONDAY) { secondDate = (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd); } else if (day2 == Calendar.TUESDAY) { secondDate = (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd); } else if (day2 == Calendar.WEDNESDAY) { secondDate = (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd); } else if (day2 == Calendar.THURSDAY) { secondDate = (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd); } else if (day2 == Calendar.FRIDAY) { secondDate = (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd); } else if (day2 == Calendar.SATURDAY) { secondDate = (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd); } else { secondDate = false; } return (firstDate && secondDate); }
From source file:de.ribeiro.android.gso.dataclasses.Pager.java
private String ResolveWeekDay(int value) { switch (value) { case Calendar.MONDAY: return "Montag"; case Calendar.TUESDAY: return "Dienstag"; case Calendar.WEDNESDAY: return "Mittwoch"; case Calendar.THURSDAY: return "Donnerstag"; case Calendar.FRIDAY: return "Freitag"; case Calendar.SATURDAY: return "Samstag"; case Calendar.SUNDAY: return "Sonntag"; default:/*from w w w. ja v a2s . c o m*/ return String.valueOf(value); } }
From source file:Time.java
/** * Get default locale name of this day ("Monday", "Tuesday", etc. * //from w ww .ja v a2 s .c o m * @return Name of day. */ public String getDayName() { switch (getDayOfWeek()) { case Calendar.MONDAY: return "Monday"; case Calendar.TUESDAY: return "Tuesday"; case Calendar.WEDNESDAY: return "Wednesday"; case Calendar.THURSDAY: return "Thursday"; case Calendar.FRIDAY: return "Friday"; case Calendar.SATURDAY: return "Saturday"; case Calendar.SUNDAY: return "Sunday"; } // This will never happen return null; }
From source file:org.sakaiproject.tool.section.jsf.backingbean.AddSectionsBean.java
public String getThursday() { return daysOfWeek[Calendar.THURSDAY]; }
From source file:org.jasig.schedassist.model.AvailableBlockBuilder.java
/** * Returns a {@link List} of {@link Date} objects that fall between startDate and endDate and * exist on the days specified by daysOfWeekPhrase. * /*from www .ja v a 2 s .c o m*/ * For instance, passing "MWF", a start Date of June 30 2008, and an end Date of July 04 2008, this * method will return a list of 3 Date objects (one for Monday June 30, one for Wednesday July 2, and * one for Friday July 4). * * The time values for returned {@link Date}s will always be 00:00:00 (in the JVM's default timezone). * * @param daysOfWeekPhrase * @param startDate * @param endDate * @return a {@link List} of {@link Date} objects that fall between startDate and endDate and * exist on the days specified by daysOfWeekPhrase. */ protected static List<Date> matchingDays(final String daysOfWeekPhrase, final Date startDate, final Date endDate) { List<Date> matchingDays = new ArrayList<Date>(); Set<Integer> daysOfWeek = new HashSet<Integer>(); for (char character : daysOfWeekPhrase.toUpperCase().toCharArray()) { switch (character) { case 'N': daysOfWeek.add(Calendar.SUNDAY); break; case 'M': daysOfWeek.add(Calendar.MONDAY); break; case 'T': daysOfWeek.add(Calendar.TUESDAY); break; case 'W': daysOfWeek.add(Calendar.WEDNESDAY); break; case 'R': daysOfWeek.add(Calendar.THURSDAY); break; case 'F': daysOfWeek.add(Calendar.FRIDAY); break; case 'S': daysOfWeek.add(Calendar.SATURDAY); break; } } Calendar current = Calendar.getInstance(); current.setTime(startDate); // set the time to 00:00:00 to insure the time doesn't affect our comparison) // (because there may be a valid time window on endDate) current = CommonDateOperations.zeroOutTimeFields(current); while (current.getTime().compareTo(endDate) < 0) { if (daysOfWeek.contains(current.get(Calendar.DAY_OF_WEEK))) { matchingDays.add(current.getTime()); } // increment currentDate +1 day current.add(Calendar.DATE, 1); } return matchingDays; }
From source file:org.kuali.student.r2.core.scheduling.service.impl.TestSchedulingServiceImpl.java
@Test public void testgetTimeSlotsByIds() throws Exception { // test case: all valid ids List<String> valid_ids = new ArrayList<String>(); valid_ids.add("ts102"); valid_ids.add("ts115"); List<TimeSlotInfo> l_valid_ts = schedulingService.getTimeSlotsByIds(valid_ids, contextInfo); assertEquals(2, valid_ids.size());// w w w. ja v a 2 s.c o m TimeSlot ts2 = null, ts15 = null; // ensure the list has only time slots with ids 2 and 15 for (TimeSlotInfo ts : l_valid_ts) { assertTrue(valid_ids.contains(ts.getId())); if (ts.getId().equals("ts102")) { ts2 = ts; } else { ts15 = ts; } } assertNotNull(ts2); assertEquals("ts102", ts2.getId()); List<Integer> dow = ts2.getWeekdays(); // should contain Monday, Wednesday, Friday assertTrue(dow.contains(Calendar.MONDAY)); assertTrue(dow.contains(Calendar.WEDNESDAY)); assertTrue(dow.contains(Calendar.FRIDAY)); // should not contain Tuesday or Thursday assertFalse(dow.contains(Calendar.TUESDAY)); assertFalse(dow.contains(Calendar.THURSDAY)); assertEquals(ts2.getStartTime(), TOD_8_AM); assertEquals(ts2.getEndTime(), TOD_9_10_AM); assertNotNull(ts15); assertEquals("ts115", ts15.getId()); dow = ts15.getWeekdays(); // should not contain Monday, Wednesday, Friday assertFalse(dow.contains(Calendar.MONDAY)); assertFalse(dow.contains(Calendar.WEDNESDAY)); assertFalse(dow.contains(Calendar.FRIDAY)); // should contain Tuesday or Thursday assertTrue(dow.contains(Calendar.TUESDAY)); assertTrue(dow.contains(Calendar.THURSDAY)); assertEquals(ts15.getStartTime(), TOD_3_PM); assertEquals(ts15.getEndTime(), TOD_3_50_PM); // test case: all invalid ids List<String> invalid_ids = new ArrayList<String>(); invalid_ids.add("bad1"); invalid_ids.add("bad2"); try { schedulingService.getTimeSlotsByIds(invalid_ids, contextInfo); fail("Should not be here - test invalid_ids"); } catch (DoesNotExistException e) { assertNotNull(e.getMessage()); assertEquals("No data was found for : bad1, bad2", e.getMessage()); } // test case: mixture of valid and invalid List<String> mix_ids = new ArrayList<String>(); mix_ids.add("ts110"); mix_ids.add("bad1"); try { schedulingService.getTimeSlotsByIds(mix_ids, contextInfo); fail("Should not be here - test mix_ids"); } catch (DoesNotExistException e) { assertNotNull(e.getMessage()); assertEquals("Missing data for : bad1", e.getMessage()); } }
From source file:org.ejbca.ui.web.admin.certprof.CertProfileBean.java
public boolean isExpirationRestrictionThursday() throws AuthorizationDeniedException { return getCertificateProfile().getExpirationRestrictionWeekday(Calendar.THURSDAY); }
From source file:com.embeddedlog.LightUpDroid.LightUpPiSync.java
private Alarm alarmFromJson(JSONObject aJson) { // If mSelectedAlarm is null then we're creating a new alarm. Alarm alarm = new Alarm(); alarm.alert = RingtoneManager.getActualDefaultRingtoneUri(mActivityContext, RingtoneManager.TYPE_ALARM); if (alarm.alert == null) { alarm.alert = Uri.parse("content://settings/system/alarm_alert"); }/*w w w. j a v a2 s .com*/ // Setting the vibrate option to always true, as there is no attribute in LightUpPi alarm.vibrate = true; // Setting the 'delete after use' option to always false, as there is no such feature in // the LightUpPi alarm system and all alarms are repeatable alarm.deleteAfterUse = false; // Parsing the JSON data try { alarm.hour = aJson.getInt("hour"); alarm.minutes = aJson.getInt("minute"); alarm.enabled = aJson.getBoolean("enabled"); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("monday"), Calendar.MONDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("tuesday"), Calendar.TUESDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("wednesday"), Calendar.WEDNESDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("thursday"), Calendar.THURSDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("friday"), Calendar.FRIDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("saturday"), Calendar.SATURDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("sunday"), Calendar.SUNDAY); alarm.label = aJson.getString("label"); alarm.lightuppiId = aJson.getLong("id"); alarm.timestamp = aJson.getLong("timestamp"); } catch (JSONException e) { Log.w(LOG_TAG + " JSONException: " + e.toString()); alarm = null; } return alarm; }
From source file:com.sonyericsson.hudson.plugins.gerrit.trigger.config.Config.java
/** * Adds the WatchTimeExceptionData from the form. * * @param formData the form./*from w w w .j a v a2 s . c o m*/ * @return the WatchTimeExceptionData */ private WatchTimeExceptionData addWatchTimeExceptionData(JSONObject formData) { List<Integer> days = new LinkedList<Integer>(); List<TimeSpan> exceptionTimes = new LinkedList<TimeSpan>(); int[] daysAsInt = new int[] {}; if (formData.has("watchdogExceptions")) { JSONObject jsonObject = formData.getJSONObject(("watchdogExceptions")); if (jsonObject.getBoolean(String.valueOf(Calendar.MONDAY))) { days.add(Calendar.MONDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.TUESDAY))) { days.add(Calendar.TUESDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.WEDNESDAY))) { days.add(Calendar.WEDNESDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.THURSDAY))) { days.add(Calendar.THURSDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.FRIDAY))) { days.add(Calendar.FRIDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.SATURDAY))) { days.add(Calendar.SATURDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.SUNDAY))) { days.add(Calendar.SUNDAY); } daysAsInt = Ints.toArray(days); if (jsonObject.has("watchdogExceptionTimes")) { Object obj = jsonObject.get("watchdogExceptionTimes"); if (obj instanceof JSONArray) { for (Object json : (JSONArray) obj) { exceptionTimes.add(TimeSpan.createTimeSpanFromJSONObject((JSONObject) json)); } } else if (obj instanceof JSONObject) { exceptionTimes.add(TimeSpan.createTimeSpanFromJSONObject((JSONObject) obj)); } } } return new WatchTimeExceptionData(daysAsInt, exceptionTimes); }
From source file:org.ejbca.ui.web.admin.certprof.CertProfileBean.java
public void setExpirationRestrictionThursday(final boolean enabled) throws AuthorizationDeniedException { getCertificateProfile().setExpirationRestrictionWeekday(Calendar.THURSDAY, enabled); }