Example usage for java.util Calendar WEDNESDAY

List of usage examples for java.util Calendar WEDNESDAY

Introduction

In this page you can find the example usage for java.util Calendar WEDNESDAY.

Prototype

int WEDNESDAY

To view the source code for java.util Calendar WEDNESDAY.

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Wednesday.

Usage

From source file:org.activequant.util.charting.IntradayMarketTimeline.java

/**
 * Translates a value relative to this timeline into a domain value. The
 * domain value obtained by this method is not always the same domain value
 * that could have been supplied to// w  w  w .j  a v  a2 s.co m
 * translateDomainValueToTimelineValue(domainValue).
 * This is because the original tranformation may not be complete
 * reversable.
 *
 * @see org.jfree.chart.axis.SegmentedTimeline
 *
 * @param timelineValue  a timeline value.
 *
 * @return A domain value.
 */
public long toMillisecond(long timelineValue) {

    if (this.activeTimePerWeek == 0L)
        return 0;

    //starting from Jan 1, 1970 work backwards.
    //find out the number of whole weeks in the timelineValue
    Long l = new Long(timelineValue / this.activeTimePerWeek);
    int numWeeks = (int) Math.floor(l.doubleValue());

    //the amount of time left on the timeline from the last thursday
    long timeLeftSinceThursday = timelineValue - (numWeeks * this.activeTimePerWeek);

    int day = Calendar.THURSDAY;
    int numDays = 0;

    //from last friday until the current day
    //if the amount of time left is greater than
    //the active time for that day, increment the number of
    //days and subtract from the time left
    while (numDays < 7) {
        if (day == Calendar.SUNDAY) {
            if (timeLeftSinceThursday > this.sundayActive) {
                timeLeftSinceThursday -= this.sundayActive;
                numDays++;
            } else {
                break;
            }
        } else if (day == Calendar.MONDAY) {
            if (timeLeftSinceThursday > this.mondayActive) {
                timeLeftSinceThursday -= this.mondayActive;
                numDays++;
            } else {
                break;
            }
        } else if (day == Calendar.TUESDAY) {
            if (timeLeftSinceThursday > this.tuesdayActive) {
                timeLeftSinceThursday -= this.tuesdayActive;
                numDays++;
            } else {
                break;
            }
        } else if (day == Calendar.WEDNESDAY) {
            if (timeLeftSinceThursday > this.wednesdayActive) {
                timeLeftSinceThursday -= this.wednesdayActive;
                numDays++;
            } else {
                break;
            }
        } else if (day == Calendar.THURSDAY) {

            if (timeLeftSinceThursday > this.thursdayActive) {
                timeLeftSinceThursday -= this.thursdayActive;
                numDays++;

                //thursday numDays =  " + Integer.toString(numDays));
            } else {

                break;
            }
        } else if (day == Calendar.FRIDAY) {
            if (timeLeftSinceThursday > this.fridayActive) {
                timeLeftSinceThursday -= this.fridayActive;
                numDays++;
            } else {
                break;
            }
        } else if (day == Calendar.SATURDAY) {
            if (timeLeftSinceThursday > this.saturdayActive) {
                timeLeftSinceThursday -= this.saturdayActive;
                numDays++;
            } else {
                break;
            }
        }

        day = this.nextDay(day);
    }

    long millis = numWeeks * MILLIS_PER_WEEK + numDays * MILLIS_PER_DAY + this.getStartTime(day)
            + timeLeftSinceThursday;

    return millis;
}

From source file:com.autentia.intra.bean.activity.ObjectiveBean.java

/**
 * Move a date to one of its surrounding fridays.
 *
 * @param d        the reference date//from  w ww.  ja  v  a2 s .  c  o  m
 * @param inFuture whether to move to future/previous friday
 * @return the requested friday
 */
private Date moveToFriday(Date d, boolean inFuture) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(d);
    switch (cal.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 4 : -3);
        break;
    case Calendar.TUESDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 3 : -4);
        break;
    case Calendar.WEDNESDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 2 : -5);
        break;
    case Calendar.THURSDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 1 : -6);
        break;
    case Calendar.FRIDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 0 : -7);
        break;
    case Calendar.SATURDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 6 : -1);
        break;
    case Calendar.SUNDAY:
        cal.add(Calendar.DAY_OF_WEEK, inFuture ? 5 : -2);
        break;
    }
    return cal.getTime();
}

From source file:de.tap.easy_xkcd.utils.PrefHelper.java

