Java Code Examples for com.ibm.icu.util.Calendar#WEDNESDAY

The following examples show how to use com.ibm.icu.util.Calendar#WEDNESDAY . 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 check out the related API usage on the sidebar.
Example 1
Source File: AutomaticUpdateScheduler.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private int getDay(IPreferenceStore pref) {
	String day = pref.getString(P_DAY);
	for (int d = 0; d < DAYS.length; d++)
		if (DAYS[d].equals(day))
			switch (d) {
				case 0 :
					return -1;
				case 1 :
					return Calendar.MONDAY;
				case 2 :
					return Calendar.TUESDAY;
				case 3 :
					return Calendar.WEDNESDAY;
				case 4 :
					return Calendar.THURSDAY;
				case 5 :
					return Calendar.FRIDAY;
				case 6 :
					return Calendar.SATURDAY;
				case 7 :
					return Calendar.SUNDAY;
			}
	return -1;
}
 
Example 2
Source File: RecurrenceRule.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
private int getCalendarDay(String day) {
    if (day != null) {
        day = day.trim();
        if ("MO".equalsIgnoreCase(day)) {
            return Calendar.MONDAY;
        }
        if ("TU".equalsIgnoreCase(day)) {
            return Calendar.TUESDAY;
        }
        if ("WE".equalsIgnoreCase(day)) {
            return Calendar.WEDNESDAY;
        }
        if ("TH".equalsIgnoreCase(day)) {
            return Calendar.THURSDAY;
        }
        if ("FR".equalsIgnoreCase(day)) {
            return Calendar.FRIDAY;
        }
        if ("SA".equalsIgnoreCase(day)) {
            return Calendar.SATURDAY;
        }
        if ("SU".equalsIgnoreCase(day)) {
            return Calendar.SUNDAY;
        }
    }
    return 0;
}
 
Example 3
Source File: TechDataServices.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
/** Used to find the fisrt day in the TechDataCalendarWeek where capacity != 0, beginning at dayStart, dayStart included.
 *
 * @param techDataCalendarWeek        The TechDataCalendarWeek cover
 * @param dayStart
 * @return a map with the  capacity (Double) available and moveDay (int): the number of day it's necessary to move to have capacity available
 */
public static Map<String, Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek,  int  dayStart) {
    Map<String, Object> result = new HashMap<String, Object>();
    int moveDay = 0;
    Double capacity = null;
    Time startTime = null;
    while (capacity == null || capacity ==0) {
        switch (dayStart) {
            case Calendar.MONDAY:
                capacity =  techDataCalendarWeek.getDouble("mondayCapacity");
                startTime =  techDataCalendarWeek.getTime("mondayStartTime");
                break;
            case Calendar.TUESDAY:
                capacity =  techDataCalendarWeek.getDouble("tuesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("tuesdayStartTime");
                break;
            case Calendar.WEDNESDAY:
                capacity =  techDataCalendarWeek.getDouble("wednesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("wednesdayStartTime");
                break;
            case Calendar.THURSDAY:
                capacity =  techDataCalendarWeek.getDouble("thursdayCapacity");
                startTime =  techDataCalendarWeek.getTime("thursdayStartTime");
                break;
            case Calendar.FRIDAY:
                capacity =  techDataCalendarWeek.getDouble("fridayCapacity");
                startTime =  techDataCalendarWeek.getTime("fridayStartTime");
                break;
            case Calendar.SATURDAY:
                capacity =  techDataCalendarWeek.getDouble("saturdayCapacity");
                startTime =  techDataCalendarWeek.getTime("saturdayStartTime");
                break;
            case Calendar.SUNDAY:
                capacity =  techDataCalendarWeek.getDouble("sundayCapacity");
                startTime =  techDataCalendarWeek.getTime("sundayStartTime");
                break;
        }
        if (capacity == null || capacity == 0) {
            moveDay +=1;
            dayStart = (dayStart==7) ? 1 : dayStart +1;
        }
    }
    result.put("capacity",capacity);
    result.put("startTime",startTime);
    result.put("moveDay", moveDay);
    return result;
}
 
Example 4
Source File: TechDataServices.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
/** Used to find the last day in the TechDataCalendarWeek where capacity != 0, ending at dayEnd, dayEnd included.
 *
 * @param techDataCalendarWeek        The TechDataCalendarWeek cover
 * @param dayEnd
 * @return a map with the  capacity (Double) available, the startTime and  moveDay (int): the number of day it's necessary to move to have capacity available
 */
public static Map<String, Object> dayEndCapacityAvailable(GenericValue techDataCalendarWeek, int dayEnd) {
    Map<String, Object> result = new HashMap<String, Object>();
    int moveDay = 0;
    Double capacity = null;
    Time startTime = null;
    while (capacity == null || capacity == 0) {
        switch (dayEnd) {
            case Calendar.MONDAY:
                capacity =  techDataCalendarWeek.getDouble("mondayCapacity");
                startTime =  techDataCalendarWeek.getTime("mondayStartTime");
                break;
            case Calendar.TUESDAY:
                capacity =  techDataCalendarWeek.getDouble("tuesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("tuesdayStartTime");
                break;
            case Calendar.WEDNESDAY:
                capacity =  techDataCalendarWeek.getDouble("wednesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("wednesdayStartTime");
                break;
            case Calendar.THURSDAY:
                capacity =  techDataCalendarWeek.getDouble("thursdayCapacity");
                startTime =  techDataCalendarWeek.getTime("thursdayStartTime");
                break;
            case Calendar.FRIDAY:
                capacity =  techDataCalendarWeek.getDouble("fridayCapacity");
                startTime =  techDataCalendarWeek.getTime("fridayStartTime");
                break;
            case Calendar.SATURDAY:
                capacity =  techDataCalendarWeek.getDouble("saturdayCapacity");
                startTime =  techDataCalendarWeek.getTime("saturdayStartTime");
                break;
            case Calendar.SUNDAY:
                capacity =  techDataCalendarWeek.getDouble("sundayCapacity");
                startTime =  techDataCalendarWeek.getTime("sundayStartTime");
                break;
        }
        if (capacity == null || capacity == 0) {
            moveDay -=1;
            dayEnd = (dayEnd==1) ? 7 : dayEnd - 1;
        }
    }
    result.put("capacity",capacity);
    result.put("startTime",startTime);
    result.put("moveDay", moveDay);
    return result;
}