Java Code Examples for java.util.Calendar#THURSDAY

The following examples show how to use java.util.Calendar#THURSDAY . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: SublimePicker   File: EventRecurrence.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Converts one of the SU, MO, etc. constants to the Calendar.SUNDAY
 * constants.  btw, I think we should switch to those here too, to
 * get rid of this function, if possible.
 */
public static int day2CalendarDay(int day) {
    switch (day) {
        case SU:
            return Calendar.SUNDAY;
        case MO:
            return Calendar.MONDAY;
        case TU:
            return Calendar.TUESDAY;
        case WE:
            return Calendar.WEDNESDAY;
        case TH:
            return Calendar.THURSDAY;
        case FR:
            return Calendar.FRIDAY;
        case SA:
            return Calendar.SATURDAY;
        default:
            throw new RuntimeException("bad day of week: " + day);
    }
}
 
Example 2
Source Project: unitime   File: MeetingCountingDuration.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source Project: unitime   File: Event.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 4
Source Project: arcusplatform   File: ZclDataUtil.java    License: Apache License 2.0 6 votes vote down vote up
private static int fromDate(Date date) throws IOException {
   Calendar calendar = (Calendar)ZIGBEE_EPOCH.clone();
   calendar.setTime(date);

   int year = (calendar.get(Calendar.YEAR) - 1900) & 0xFF;
   int month = (calendar.get(Calendar.MONTH) + 1) & 0xFF;
   int day = calendar.get(Calendar.DATE) & 0xFF;
   int dow;
   switch (calendar.get(Calendar.DAY_OF_WEEK)) {
   case Calendar.MONDAY: dow = 1; break;
   case Calendar.TUESDAY: dow = 2; break;
   case Calendar.WEDNESDAY: dow = 3; break;
   case Calendar.THURSDAY: dow = 4; break;
   case Calendar.FRIDAY: dow = 5; break;
   case Calendar.SATURDAY: dow = 6; break;
   case Calendar.SUNDAY: dow = 7; break;
   default: throw new IllegalStateException("invalid day of week from zigbee date");
   }

   return (year << 24) | (month << 16) | (day << 8) | dow;
}
 
Example 5
Source Project: SublimePicker   File: EventRecurrence.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Converts one of the Calendar.SUNDAY constants to the SU, MO, etc.
 * constants.  btw, I think we should switch to those here too, to
 * get rid of this function, if possible.
 */
public static int calendarDay2Day(int day) {
    switch (day) {
        case Calendar.SUNDAY:
            return SU;
        case Calendar.MONDAY:
            return MO;
        case Calendar.TUESDAY:
            return TU;
        case Calendar.WEDNESDAY:
            return WE;
        case Calendar.THURSDAY:
            return TH;
        case Calendar.FRIDAY:
            return FR;
        case Calendar.SATURDAY:
            return SA;
        default:
            throw new RuntimeException("bad day of week: " + day);
    }
}
 
Example 6
public static String getDayFromDate(Context context, Date date){
    Calendar c = Calendar.getInstance();
    c.setTime(date);

    int day = c.get(Calendar.DAY_OF_WEEK);

    switch (day){
        case Calendar.SUNDAY:
            return context.getString(R.string.word_sunday);
        case Calendar.MONDAY:
            return context.getString(R.string.word_monday);
        case Calendar.TUESDAY:
            return context.getString(R.string.word_tuesday);
        case Calendar.WEDNESDAY:
            return context.getString(R.string.word_wednesday);
        case Calendar.THURSDAY:
            return context.getString(R.string.word_thursday);
        case Calendar.FRIDAY:
            return context.getString(R.string.word_friday);
        case Calendar.SATURDAY:
            return context.getString(R.string.word_saturday);
        default:
            return DateFormatter.format(date, "MMMM d");
    }
}
 
Example 7
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;
}
 