public boolean checkUpdated(int day) {
    switch (day) {
    case Calendar.MONDAY:
        return sharedPrefs.getBoolean(MONDAY_UPDATE, false);
    case Calendar.WEDNESDAY:
        return sharedPrefs.getBoolean(WEDNESDAY_UPDATE, false);
    case Calendar.FRIDAY:
        return sharedPrefs.getBoolean(FRIDAY_UPDATE, false);

    case Calendar.TUESDAY:
        return sharedPrefs.getBoolean(TUESDAY_UPDATE, false);
    }/*from  ww w. j a v  a 2s .c o m*/
    return true;
}

From source file:de.tap.easy_xkcd.utils.PrefHelper.java

public void setUpdated(int day, boolean found) {
    SharedPreferences.Editor editor = sharedPrefs.edit();
    switch (day) {
    case Calendar.MONDAY:
        editor.putBoolean(MONDAY_UPDATE, found);
        editor.putBoolean(WEDNESDAY_UPDATE, false);
        editor.putBoolean(FRIDAY_UPDATE, false);
        break;/*from   w  w w  . j  ava2s  .co m*/
    case Calendar.WEDNESDAY:
        editor.putBoolean(WEDNESDAY_UPDATE, found);
        editor.putBoolean(FRIDAY_UPDATE, false);
        editor.putBoolean(MONDAY_UPDATE, false);
        editor.putBoolean(TUESDAY_UPDATE, false);
        break;
    case Calendar.FRIDAY:
        editor.putBoolean(FRIDAY_UPDATE, found);
        editor.putBoolean(MONDAY_UPDATE, false);
        editor.putBoolean(WEDNESDAY_UPDATE, false);
        editor.putBoolean(TUESDAY_UPDATE, false);
        break;
    case Calendar.TUESDAY:
        editor.putBoolean(TUESDAY_UPDATE, found);
    }
    editor.apply();
    Log.d("Update Status:",
            String.valueOf(sharedPrefs.getBoolean(MONDAY_UPDATE, false))
                    + String.valueOf(sharedPrefs.getBoolean(TUESDAY_UPDATE, false))
                    + String.valueOf(sharedPrefs.getBoolean(WEDNESDAY_UPDATE, false))
                    + String.valueOf(sharedPrefs.getBoolean(FRIDAY_UPDATE, false)));
}

From source file:org.kuali.coeus.common.committee.impl.bo.CommitteeScheduleBase.java

/**
 * This UI support method to find day Of week from BO's persistent field scheduledDate.
 * @return//from  w w w.ja v a 2  s  .  c  om
 */
public String getDayOfWeek() {
    Calendar cl = new GregorianCalendar();
    cl.setTime(scheduledDate);
    DayOfWeek dayOfWeek = null;
    switch (cl.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.SUNDAY:
        dayOfWeek = DayOfWeek.Sunday;
        break;
    case Calendar.MONDAY:
        dayOfWeek = DayOfWeek.Monday;
        break;
    case Calendar.TUESDAY:
        dayOfWeek = DayOfWeek.Tuesday;
        break;
    case Calendar.WEDNESDAY:
        dayOfWeek = DayOfWeek.Wednesday;
        break;
    case Calendar.THURSDAY:
        dayOfWeek = DayOfWeek.Thursday;
        break;
    case Calendar.FRIDAY:
        dayOfWeek = DayOfWeek.Friday;
        break;
    case Calendar.SATURDAY:
        dayOfWeek = DayOfWeek.Saturday;
        break;
    }
    return dayOfWeek.name().toUpperCase();
}

