Java Code Examples for com.ibm.icu.util.Calendar#SATURDAY
The following examples show how to use
com.ibm.icu.util.Calendar#SATURDAY .
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: ICalRecurConverter.java From scipio-erp with Apache License 2.0 | 6 votes |
@Override public void visit(TemporalExpressions.DayOfWeekRange expr) { int startDay = expr.getStartDay(); int endDay = expr.getEndDay(); WeekDayList dayList = new WeekDayList(); dayList.add(dayOfWeekArray[startDay - 1]); while (startDay != endDay) { startDay++; if (startDay > Calendar.SATURDAY) { startDay = Calendar.SUNDAY; } dayList.add(dayOfWeekArray[startDay - 1]); } Recur recur = new Recur(Recur.DAILY, 0); recur.getDayList().addAll(dayList); this.state.addRecur(recur); }
Example 2
Source File: TemporalExpressions.java From scipio-erp with Apache License 2.0 | 6 votes |
/** * @param dayOfWeek An integer in the range of <code>Calendar.SUNDAY</code> * to <code>Calendar.SATURDAY</code> * @param occurrence An integer in the range of -5 to 5, excluding zero */ public DayInMonth(int dayOfWeek, int occurrence) { if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) { throw new IllegalArgumentException("Invalid day argument"); } if (occurrence < -5 || occurrence == 0 || occurrence > 5) { throw new IllegalArgumentException("Invalid occurrence argument"); } this.dayOfWeek = dayOfWeek; this.occurrence = occurrence; int result = occurrence; if (result < 0) { // Make negative values a higher sequence // Example: Last Monday should come after first Monday result += 11; } this.sequence = SEQUENCE_DAY_IN_MONTH + (result * 10) + dayOfWeek; if (Debug.verboseOn()) { Debug.logVerbose("Created " + this, module); } }
Example 3
Source File: AutomaticUpdateScheduler.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
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 4
Source File: OlsonTimeZone.java From fitnotifications with Apache License 2.0 | 5 votes |
/** * TimeZone API. */ public int getOffset(int era, int year, int month,int dom, int dow, int millis, int monthLength){ if ((era != GregorianCalendar.AD && era != GregorianCalendar.BC) || month < Calendar.JANUARY || month > Calendar.DECEMBER || dom < 1 || dom > monthLength || dow < Calendar.SUNDAY || dow > Calendar.SATURDAY || millis < 0 || millis >= Grego.MILLIS_PER_DAY || monthLength < 28 || monthLength > 31) { throw new IllegalArgumentException(); } if (era == GregorianCalendar.BC) { year = -year; } if (finalZone != null && year >= finalStartYear) { return finalZone.getOffset(era, year, month, dom, dow, millis); } // Compute local epoch millis from input fields long time = Grego.fieldsToDay(year, month, dom) * Grego.MILLIS_PER_DAY + millis; int[] offsets = new int[2]; getHistoricalOffset(time, true, LOCAL_DST, LOCAL_STD, offsets); return offsets[0] + offsets[1]; }
Example 5
Source File: TemporalExpressions.java From scipio-erp with Apache License 2.0 | 5 votes |
/** * @param start An integer in the range of <code>Calendar.SUNDAY</code> * to <code>Calendar.SATURDAY</code> * @param end An integer in the range of <code>Calendar.SUNDAY</code> * to <code>Calendar.SATURDAY</code> */ public DayOfWeekRange(int start, int end) { if (start < Calendar.SUNDAY || start > Calendar.SATURDAY) { throw new IllegalArgumentException("Invalid start argument"); } if (end < Calendar.SUNDAY || end > Calendar.SATURDAY) { throw new IllegalArgumentException("Invalid end argument"); } this.sequence = SEQUENCE_DOW_RANGE + start; this.start = start; this.end = end; if (Debug.verboseOn()) { Debug.logVerbose("Created " + this, module); } }
Example 6
Source File: RecurrenceRule.java From scipio-erp with Apache License 2.0 | 5 votes |
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 7
Source File: TechDataServices.java From scipio-erp with Apache License 2.0 | 4 votes |
/** 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 8
Source File: TechDataServices.java From scipio-erp with Apache License 2.0 | 4 votes |
/** 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; }