Example 8
Source Project: Noyze   File: DateUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static Date ThanksgivingObserved()
{
    int nX;
    int nMonth = 10; // November
    Date dtD;
    int nYear = Calendar.getInstance().get(Calendar.YEAR);
    dtD = NewDate(nYear, nMonth, 1); // November
    Calendar cal = Calendar.getInstance();
    cal.setTime(dtD);
    nX = cal.get(Calendar.DAY_OF_WEEK);
    switch(nX)
    {
        case Calendar.SUNDAY : // Sunday
        case Calendar.MONDAY : // Monday
        case Calendar.TUESDAY : // Tuesday
        case Calendar.WEDNESDAY : // Wednesday
        case Calendar.THURSDAY : // Thursday
            // This would be 26 - nX, but DAY_OF_WEEK starts at SUNDAY (1)
            return NewDate(nYear, nMonth, 27 - nX);
        case Calendar.FRIDAY : // Friday
            return NewDate(nYear, nMonth, 28);
        case Calendar.SATURDAY: // Saturday
            return NewDate(nYear, nMonth, 27);
    }
    return NewDate(nYear, nMonth, 27);
}
 
Example 9
/**
 * Converts EventRecurrence's day of week to DateUtil's day of week.
 * @param day of week as an EventRecurrence value
 * @return day of week as a DateUtil value.
 */
private static int dayToUtilDay(int day) {
    switch (day) {
        case EventRecurrence.SU: return Calendar.SUNDAY;
        case EventRecurrence.MO: return Calendar.MONDAY;
        case EventRecurrence.TU: return Calendar.TUESDAY;
        case EventRecurrence.WE: return Calendar.WEDNESDAY;
        case EventRecurrence.TH: return Calendar.THURSDAY;
        case EventRecurrence.FR: return Calendar.FRIDAY;
        case EventRecurrence.SA: return Calendar.SATURDAY;
        default: throw new IllegalArgumentException("bad day argument: " + day);
    }
}
 
Example 10
/**
 * 获得数字 i 所代表的星期,所对应的短字母.
 * @param i
 *          数字
 * @return String
 * 				如果i = 1,返回 "S"(即 "SUNDAY" 的首字母);
 * 				如果i = 2,返回 "M"(即 "MONDAY" 的首字母);
 * 				...
 * 				如果i > 7 或 i < 1,返回空串"";
 */
public static String getDayName(int i) {
	String dayname = "";
	switch (i) {
	case Calendar.MONDAY:
		dayname = "M";
		break;
	case Calendar.TUESDAY:
		dayname = "T";
		break;
	case Calendar.WEDNESDAY:
		dayname = "W";
		break;
	case Calendar.THURSDAY:
		dayname = "T";
		break;
	case Calendar.FRIDAY:
		dayname = "F";
		break;
	case Calendar.SATURDAY:
		dayname = "S";
		break;
	case Calendar.SUNDAY:
		dayname = "S";
		break;
	default:
		break;
	}
	return dayname;
}
 
Example 11
Source Project: Easy_xkcd   File: PrefHelper.java    License: Apache License 2.0 5 votes vote down vote up
public boolean checkWhatIfUpdated(int day) {
    switch (day) {
        case Calendar.TUESDAY:
            return sharedPrefs.getBoolean(TUESDAY_UPDATE_WHATIF, false);
        case Calendar.WEDNESDAY:
            return sharedPrefs.getBoolean(WEDNESDAY_UPDATE_WHATIF, false);
        case Calendar.THURSDAY:
            return sharedPrefs.getBoolean(THURSDAY_UPDATE_WHATIF, false);
    }
    return true;
}
 
Example 12
public static String getDayOfWeekPattern(Set<Map.Entry<Integer, Boolean>> weekDaysSettings) {
    StringBuilder pattern = new StringBuilder();
    for (Map.Entry<Integer, Boolean> entry : weekDaysSettings) {
        if (entry.getValue() != null && entry.getValue()) {
            switch (entry.getKey()) {
                case Calendar.MONDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.MONDAY)); //Mo
                    break;
                case Calendar.TUESDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.TUESDAY)); //Tu
                    break;
                case Calendar.WEDNESDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.WEDNESDAY)); //We
                    break;
                case Calendar.THURSDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.THURSDAY)); //Th
                    break;
                case Calendar.FRIDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.FRIDAY)); //Fr
                    break;
                case Calendar.SATURDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.SATURDAY)); //Sa
                    break;
                case Calendar.SUNDAY:
                    pattern.append(DateUtilities.getWeekdayShortname(Calendar.SUNDAY)); //Su
                    break;
                default:
                    break;
            }
        }
    }
    return pattern.toString();
}
 
