当前位置: 首页>>代码示例>>Java>>正文


Java Calendar.SATURDAY属性代码示例

本文整理汇总了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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:23,代码来源:ExamPeriod.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:18,代码来源:MakeAssignmentsForClassEvents.java

示例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;
}
 
开发者ID:mob41,项目名称:broadlink-java-api,代码行数:19,代码来源:DiscoveryPacket.java

示例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;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:19,代码来源:TimeUtil.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:24,代码来源:Event.java

示例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;
    }
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:19,代码来源:AppUtils.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:23,代码来源:MinutesPerWeek.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:18,代码来源:ClassesAction.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:24,代码来源:MeetingCountingDuration.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:29,代码来源:MinutesPerWeek.java

示例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;
}
 
开发者ID:xfangfang,项目名称:NeuTV,代码行数:34,代码来源:Video.java

示例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;       		
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:37,代码来源:EventsTableMonthly.java

示例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;
                }
            }
        }
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:27,代码来源:MainService.java

示例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;
}
 
开发者ID:alibaba,项目名称:bulbasaur,代码行数:12,代码来源:DayUtils.java

示例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;
}
 
开发者ID:CMPUT301F17T23,项目名称:routineKeen,代码行数:34,代码来源:HabitListController.java


注:本文中的java.util.Calendar.SATURDAY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。