From source file:com.provision.alarmemi.paper.fragments.SetAlarmFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
    mActivity.setOnLifeCycleChangeListener(this);

    isChanged = isCloud = false;/*  www . j a  v a 2 s . c o m*/
    // Override the default content view.
    root = (ViewGroup) super.onCreateView(inflater, container, bundle);
    final ImageView moreAlarm = (ImageView) root.findViewById(R.id.more_alarm);
    FragmentChangeActivity.moreAlarm = moreAlarm;
    moreAlarm.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            if (menu.isMenuShowing()) {
                menu.showContent();
            } else {
                menu.showMenu(true);
            }
        }
    });
    // Make the entire view selected when focused.
    moreAlarm.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        public void onFocusChange(View v, boolean hasFocus) {
            v.setSelected(hasFocus);
        }
    });

    addPreferencesFromResource(R.xml.alarm_prefs);
    myUUID = SplashActivity.myUUID;

    // Get each preference so we can retrieve the value later.
    mLabel = findPreference("label");
    mLabel.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            showEditTextPreference(mLabel.getKey(), mLabel.getTitle(), mLabelText);
            return true;
        }
    });

    Preference.OnPreferenceChangeListener preferceChangedListener = new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference p, Object newValue) {
            isChanged = true;
            return true;
        }
    };

    mEnabledPref = (CheckBoxPreference) findPreference("enabled");
    mEnabledPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if (!isCloud) {
                isChanged = true;
                if ((Boolean) newValue)
                    showCategory();
                else
                    hideCategory();
                return true;
            }
            if ((Boolean) newValue) {
                try {
                    tempjson = new JSONArray("[]");
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                selectedDevice = "";
                for (int i = 0; i < json.length(); i++) {
                    if (UIDitems[i].toString().equals(myUUID))
                        checkedItems[i] = true;
                    if (checkedItems[i]) {
                        Map<String, String> map = new HashMap<String, String>();
                        map.put("name", URLDecoder.decode(items[i].toString()));
                        map.put("uid", UIDitems[i].toString());
                        tempjson.put(map);
                        selectedDevice += items[i] + ", ";
                    }
                }
                if (!selectedDevice.equals(""))
                    selectedDevice = selectedDevice.substring(0, selectedDevice.length() - 2);
            } else {
                try {
                    tempjson = new JSONArray("[]");
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                selectedDevice = "";
                for (int i = 0; i < json.length(); i++) {
                    if (UIDitems[i].toString().equals(myUUID))
                        checkedItems[i] = false;
                    if (checkedItems[i]) {
                        Map<String, String> map = new HashMap<String, String>();
                        map.put("name", URLDecoder.decode(items[i].toString()));
                        map.put("uid", UIDitems[i].toString());
                        tempjson.put(map);
                        selectedDevice += items[i] + ", ";
                    }
                }
                if (!selectedDevice.equals(""))
                    selectedDevice = selectedDevice.substring(0, selectedDevice.length() - 2);
            }
            mForest.setSummary(selectedDevice);
            isChanged = true;
            return true;
        }
    });
    mTimePref = findPreference("time");
    mVibratePref = (CheckBoxPreference) findPreference("vibrate");
    mVibratePref.setOnPreferenceChangeListener(preferceChangedListener);
    mRepeatPref = findPreference("setRepeat");
    mRepeatPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] values = new String[] {
                    DateUtils.getDayOfWeekString(Calendar.MONDAY, DateUtils.LENGTH_LONG),
                    DateUtils.getDayOfWeekString(Calendar.TUESDAY, DateUtils.LENGTH_LONG),
                    DateUtils.getDayOfWeekString(Calendar.WEDNESDAY, DateUtils.LENGTH_LONG),
                    DateUtils.getDayOfWeekString(Calendar.THURSDAY, DateUtils.LENGTH_LONG),
                    DateUtils.getDayOfWeekString(Calendar.FRIDAY, DateUtils.LENGTH_LONG),
                    DateUtils.getDayOfWeekString(Calendar.SATURDAY, DateUtils.LENGTH_LONG),
                    DateUtils.getDayOfWeekString(Calendar.SUNDAY, DateUtils.LENGTH_LONG) };
            Intent intent = new Intent(mActivity, RepeatListPreference.class);
            intent.putExtra("key", mRepeatPref.getKey());
            intent.putExtra("title", mRepeatPref.getTitle());
            intent.putExtra("lists", values);
            intent.putExtra("multi", true);
            startActivity(intent);
            return true;
        }
    });
    mForestName = findPreference("forest_name");
    mForest = findPreference("forest");
    mColorPref = (AmbilWarnaPreference) findPreference("color");
    prefs = mActivity.getSharedPreferences("forest", mActivity.MODE_PRIVATE);

    Intent i = mActivity.setAlarmGetIntent;
    mId = i.getIntExtra(Alarms.ALARM_ID, -1);

    alarm = null;
    if (mId == -1) {
        // No alarm id means create a new alarm.
        alarm = new Alarm();
        isChanged = true;
    } else {
        // * load alarm details from database
        alarm = Alarms.getAlarm(mActivity.getContentResolver(), mId);
        // Bad alarm, bail to avoid a NPE.
        if (alarm == null) {
            finish();
            return root;
        }
        isCloud = wasCloud = alarm.cloudEnabled;
    }
    mOriginalAlarm = alarm;

    if (wasCloud) {
        try {
            Log.e("url", " : " + alarm.cloudName);
            json = new JSONArray(prefs.getString(alarm.cloudName + "_registeredDevice", ""));
            String cloud_uid = alarm.cloudUID;
            if (cloud_uid.equals(""))
                cloud_uid = "[]";
            Log.e("url", cloud_uid);
            tempjson = new JSONArray(cloud_uid);
            items = new String[json.length()];
            UIDitems = new CharSequence[json.length()];
            checkedItems = new boolean[json.length()];
            for (int j = 0; j < json.length(); j++) {
                JSONObject jsonObj = json.getJSONObject(j);
                items[j] = jsonObj.getString("name");
                UIDitems[j] = jsonObj.getString("uid");
                checkedItems[j] = alarm.cloudUID.contains(jsonObj.getString("uid"));
            }
        } catch (Exception e) {
            Log.e("url", e.toString());
        }
        selectedDevice = alarm.cloudDevices;
        mForestName.setEnabled(false);
    } else {
        if (prefs.getString("name", "").length() > 0) {
            names = prefs.getString("name", "").substring(1).split("\\|");
            nameCheckedIndex = -1;
        } else
            mForestName.setEnabled(false);
        mForest.setEnabled(false);
    }
    memi_count = alarm.memiCount;
    snooze_strength = alarm.snoozeStrength;
    snooze_count = alarm.snoozeCount;

    updatePrefs(mOriginalAlarm);

    mTimePref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference arg0) {
            showTimePicker();
            return false;
        }

    });

    mForestName.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            showListPreference(mForestName.getKey(), mForestName.getTitle(), names,
                    String.valueOf(nameCheckedIndex), false);
            return true;
        }
    });

    mForest.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference arg0) {
            showListPreference(mForest.getKey(), mForest.getTitle(), items, booleanArrayToString(checkedItems),
                    true);
            return true;
        }
    });
    mColorPref.setOnPreferenceChangeListener(preferceChangedListener);

    // We have to do this to get the save/cancel buttons to highlight on
    // their own.
    ((ListView) root.findViewById(android.R.id.list)).setItemsCanFocus(true);

    // Attach actions to each button.
    View.OnClickListener back_click = new View.OnClickListener() {
        public void onClick(View v) {
            DontSaveDialog(false, null, false);
        }
    };
    ImageView b = (ImageView) root.findViewById(R.id.back);
    b.setOnClickListener(back_click);

    b = (ImageView) root.findViewById(R.id.logo);
    b.setOnClickListener(back_click);

    b = (ImageView) root.findViewById(R.id.alarm_save);
    b.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            saveAlarm();
        }
    });
    b = (ImageView) root.findViewById(R.id.alarm_delete);
    if (mId == -1) {
        b.setEnabled(false);
    } else {
        b.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                deleteAlarm();
            }
        });
    }

    // The last thing we do is pop the time picker if this is a new alarm.
    if (mId == -1) {
        // Assume the user hit cancel
        mTimePickerCancelled = true;
        showTimePicker();
    }

    if (!isCloud && !alarm.enabled)
        hideCategory();

    FragmentChangeActivity.OnNotifyArrived.sendEmptyMessage(0);
    return root;
}