Example 13
@Override
public void onBindViewHolder(WeekForecastViewHolder holder, int position) {
    Forecast f = forecastList.get(position);

    setIcon(f.getWeatherID(), holder.weather);
    holder.humidity.setText(StringFormatUtils.formatInt(f.getHumidity(), "%"));

    Calendar c = new GregorianCalendar();
    c.setTime(f.getLocalForecastTime(context));
    int day = c.get(Calendar.DAY_OF_WEEK);

    switch(day) {
        case Calendar.MONDAY:
            day = R.string.abbreviation_monday;
            break;
        case Calendar.TUESDAY:
            day = R.string.abbreviation_tuesday;
            break;
        case Calendar.WEDNESDAY:
            day = R.string.abbreviation_wednesday;
            break;
        case Calendar.THURSDAY:
            day = R.string.abbreviation_thursday;
            break;
        case Calendar.FRIDAY:
            day = R.string.abbreviation_friday;
            break;
        case Calendar.SATURDAY:
            day = R.string.abbreviation_saturday;
            break;
        case Calendar.SUNDAY:
            day = R.string.abbreviation_sunday;
            break;
        default:
            day = R.string.abbreviation_monday;
    }
    holder.day.setText(day);
    holder.temperature.setText(StringFormatUtils.formatTemperature(context, f.getTemperature()));
}
 
Example 14
public static CalendarWeekVO getCalendarWeek(Date date) {
	GregorianCalendar cal = new GregorianCalendar();
	cal.setTime(date);
	int year = cal.get(Calendar.YEAR);
	int period;
	switch ((new GregorianCalendar(year, 0, 1)).get(Calendar.DAY_OF_WEEK)) {
		case Calendar.SUNDAY:
			period = -1;
			break;
		case Calendar.MONDAY:
			period = 0;
			break;
		case Calendar.TUESDAY:
			period = 1;
			break;
		case Calendar.WEDNESDAY:
			period = 2;
			break;
		case Calendar.THURSDAY:
			period = 3;
			break;
		case Calendar.FRIDAY:
			period = -3;
			break;
		case Calendar.SATURDAY:
			period = -2;
			break;
		default:
			period = 0;
	}
	int week = (int) ((cal.get(Calendar.DAY_OF_YEAR) - 1 + period) / 7d + 1);
	if (week > getWeeksOfYear(year)) {
		return new CalendarWeekVO(cal.getTime(), 1, year + 1);
	} else if (week == 0) {
		return new CalendarWeekVO(cal.getTime(), getWeeksOfYear(year - 1), year - 1);
	} else {
		return new CalendarWeekVO(cal.getTime(), week, year);
	}
}
 
