本文整理汇总了Java中java.util.Calendar.SATURDAY属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.SATURDAY属性的具体用法?Java Calendar.SATURDAY怎么用?Java Calendar.SATURDAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.util.Calendar
的用法示例。
在下文中一共展示了Calendar.SATURDAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: overlap
public boolean overlap(Assignment assignment, int nrTravelSlots) {
//check date pattern
DatePattern dp = assignment.getDatePattern();
int dpIndex = getDateOffset()-getSession().getExamBeginOffset()-(dp.getOffset()==null?0:dp.getOffset());
if (dp.getPattern()==null || dpIndex<0 || dpIndex>=dp.getPattern().length() || dp.getPattern().charAt(dpIndex)!='1') return false;
//check day of week
Calendar cal = Calendar.getInstance(Locale.US);
cal.setTime(getSession().getExamBeginDate());
cal.add(Calendar.DAY_OF_YEAR, getDateOffset());
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_MON])==0) return false; break;
case Calendar.TUESDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_TUE])==0) return false; break;
case Calendar.WEDNESDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_WED])==0) return false; break;
case Calendar.THURSDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_THU])==0) return false; break;
case Calendar.FRIDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_FRI])==0) return false; break;
case Calendar.SATURDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_SAT])==0) return false; break;
case Calendar.SUNDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_SUN])==0) return false; break;
}
//check time
return getStartSlot() - nrTravelSlots < assignment.getStartSlot() + assignment.getSlotPerMtg() && assignment.getStartSlot() < getStartSlot() + getLength() + nrTravelSlots;
}
示例2: getDaysCode
public int getDaysCode(Event event) {
int daysCode = 0;
for (Iterator i=event.getMeetings().iterator();i.hasNext();) {
Meeting meeting = (Meeting)i.next();
Calendar date = Calendar.getInstance(Locale.US);
date.setTime(meeting.getMeetingDate());
switch (date.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
}
}
return daysCode;
}
示例3: dayOfWeekConv
private static int dayOfWeekConv(int fieldVal) {
switch (fieldVal) {
case Calendar.SUNDAY:
return 6;
case Calendar.MONDAY:
return 0;
case Calendar.TUESDAY:
return 1;
case Calendar.WEDNESDAY:
return 2;
case Calendar.THURSDAY:
return 3;
case Calendar.FRIDAY:
return 4;
case Calendar.SATURDAY:
return 5;
}
return -1;
}
示例4: dayIsRepeat
private static boolean dayIsRepeat(int calendarDow, int repeat) {
switch (calendarDow) {
case Calendar.SUNDAY:
return (1 & repeat) != 0;
case Calendar.MONDAY:
return (2 & repeat) != 0;
case Calendar.TUESDAY:
return (4 & repeat) != 0;
case Calendar.WEDNESDAY:
return (8 & repeat) != 0;
case Calendar.THURSDAY:
return (16 & repeat) != 0;
case Calendar.FRIDAY:
return (32 & repeat) != 0;
case Calendar.SATURDAY:
return (64 & repeat) != 0;
}
return true;
}
示例5: getDays
public String getDays(String[] dayNames, String[] shortDyNames) {
int nrDays = 0;
int dayCode = 0;
for (Meeting meeting : getMeetings()) {
int dc = 0;
switch (meeting.getDayOfWeek()) {
case Calendar.MONDAY : dc = Constants.DAY_CODES[Constants.DAY_MON]; break;
case Calendar.TUESDAY : dc = Constants.DAY_CODES[Constants.DAY_TUE]; break;
case Calendar.WEDNESDAY : dc = Constants.DAY_CODES[Constants.DAY_WED]; break;
case Calendar.THURSDAY : dc = Constants.DAY_CODES[Constants.DAY_THU]; break;
case Calendar.FRIDAY : dc = Constants.DAY_CODES[Constants.DAY_FRI]; break;
case Calendar.SATURDAY : dc = Constants.DAY_CODES[Constants.DAY_SAT]; break;
case Calendar.SUNDAY : dc = Constants.DAY_CODES[Constants.DAY_SUN]; break;
}
if ((dayCode & dc)==0) nrDays++;
dayCode |= dc;
}
String ret = "";
for (int i=0;i<Constants.DAY_CODES.length;i++) {
if ((dayCode & Constants.DAY_CODES[i])!=0)
ret += (nrDays==1?dayNames:shortDyNames)[i];
}
return ret;
}
示例6: getDay
public static int getDay(String day) {
if(day.equals("Mon"))
return Calendar.MONDAY;
if(day.equals("Tue"))
return Calendar.TUESDAY;
if(day.equals("Wed"))
return Calendar.WEDNESDAY;
if(day.equals("Thu"))
return Calendar.THURSDAY;
if(day.equals("Fri"))
return Calendar.FRIDAY;
if(day.equals("Sat"))
return Calendar.SATURDAY;
if(day.equals("Sun"))
return Calendar.SUNDAY;
return Calendar.MONDAY;
}
示例7: hasDates
protected boolean hasDates(DatePattern datePattern, int dayCode) {
if (datePattern == null) return false;
Calendar cal = Calendar.getInstance(Locale.US);
cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
String pattern = datePattern.getPattern();
for (int idx = 0; idx < pattern.length(); idx++) {
if (pattern.charAt(idx) == '1') {
boolean offered = false;
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
}
if (offered) return true;
}
cal.add(Calendar.DAY_OF_YEAR, 1);
}
return false;
}
示例8: getDaysCode
public int getDaysCode(Set meetings) {
int daysCode = 0;
for (Iterator i=meetings.iterator();i.hasNext();) {
Meeting meeting = (Meeting)i.next();
Calendar date = Calendar.getInstance(Locale.US);
date.setTime(meeting.getMeetingDate());
switch (date.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
}
}
return daysCode;
}
示例9: nbrMeetings
protected int nbrMeetings(DatePattern datePattern, int dayCode) {
if (datePattern == null) return 0;
Calendar cal = Calendar.getInstance(Locale.US);
cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
String pattern = datePattern.getPattern();
int ret = 0;
for (int idx = 0; idx < pattern.length(); idx++) {
if (pattern.charAt(idx) == '1') {
boolean offered = false;
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
}
if (offered) ret++;
}
cal.add(Calendar.DAY_OF_YEAR, 1);
}
return ret;
}
示例10: getDates
/**
* Return all dates marked yellow in the given date pattern that are matching the selected day code (days of week)
*/
@Override
public List<Date> getDates(int minsPerWeek, DatePattern datePattern, int dayCode, int minutesPerMeeting) {
List<Date> ret = new ArrayList<Date>();
if (datePattern == null) return ret;
Calendar cal = Calendar.getInstance(Locale.US);
cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
EventDateMapping.Class2EventDateMap class2eventDates = EventDateMapping.getMapping(datePattern.getSession().getUniqueId());
String pattern = datePattern.getPattern();
for (int idx = 0; idx < pattern.length(); idx++) {
if (pattern.charAt(idx) == '1') {
boolean offered = false;
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
}
if (offered) ret.add(class2eventDates.getEventDate(cal.getTime()));
}
cal.add(Calendar.DAY_OF_YEAR, 1);
}
return ret;
}
示例11: getWeek
private String getWeek(String pTime) {
String Week = "";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
try {
c.setTime(format.parse(pTime));
} catch (ParseException e) {
return null;
}
switch (c.get(Calendar.DAY_OF_WEEK)){
case Calendar.SUNDAY:
Week = "周日";
break;
case Calendar.MONDAY:
Week = "周一";
break;
case Calendar.TUESDAY:
Week = "周二";
break;
case Calendar.WEDNESDAY:
Week = "周三";
break;
case Calendar.THURSDAY:
Week = "周四";
break;
case Calendar.FRIDAY:
Week = "周五";
break;
case Calendar.SATURDAY:
Week = "周六";
break;
}
return Week;
}
示例12: getValueAt
public Object getValueAt(int row, int col) {
Event ev = getEventAt(row,col);
if(ev == null) return "";
Calendar cal = (Calendar)days[col].get(row);
String res = "";
switch(cal.get(Calendar.DAY_OF_WEEK)){
case Calendar.SUNDAY: res += "SU";
break;
case Calendar.MONDAY: res += "MO";
break;
case Calendar.TUESDAY: res += "TU";
break;
case Calendar.WEDNESDAY: res += "WE";
break;
case Calendar.THURSDAY: res += "TH";
break;
case Calendar.FRIDAY: res += "FR";
break;
case Calendar.SATURDAY: res += "SA";
break;
default: res += "??";
}
String dOM = cal.get(Calendar.DAY_OF_MONTH) + "";
switch(cal.get(Calendar.DAY_OF_MONTH)%10){
case 1: dOM += "st";
break;
case 2: dOM += "nd";
break;
case 3: dOM += "rd";
break;
default:dOM+="th";
}
res+= " / " + dOM + ": ";
if(ev.getText().equals("")) res+= "EVENT";
else res += ev.getText();
return res;
}
示例13: checkCurrentTime
private void checkCurrentTime() {
Calendar now = Calendar.getInstance();
int second = now.get(Calendar.SECOND);
int minute = now.get(Calendar.MINUTE);
int hour = now.get(Calendar.HOUR_OF_DAY);
int weekday = now.get(Calendar.DAY_OF_WEEK);
boolean isWeekend = weekday == Calendar.SUNDAY || weekday == Calendar.SATURDAY;
_logger.Debug(String.format(Locale.GERMAN,
"checkCurrentTime at %02d:%02d:%02d on %d",
hour, minute, second, weekday));
if ((second >= 0 && second < 5) && minute == 0) {
for (AutomaticSettings entry : AutomaticSettings.values()) {
if (entry.GetEnableHour() == hour) {
if ((entry.IsWeekend() && isWeekend) || (!entry.IsWeekend() && !isWeekend)) {
int maxVolume = _mediaVolumeController.GetMaxVolume();
double currentVolume = (entry.GetSoundVolumePercentage() / 100) * maxVolume;
setSettings(currentVolume, (int) entry.GetScreenBrightnessPercentage());
break;
}
}
}
}
}
示例14: isRestDay
public static boolean isRestDay(Calendar cal) {
if (!initialized) {
throw new IllegalStateException("need init first");
}
int yearIndex = cal.get(Calendar.YEAR) - baseYear;
if (yearIndex < 0 || yearIndex >= days.length) {
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
return dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
}
int dayOfYear = cal.get(Calendar.DAY_OF_YEAR) - 1;
return (days[yearIndex][dayOfYear / 8] & (byte) (1 << dayOfYear % 8)) != 0;
}
示例15: getTodaysHabits
/**
* Returns a list of all habits belonging to the current user that are scheduled for the current
* day of the week.
* @return A HabitList containing today's habits
* @see HabitList
*/
public static HabitList getTodaysHabits() {
/*
Taken from: https://stackoverflow.com/questions/5574673/what-is-the-easiest-way-to-get-
the-current-day-of-the-week-in-android
Date: Nov 13, 2017
*/
String today = "";
int day = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
switch (day) {
case Calendar.SUNDAY: today = "Sun"; break;
case Calendar.MONDAY: today = "Mon"; break;
case Calendar.TUESDAY: today = "Tue"; break;
case Calendar.WEDNESDAY:today = "Wed"; break;
case Calendar.THURSDAY: today = "Thu"; break;
case Calendar.FRIDAY: today = "Fri"; break;
case Calendar.SATURDAY: today = "Sat"; break;
default: today = null; break;
}
HabitList returnList = new HabitList();
for (Habit x : getHabitList().getHabits()) {
if (x.getScheduledHabitDays().contains(today)) {
returnList.addHabit(x);
}
}
return returnList;
}