From source file:com.projity.pm.calendar.WorkingCalendar.java

static WorkingCalendar getNightShiftInstance() {
    if (nightShiftInstance != null)
        return nightShiftInstance;
    nightShiftInstance = WorkingCalendar.getStandardBasedInstance();
    WorkDay nonWorking = null;/*from w  w  w  .ja va2s  .  c o m*/
    WorkDay working = null;
    nonWorking = new WorkDay();
    working = new WorkDay();
    nonWorking.getWorkingHours().setNonWorking();

    nightShiftInstance.setWeekDay(Calendar.SUNDAY - 1, null); // will revert to overall default for sunday which is not working

    WorkDay monday = new WorkDay();
    try {
        monday.getWorkingHours().setInterval(0, hourTime(23), hourTime(0));
    } catch (WorkRangeException e) {
        e.printStackTrace();
    }
    nightShiftInstance.setWeekDay(Calendar.MONDAY - 1, monday);

    try {
        working.getWorkingHours().setInterval(0, hourTime(0), hourTime(3));
        working.getWorkingHours().setInterval(1, hourTime(4), hourTime(8));
        working.getWorkingHours().setInterval(2, hourTime(23), hourTime(0));
    } catch (WorkRangeException e) {
        e.printStackTrace();
    }
    nightShiftInstance.setWeekDay(Calendar.TUESDAY - 1, working);
    nightShiftInstance.setWeekDay(Calendar.WEDNESDAY - 1, working);
    nightShiftInstance.setWeekDay(Calendar.THURSDAY - 1, working);
    nightShiftInstance.setWeekDay(Calendar.FRIDAY - 1, working);

    WorkDay saturday = new WorkDay();
    try {
        saturday.getWorkingHours().setInterval(0, hourTime(0), hourTime(3));
        saturday.getWorkingHours().setInterval(1, hourTime(4), hourTime(8));
    } catch (WorkRangeException e) {
        e.printStackTrace();
    }
    nightShiftInstance.setWeekDay(Calendar.SATURDAY - 1, saturday);

    nightShiftInstance.setName(Messages.getString("Calendar.NightShift"));
    nightShiftInstance.setFixedId(3);

    CalendarService.getInstance().add(nightShiftInstance); // put night shift calendar in list
    return nightShiftInstance;
}