Example 15
Source Project: StatsAgg   File: Suspension.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean isSuspensionAllowed_DayOfWeek(Suspension suspension, Calendar specifiedDateAndTime) {
    
    if ((suspension == null) || (suspension.isOneTime() == null)) {
        return false;
    }
    
    // suspensions are allowed on all days if it is a 'one time' suspension 
    if (suspension.isOneTime()) return true;
    
    // isRecured days of the week can't be null if this is a 'recurring' suspension
    if (suspension.isRecurSunday() == null) return false;
    if (suspension.isRecurMonday() == null) return false;
    if (suspension.isRecurTuesday() == null) return false;
    if (suspension.isRecurWednesday() == null) return false;
    if (suspension.isRecurThursday() == null) return false;
    if (suspension.isRecurFriday() == null) return false;
    if (suspension.isRecurSaturday() == null) return false;
    
    // checks to see if the alert is allowed to run based on the current day of the week
    if (Calendar.SUNDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurSunday();
    if (Calendar.MONDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurMonday();
    if (Calendar.TUESDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurTuesday();
    if (Calendar.WEDNESDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurWednesday();
    if (Calendar.THURSDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurThursday();
    if (Calendar.FRIDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurFriday();
    if (Calendar.SATURDAY == specifiedDateAndTime.get(Calendar.DAY_OF_WEEK)) return suspension.isRecurSaturday();

    return false;
}
 
Example 16
Source Project: unitime   File: PdfLegacyExamReport.java    License: Apache License 2.0 5 votes vote down vote up
public String getShortDate(Date date) {
    Calendar c = Calendar.getInstance(Locale.US);
    c.setTime(date);
    String day = "";
    switch (c.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY : day = DAY_NAMES_SHORT[Constants.DAY_MON]; break;
        case Calendar.TUESDAY : day = DAY_NAMES_SHORT[Constants.DAY_TUE]; break;
        case Calendar.WEDNESDAY : day = DAY_NAMES_SHORT[Constants.DAY_WED]; break;
        case Calendar.THURSDAY : day = DAY_NAMES_SHORT[Constants.DAY_THU]; break;
        case Calendar.FRIDAY : day = DAY_NAMES_SHORT[Constants.DAY_FRI]; break;
        case Calendar.SATURDAY : day = DAY_NAMES_SHORT[Constants.DAY_SAT]; break;
        case Calendar.SUNDAY : day = DAY_NAMES_SHORT[Constants.DAY_SUN]; break;
    }
    return day+" "+new SimpleDateFormat("MM/dd").format(date);
}
 
Example 17
Source Project: SI   File: DateTimeUtil.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * 요일취득
 * @return String 당일날짜(8자리)
 */
public static String getWeekDay(String date, String lang, int cnt){
	if(date==null || date.equals("")){
		return "";

	}else if(date.length()>7){
 	if(date.length()>=10){
 		date = date.substring(0,10);
 		date.replace(".", "");
 	}
		int iYear	= Integer.parseInt(date.substring(0,4));
     int iMonth	= Integer.parseInt(date.substring(4,6))-1;
     int iDays	= Integer.parseInt(date.substring(6,8));
 	Calendar cal = new GregorianCalendar(iYear,iMonth,iDays);
 	int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
 	String dayOfWeekStr = "";
 	if(dayOfWeek==Calendar.SUNDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(일)";
 		}else{
 			dayOfWeekStr = "(Sun)";
 		}
 	}else if(dayOfWeek==Calendar.MONDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(월)";
 		}else{
 			dayOfWeekStr = "(Mon)";
 		}
 	}else if(dayOfWeek==Calendar.TUESDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(화)";
 		}else{
 			dayOfWeekStr = "(Tue)";
 		}
 	}else if(dayOfWeek==Calendar.WEDNESDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(수)";
 		}else{
 			dayOfWeekStr = "(Wed)";
 		}
 	}else if(dayOfWeek==Calendar.THURSDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(목)";
 		}else{
 			dayOfWeekStr = "(Thu)";
 		}
 	}else if(dayOfWeek==Calendar.FRIDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(금)";
 		}else{
 			dayOfWeekStr = "(Fri)";
 		}
 	}else if(dayOfWeek==Calendar.SATURDAY){
 		if(lang.equals("KOR") && cnt==1){
 			dayOfWeekStr = "(토)";
 		}else{
 			dayOfWeekStr = "(Sat)";
 		}
 	}
     return dayOfWeekStr;
	}else{
		return "";
	}
}
 
Example 18
Source Project: ToolsFinal   File: DateUtils.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * 获取某天是星期几
 * @param date
 * @return
 */
public static String getMonthDayWeek(Date date) {
    Calendar c = Calendar.getInstance();
    c.setTime(date);
    int year = c.get(Calendar.YEAR);    //获取年
    int month = c.get(Calendar.MONTH) + 1;   //获取月份,0表示1月份
    int day = c.get(Calendar.DAY_OF_MONTH);    //获取当前天数
    int week = c.get(Calendar.DAY_OF_WEEK);

    String weekStr = null;

    switch (week) {

        case Calendar.SUNDAY:
            weekStr = "周日";
            break;

        case Calendar.MONDAY:
            weekStr = "周一";
            break;

        case Calendar.TUESDAY:
            weekStr = "周二";
            break;

        case Calendar.WEDNESDAY:
            weekStr = "周三";
            break;

        case Calendar.THURSDAY:
            weekStr = "周四";
            break;

        case Calendar.FRIDAY:
            weekStr = "周五";
            break;

        case Calendar.SATURDAY:
            weekStr = "周六";
            break;
    }

    return month + "月" + day + "日"  + "(" + weekStr + ")";
}
 