From source file:org.kuali.student.r2.core.scheduling.service.impl.TestSchedulingServiceImpl.java

@Test
public void testgetTimeSlot() throws Exception {
    // test get by id
    for (int i = 1; i <= 16; i++) {
        int tsId = 100 + i;
        TimeSlot ts = schedulingService.getTimeSlot("ts" + tsId, contextInfo);
        assertNotNull(ts);/*from   w w w .j a  v  a  2s.c  o m*/
        assertEquals("ts" + tsId, ts.getId());
    }

    // test specific records - 2
    TimeSlot ts = schedulingService.getTimeSlot("ts102", contextInfo);
    List<Integer> dow = ts.getWeekdays();
    // should contain Monday, Wednesday, Friday
    assertTrue(dow.contains(Calendar.MONDAY));
    assertTrue(dow.contains(Calendar.WEDNESDAY));
    assertTrue(dow.contains(Calendar.FRIDAY));
    // should not contain Tuesday or Thursday
    assertFalse(dow.contains(Calendar.TUESDAY));
    assertFalse(dow.contains(Calendar.THURSDAY));

    assertEquals(ts.getStartTime(), TOD_8_AM);
    assertEquals(ts.getEndTime(), TOD_9_10_AM);

    // test specific records - 3
    ts = schedulingService.getTimeSlot("ts103", contextInfo);
    dow = ts.getWeekdays();
    // should not contain Monday, Wednesday, Friday
    assertFalse(dow.contains(Calendar.MONDAY));
    assertFalse(dow.contains(Calendar.WEDNESDAY));
    assertFalse(dow.contains(Calendar.FRIDAY));
    // should contain Tuesday or Thursday
    assertTrue(dow.contains(Calendar.TUESDAY));
    assertTrue(dow.contains(Calendar.THURSDAY));
    assertEquals(ts.getStartTime(), TOD_8_AM);
    assertEquals(ts.getEndTime(), TOD_8_50_AM);

    // test specific records - 10
    ts = schedulingService.getTimeSlot("ts110", contextInfo);
    dow = ts.getWeekdays();
    // should contain Monday, Wednesday, Friday
    assertTrue(dow.contains(Calendar.MONDAY));
    assertTrue(dow.contains(Calendar.WEDNESDAY));
    assertTrue(dow.contains(Calendar.FRIDAY));
    // should not contain Tuesday or Thursday
    assertFalse(dow.contains(Calendar.TUESDAY));
    assertFalse(dow.contains(Calendar.THURSDAY));
    assertEquals(ts.getStartTime(), TOD_1_PM);
    assertEquals(ts.getEndTime(), TOD_2_10_PM);
}

From source file:org.activequant.util.charting.IntradayMarketTimeline.java

private long getActiveTimePerDay(int day) {
    long closedTime = 0;

    if (day == Calendar.SUNDAY) {
        closedTime = this.sundayActive;
    } else if (day == Calendar.MONDAY) {
        closedTime = this.mondayActive;
    } else if (day == Calendar.TUESDAY) {
        closedTime = this.tuesdayActive;
    } else if (day == Calendar.WEDNESDAY) {
        closedTime = this.wednesdayActive;
    } else if (day == Calendar.THURSDAY) {
        closedTime = this.thursdayActive;
    } else if (day == Calendar.FRIDAY) {
        closedTime = this.fridayActive;
    } else if (day == Calendar.SATURDAY) {
        closedTime = this.saturdayActive;
    }// w ww. j av  a 2s . c om

    return closedTime;
}