Example 19
Source Project: android-utils   File: DateUtils.java    License: MIT License 4 votes vote down vote up
/**
 * Returns abbreviated (3 letters) day of the week.
 *
 * @param date ISO format date
 * @return The name of the day of the week
 */
public static String getDayOfWeekAbbreviated(String date) {
    Date dateDT = parseDate(date);

    if (dateDT == null) {
        return null;
    }

    // Get current date
    Calendar c = Calendar.getInstance();
    // it is very important to
    // set the date of
    // the calendar.
    c.setTime(dateDT);
    int day = c.get(Calendar.DAY_OF_WEEK);

    String dayStr = null;

    switch (day) {

        case Calendar.SUNDAY:
            dayStr = "Sun";
            break;

        case Calendar.MONDAY:
            dayStr = "Mon";
            break;

        case Calendar.TUESDAY:
            dayStr = "Tue";
            break;

        case Calendar.WEDNESDAY:
            dayStr = "Wed";
            break;

        case Calendar.THURSDAY:
            dayStr = "Thu";
            break;

        case Calendar.FRIDAY:
            dayStr = "Fri";
            break;

        case Calendar.SATURDAY:
            dayStr = "Sat";
            break;
    }

    return dayStr;
}
 
Example 20
public AverageHoursAWeekClassWeights(DataProperties config) {
	org.hibernate.Session hibSession = SessionDAO.getInstance().createNewSession();
	try {
		Session session = SessionDAO.getInstance().get(config.getPropertyLong("General.SessionId", -1l));
		iDaysOfWeek = new BitSet[Constants.DAY_CODES.length];
		for (int i = 0; i < iDaysOfWeek.length; i++)
			iDaysOfWeek[i] = new BitSet();
		Calendar cal = Calendar.getInstance(Locale.US); cal.setLenient(true);
		cal.setTime(DateUtils.getDate(1, session.getPatternStartMonth(), session.getSessionStartYear()));
		Date last = DateUtils.getDate(1, session.getPatternEndMonth(), session.getSessionStartYear());
		int idx = 0;
		while (cal.getTime().before(last)) {
       		int dow = cal.get(Calendar.DAY_OF_WEEK);
       		switch (dow) {
       		case Calendar.MONDAY:
       			iDaysOfWeek[Constants.DAY_MON].set(idx);
       			break;
       		case Calendar.TUESDAY:
       			iDaysOfWeek[Constants.DAY_TUE].set(idx);
       			break;
       		case Calendar.WEDNESDAY:
       			iDaysOfWeek[Constants.DAY_WED].set(idx);
       			break;
       		case Calendar.THURSDAY:
       			iDaysOfWeek[Constants.DAY_THU].set(idx);
       			break;
       		case Calendar.FRIDAY:
       			iDaysOfWeek[Constants.DAY_FRI].set(idx);
       			break;
       		case Calendar.SATURDAY:
       			iDaysOfWeek[Constants.DAY_SAT].set(idx);
       			break;
       		case Calendar.SUNDAY:
       			iDaysOfWeek[Constants.DAY_SUN].set(idx);
       			break;
       		}
       		cal.add(Calendar.DAY_OF_YEAR, 1); idx++;
		}
		if (session.getDefaultDatePattern() != null) {
			BitSet ddp = session.getDefaultDatePattern().getPatternBitSet();
			iCoeficient = 5.0 / (
					intersection(ddp, iDaysOfWeek[Constants.DAY_MON]) +
					intersection(ddp, iDaysOfWeek[Constants.DAY_TUE]) +
					intersection(ddp, iDaysOfWeek[Constants.DAY_WED]) +
					intersection(ddp, iDaysOfWeek[Constants.DAY_THU]) +
					intersection(ddp, iDaysOfWeek[Constants.DAY_FRI]));
					
		}
	} finally {
		hibSession.close();
	}
}