From source file:com.silverpeas.scheduler.simple.SchedulerJob.java

/**
 * This method sets the scheduling parameter. The time settings are given by vectors. Each vector
 * holds a list of Integer objects (currently ordered). Every Integer represents a element of a
 * timestamp (cron like).//from   www.j  a  v  a 2s .  c o m
 * @param startMinutes A list of minutes (0-59)
 * @param startHours A list of hours (0-23)
 * @param startDaysOfMonth A list of days of a month (1-31)
 * @param startMonths A list of months (1-12; starts with 1 for January)
 * @param startDaysOfWeek A list of day of a week (0-6; starts with 0 for Sunday)
 */
protected synchronized void setSchedulingParameter(List<Integer> startMinutes, List<Integer> startHours,
        List<Integer> startDaysOfMonth, List<Integer> startMonths, List<Integer> startDaysOfWeek)
        throws SchedulerException {
    Enumeration vectorEnumerator;

    List<Integer> workVector;
    int workInt;

    // Check minute values
    if (startMinutes == null) {
        startMinutes = new ArrayList<Integer>();
    }

    for (Integer minute : startMinutes) {
        try {
            workInt = minute;

            if ((workInt < 0) || (workInt > 59)) {
                throw new SchedulerException("SchedulerMethodJob.setParameter: A minute value is out of range");
            }
        } catch (ClassCastException aException) {
            throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a minute value");
        }
    }

    // Check hour values
    if (startHours == null) {
        startHours = new ArrayList<Integer>();
    }

    for (Integer hours : startHours) {
        try {
            workInt = hours;

            if ((workInt < 0) || (workInt > 23)) {
                throw new SchedulerException("SchedulerMethodJob.setParameter: A hour value is out of range");
            }
        } catch (ClassCastException aException) {
            throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a hour value");
        }
    }

    // Check day of month values
    if (startDaysOfMonth == null) {
        startDaysOfMonth = new ArrayList<Integer>();
    }

    for (Integer days : startDaysOfMonth) {
        try {
            workInt = days;

            if ((workInt < 1) || (workInt > 31)) {
                throw new SchedulerException(
                        "SchedulerMethodJob.setParameter: A day of month value is out of range");
            }
        } catch (ClassCastException aException) {
            throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a day of month value");
        }
    }

    // Check month values and normalize them for internal usage
    if (startMonths == null) {
        startMonths = new ArrayList<Integer>();
    }

    workVector = new ArrayList<Integer>();
    for (Integer month : startMonths) {
        try {
            workInt = month;

            if ((workInt < 1) || (workInt > 12)) {
                throw new SchedulerException("SchedulerMethodJob.setParameter: A month value is out of range");
            }

            workVector.add(workInt - 1); // Internal: zero based
        } catch (ClassCastException aException) {
            throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a month value");
        }
    }
    startMonths = workVector;

    // Check day of week values
    if (startDaysOfWeek == null) {
        startDaysOfWeek = new ArrayList<Integer>();
    }

    workVector = new ArrayList<Integer>();
    for (Integer daysOfWeek : startDaysOfWeek) {
        try {
            workInt = daysOfWeek;

            if ((workInt < 0) || (workInt > 6)) {
                throw new SchedulerException(
                        "SchedulerMethodJob.setParameter: A day of week value is out of range");
            }

            // Conversion not realy necessary, but what if SUN changes the
            // implementation .... :-))
            switch (workInt) {
            case 0:
                workVector.add(Calendar.SUNDAY);
                break;
            case 1:
                workVector.add(Calendar.MONDAY);
                break;
            case 2:
                workVector.add(Calendar.TUESDAY);
                break;
            case 3:
                workVector.add(Calendar.WEDNESDAY);
                break;
            case 4:
                workVector.add(Calendar.THURSDAY);
                break;
            case 5:
                workVector.add(Calendar.FRIDAY);
                break;
            case 6:
                workVector.add(Calendar.SATURDAY);
                break;
            }
        } catch (ClassCastException aException) {
            throw new SchedulerException("SchedulerMethodJob.setParameter: Can't convert a day of week value");
        }
    }
    startDaysOfWeek = workVector;

    // Assign the calculated values
    vMinutes = startMinutes;
    vHours = startHours;
    vDaysOfMonth = startDaysOfMonth;
    vMonths = startMonths;
    vDaysOfWeek = startDaysOfWeek;

    // Sort the calculated vectors
    sortCronVectors();
}