Example usage for java.util Calendar SATURDAY

List of usage examples for java.util Calendar SATURDAY

Introduction

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

Prototype

int SATURDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Saturday.

Usage

From source file:org.unitime.timetable.action.PersonalizedExamReportAction.java

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;
        }//  ww  w.j a  v a2  s  .c o  m
    }
    return daysCode;
}

From source file:com.panet.imeta.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java

public static Object dateAdd(Context actualContext, Scriptable actualObject, Object[] ArgList,
        Function FunctionContext) {
    if (ArgList.length == 3) {
        try {/*from w w  w  .j a va  2s.  c  o  m*/
            if (isNull(ArgList, new int[] { 0, 1, 2 }))
                return null;
            else if (isUndefined(ArgList, new int[] { 0, 1, 2 }))
                return Context.getUndefinedValue();
            java.util.Date dIn = (java.util.Date) Context.jsToJava(ArgList[0], java.util.Date.class);
            String strType = Context.toString(ArgList[1]);
            int iValue = (int) Context.toNumber(ArgList[2]);
            Calendar cal = Calendar.getInstance();
            cal.setTime(dIn);
            if (strType.toLowerCase().equals("y"))
                cal.add(Calendar.YEAR, iValue);
            else if (strType.toLowerCase().equals("m"))
                cal.add(Calendar.MONTH, iValue);
            else if (strType.toLowerCase().equals("d"))
                cal.add(Calendar.DATE, iValue);
            else if (strType.toLowerCase().equals("w"))
                cal.add(Calendar.WEEK_OF_YEAR, iValue);
            else if (strType.toLowerCase().equals("wd")) {
                int iOffset = 0;
                while (iOffset < iValue) {
                    int day = cal.get(Calendar.DAY_OF_WEEK);
                    cal.add(Calendar.DATE, 1);
                    if ((day != Calendar.SATURDAY) && (day != Calendar.SUNDAY))
                        iOffset++;
                }
            } else if (strType.toLowerCase().equals("hh"))
                cal.add(Calendar.HOUR, iValue);
            else if (strType.toLowerCase().equals("mi"))
                cal.add(Calendar.MINUTE, iValue);
            else if (strType.toLowerCase().equals("ss"))
                cal.add(Calendar.SECOND, iValue);
            return cal.getTime();
        } catch (Exception e) {
            throw Context.reportRuntimeError(e.toString());
        }
    } else {
        throw Context.reportRuntimeError("The function call dateAdd requires 3 arguments.");
    }
}

From source file:org.apache.click.extras.control.DateField.java

/**
 * Return the names of months and weekdays as a script.
 *//*from ww  w .j a  va2s  . co  m*/
protected void addCalenderTranslations(List<Element> headElements) {
    JsScript script = new JsScript();
    script.setId("datefield-js-setup-global");
    if (!headElements.contains(script)) {
        DateFormatSymbols dfs = new DateFormatSymbols(getLocale());

        HtmlStringBuffer buffer = new HtmlStringBuffer(150);
        buffer.append("Date.months=new Array(");
        generateJavaScriptArray(buffer, dfs.getMonths(), 0, 12);
        buffer.append(");\n");

        buffer.append("Date.monthAbbreviations=new Array(");
        generateJavaScriptArray(buffer, dfs.getShortMonths(), 0, 12);
        buffer.append(");\n");

        buffer.append("Date.dayNames=new Array(");
        generateJavaScriptArray(buffer, dfs.getWeekdays(), Calendar.SUNDAY, Calendar.SATURDAY + 1);
        buffer.append(");\n");

        buffer.append("Date.dayAbbreviations=new Array(");
        generateJavaScriptArray(buffer, dfs.getShortWeekdays(), Calendar.SUNDAY, Calendar.SATURDAY + 1);
        buffer.append(");\n");

        String[] weekdays = null;
        if (getMessages().containsKey("calendar-weekdays-heading")) {
            String headings = getMessage("calendar-weekdays-heading");
            weekdays = StringUtils.splitPreserveAllTokens("," + headings, ',');
        } else {
            weekdays = dfs.getShortWeekdays();
        }
        String[] days = new String[7];
        int firstDayOfWeek = getFirstDayOfWeek() - 1;
        for (int i = 0; i < 7; i++) {
            days[i] = weekdays[(i + firstDayOfWeek) % 7 + 1];
        }
        buffer.append("Date.weekdays=new Array(");
        generateJavaScriptArray(buffer, days, 0, 7);
        buffer.append(");\n");

        buffer.append("Date.first_day_of_week=").append(firstDayOfWeek).append(";\n");
        if (getMessages().containsKey("calendar-ok")) {
            buffer.append("_translations[\"OK\"] = \"");
            buffer.append(getMessage("calendar-ok"));
            buffer.append("\";\n");
        }
        if (getMessages().containsKey("calendar-now")) {
            buffer.append("_translations[\"Now\"] = \"");
            buffer.append(getMessage("calendar-now"));
            buffer.append("\";\n");
        }
        if (getMessages().containsKey("calendar-today")) {
            buffer.append("_translations[\"Today\"] = \"");
            buffer.append(getMessage("calendar-today"));
            buffer.append("\";\n");
        }
        if (getMessages().containsKey("calendar-clear")) {
            buffer.append("_translations[\"Clear\"] = \"");
            buffer.append(getMessage("calendar-clear"));
            buffer.append("\";\n");
        }

        script.setContent(buffer.toString());
        headElements.add(script);
    }
}

From source file:com.aurel.track.move.ItemMoveBL.java

public static Integer getNumberOfSaturdaysFromInterval(Date startDateParam, Date endDateParam) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(startDateParam);//ww  w. ja v a2  s  .com
    int numOfSaturdays = 0;
    while (DateTimeUtils.lessOrEqual(calendar.getTime(), endDateParam)) {
        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
            numOfSaturdays++;
        }
        calendar.add(Calendar.DAY_OF_YEAR, 1);
    }
    return numOfSaturdays;
}

From source file:com.ah.ui.actions.teacherView.TvRedirectionAction.java

private boolean hasClassToday(final TvClassSchedule period) {
    String periodWeekday = period.getWeekdaySecString();
    String currentWeekday = AhDateTimeUtil.getCurrentWeekDay(getUserTimeZone());

    if (TvClassSchedule.MONDAY_TO_FRIDAY.equals(period.getWeekdaySec())) {
        int day = AhDateTimeUtil.getDatePart(new Date(), "w", getUserTimeZone());

        if (day > Calendar.SUNDAY && day < Calendar.SATURDAY) {
            return true;
        }//from   w w  w.ja  v  a  2s  .c  o  m
    } else {
        if (periodWeekday.toLowerCase().contains(currentWeekday.toLowerCase().substring(0, 3))) {
            return true;
        }
    }

    return false;
}

From source file:org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java

public static Object dateAdd(Context actualContext, Scriptable actualObject, Object[] ArgList,
        Function FunctionContext) {
    if (ArgList.length == 3) {
        try {/* www .  ja  va  2  s . c  o  m*/
            if (isNull(ArgList, new int[] { 0, 1, 2 })) {
                return null;
            } else if (isUndefined(ArgList, new int[] { 0, 1, 2 })) {
                return Context.getUndefinedValue();
            }
            java.util.Date dIn = (java.util.Date) Context.jsToJava(ArgList[0], java.util.Date.class);
            String strType = Context.toString(ArgList[1]).toLowerCase();
            int iValue = (int) Context.toNumber(ArgList[2]);
            Calendar cal = Calendar.getInstance();
            cal.setTime(dIn);
            if (strType.equals("y")) {
                cal.add(Calendar.YEAR, iValue);
            } else if (strType.equals("m")) {
                cal.add(Calendar.MONTH, iValue);
            } else if (strType.equals("d")) {
                cal.add(Calendar.DATE, iValue);
            } else if (strType.equals("w")) {
                cal.add(Calendar.WEEK_OF_YEAR, iValue);
            } else if (strType.equals("wd")) {
                int iOffset = 0;
                while (iOffset < iValue) {
                    int day = cal.get(Calendar.DAY_OF_WEEK);
                    cal.add(Calendar.DATE, 1);
                    if ((day != Calendar.SATURDAY) && (day != Calendar.SUNDAY)) {
                        iOffset++;
                    }
                }
            } else if (strType.equals("hh")) {
                cal.add(Calendar.HOUR, iValue);
            } else if (strType.equals("mi")) {
                cal.add(Calendar.MINUTE, iValue);
            } else if (strType.equals("ss")) {
                cal.add(Calendar.SECOND, iValue);
            }
            return cal.getTime();
        } catch (Exception e) {
            throw Context.reportRuntimeError(e.toString());
        }
    } else {
        throw Context.reportRuntimeError("The function call dateAdd requires 3 arguments.");
    }
}

From source file:org.eevolution.form.VCRP.java

public CategoryDataset createDataset(Timestamp start, MResource r) {
    //System.out.println("Create new data set");
    GregorianCalendar gc1 = new GregorianCalendar();
    gc1.setTimeInMillis(start.getTime());
    gc1.clear(Calendar.MILLISECOND);
    gc1.clear(Calendar.SECOND);//from   www  .  j a v  a  2  s .c om
    gc1.clear(Calendar.MINUTE);
    gc1.clear(Calendar.HOUR_OF_DAY);

    Timestamp date = start;
    String namecapacity = Msg.translate(Env.getCtx(), "Capacity");
    System.out.println("\n Namecapacity :" + namecapacity);
    String nameload = Msg.translate(Env.getCtx(), "Load");
    System.out.println("\n Nameload :" + nameload);
    String namesummary = Msg.translate(Env.getCtx(), "Summary");
    System.out.println("\n Namesummary :" + namesummary);
    MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
    System.out.println("\n Resourcetype " + t);
    int days = 1;
    long hours = 0;

    if (t.isTimeSlot()) {

        hours = MMPCMRP.getHoursAvailable(t.getTimeSlotStart(), t.getTimeSlotEnd());

    } else {
        //fjviejo e-evolution MachineQty
        if (r.getDailyCapacity().multiply(r.getMachineQty()).compareTo(Env.ZERO) != 0)
            hours = r.getDailyCapacity().multiply(r.getMachineQty()).longValue();
        else
            //fjviejo e-evolution end
            hours = 24;
    }
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    //      Long Hours = new Long(hours);
    int C_UOM_ID = DB.getSQLValue(null, "SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? ",
            r.getS_Resource_ID());
    MUOM uom = new MUOM(Env.getCtx(), C_UOM_ID, null);
    System.out.println("\n uom1 " + uom + "\n");
    //System.out.println("um.isHour()"+ uom.isHour() );
    if (!uom.isHour()) {
        System.out.println("\n uom2 " + uom + "\n");
        return dataset;
    }
    System.out.println("\n Dataset " + dataset + "\n");
    int summary = 0;
    //int cont = 1;
    DateFormat formatter = DateFormat.getDateInstance();

    /*
     *     Vit4B Modificado para que tome 28 dias y
     *
     *
     */

    while (days < 29) {
        /*
         *      VIT4B MODIFICACION PARA ACUMULADO DE DIAS
         *
         *
         *
                
                
        //System.out.println("Day Number" + days);
        String strday = formatter.format(date);
        //String day = new String(new Integer (date.getDate()).toString());
        String day = new String(formatter.format(date));
        //day = day.substring(0,5);
                
        int index = day.indexOf("/");
                
        String str = day.substring(0,index);
        System.out.println("str: " + str + " index de / " + index);
                
        String str2 = day.substring(index+1,day.length());
        System.out.println("str2 resto: " + str2);
                
        index = str2.indexOf("/");
        System.out.println(index);
                
        String str3 = str2.substring(0,index);
        System.out.println("str3: " + str3 + " index de / " + index);
                
        String str4 = str2.substring(index+1,str2.length());
        System.out.println(str4);
                
        System.out.println("dia: " + str);
        System.out.println("mes: " + str3);
        System.out.println("ao: " + str4);
                
        //day = str + str3;
                
        day = new String(str + str3);
                
                
        //day = day.substring(0,day.lastIndexOf("/"));
        //day =day.substring(0,3);
                
        //cont++;
                
        System.out.println("r.getS_Resource_ID()" + r.getS_Resource_ID());
        System.out.println("Date: "  +  date + " day: "  +  day);
        int seconds = getLoad(r.getS_Resource_ID(),date ,date);
        Long Hours = new Long(hours);
        System.out.println("Summary "+ summary);
        System.out.println("Capacity "+ hours);
        System.out.println("Load "+ seconds);
                
        /*
         *
         *      VIT4B MODIFICACION PARA ACUMULADO DE DIAS
         *
         *
         */

        /*
         *      ORIGINAL COMPIERE
         */

        String day = new String(new Integer(date.getDate()).toString());
        System.out.println("r.getS_Resource_ID()" + r.getS_Resource_ID());
        System.out.println("Date:" + date);

        /*
         *      VIT4B - Modificacin para calcular como se calcula el reporte CCRP
         *      en funcion de la carga parcial
         *
         *
         */

        int seconds = getLoad(r.getS_Resource_ID(), date, date);

        //BigDecimal value = calculateLoad(date, r, null);
        //int seconds = value.intValue();

        Long Hours = new Long(hours);
        System.out.println("Summary " + summary);
        System.out.println("Load " + seconds);

        /*
         *      FIN ORIGINAL COMPIERE
         *
         */

        switch (gc1.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.SUNDAY:
            days++;
            if (t.isOnSunday()) { //System.out.println("si Sunday");
                                  //Msg.translate(Env.getCtx(), "OnSunday");
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600); //+ (Hours.intValue() - ((seconds / 3600)));
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else { //System.out.println("no Sunday");
                     //String day = Msg.translate(Env.getCtx(), "OnSunday") ;
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        case Calendar.MONDAY:
            days++;
            if (t.isOnMonday()) { //System.out.println("si Monday");
                                  //String day = Msg.translate(Env.getCtx(), "OnMonday") ;
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else {
                //System.out.println("no Monday");
                //String day = Msg.translate(Env.getCtx(), "OnMonday")  ;
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        case Calendar.TUESDAY:
            days++;
            if (t.isOnTuesday()) { //System.out.println("si TuesDay");
                                   //String day = Msg.translate(Env.getCtx(), "OnTuesday");
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else {
                //System.out.println("no TuesDay");
                //String day = Msg.translate(Env.getCtx(), "OnTuesday");
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        case Calendar.WEDNESDAY:
            days++;
            if (t.isOnWednesday()) {
                //String day = Msg.translate(Env.getCtx(), "OnWednesday");
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else {

                //String day = Msg.translate(Env.getCtx(), "OnWednesday");
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        case Calendar.THURSDAY:
            days++;
            if (t.isOnThursday()) {
                //String day = Msg.translate(Env.getCtx(), "OnThursday");
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else {

                //String day = Msg.translate(Env.getCtx(), "OnThursday");
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        case Calendar.FRIDAY:
            days++;
            if (t.isOnFriday()) {
                //String day = Msg.translate(Env.getCtx(), "OnFriday");
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else {

                //String day = Msg.translate(Env.getCtx(), "OnFriday");
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        case Calendar.SATURDAY:
            days++;
            if (t.isOnSaturday()) {
                //String day = Msg.translate(Env.getCtx(), "OnSaturday");
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            } else {
                //String day = Msg.translate(Env.getCtx(), "OnSaturday");
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(seconds / 3600, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = org.compiere.util.TimeUtil.addDays(date, 1);
                break;
            }
        }

    }
    return dataset;
}

From source file:com.leavjenn.smoothdaterangepicker.date.SmoothDateRangePickerFragment.java

@SuppressWarnings("unused")
public void setFirstDayOfWeek(int startOfWeek, int startWeekEnd) {
    if (startOfWeek < Calendar.SUNDAY || startOfWeek > Calendar.SATURDAY) {
        throw new IllegalArgumentException("Value must be between Calendar.SUNDAY and " + "Calendar.SATURDAY");
    }//  w  ww  .  j  a va2  s. c o  m
    mWeekStart = startOfWeek;

    if (mDayPickerView != null) {
        mDayPickerView.onChange();
    }

    if (mDayPickerViewEnd != null) {
        mDayPickerViewEnd.onChange();
    }
}

From source file:org.eevolution.form.VSCRP.java

public CategoryDataset createDataset(Timestamp start, MResource r) {
    //System.out.println("Create new data set");
    GregorianCalendar gc1 = new GregorianCalendar();
    gc1.setTimeInMillis(start.getTime());
    gc1.clear(Calendar.MILLISECOND);
    gc1.clear(Calendar.SECOND);/* w  w w .  j a va 2  s.c  om*/
    gc1.clear(Calendar.MINUTE);
    gc1.clear(Calendar.HOUR_OF_DAY);

    Timestamp date = start;
    String namecapacity = Msg.translate(Env.getCtx(), "Capacity");
    System.out.println("\n Namecapacity :" + namecapacity);
    String nameload = Msg.translate(Env.getCtx(), "Load");
    System.out.println("\n Nameload :" + nameload);
    String namesummary = Msg.translate(Env.getCtx(), "Summary");
    System.out.println("\n Namesummary :" + namesummary);
    MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
    System.out.println("\n Resourcetype " + t);
    int days = 1;
    long hours = 0;

    if (t.isTimeSlot()) {

        hours = MMPCMRP.getHoursAvailable(t.getTimeSlotStart(), t.getTimeSlotEnd());

    } else {
        //fjviejo e-evolution MachineQty
        if (r.getDailyCapacity().multiply(r.getMachineQty()).compareTo(Env.ZERO) != 0)
            hours = r.getDailyCapacity().multiply(r.getMachineQty()).longValue();
        else
            //fjviejo e-evolution end
            hours = 24;
    }
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    //      Long Hours = new Long(hours);                            
    int C_UOM_ID = DB.getSQLValue(null, "SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? ",
            r.getS_Resource_ID());
    MUOM uom = new MUOM(Env.getCtx(), C_UOM_ID, null);
    System.out.println("\n uom1 " + uom + "\n");
    //System.out.println("um.isHour()"+ uom.isHour() );
    if (!uom.isHour()) {
        System.out.println("\n uom2 " + uom + "\n");
        return dataset;
    }
    System.out.println("\n Dataset " + dataset + "\n");
    int summary = 0;
    int secondsAcum = 0;
    long hoursAcum = 0;

    while (days < 29) {
        //System.out.println("Day Number" + days);
        String day = new String(new Integer(date.getDate()).toString());
        System.out.println("r.getS_Resource_ID()" + r.getS_Resource_ID());
        System.out.println("Date:" + date);
        int seconds = getLoad(r.getS_Resource_ID(), date, date);
        Long Hours = new Long(hours);
        System.out.println("Summary " + summary);
        System.out.println("Capacity " + hours);
        System.out.println("Load " + seconds);

        /*
        **  Realizo la verificacin sobre que da me encuentro
        **  para graficar cada 7 dias el estado de la semana.
        **
        **  secondsAcum y hoursAcum llevan los acumulados para la semana
        **  los reinicio en cada nueva semana.
        **
        **  VIT4B - 07/12/2006
        */

        if (days == 1 || days == 8 || days == 15 || days == 22) {
            secondsAcum = 0;
            hoursAcum = 0;
        }

        secondsAcum += seconds;
        hoursAcum += hours;

        switch (gc1.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.SUNDAY:
            if (t.isOnSunday()) {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600); //+ (Hours.intValue() - ((seconds / 3600)));
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.MONDAY:
            if (t.isOnMonday()) {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.TUESDAY:
            if (t.isOnTuesday()) {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.WEDNESDAY:
            if (t.isOnWednesday()) {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.THURSDAY:
            if (t.isOnThursday()) {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.FRIDAY:
            if (t.isOnFriday()) {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {

                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.SATURDAY:
            if (t.isOnSaturday()) {
                /*
                                                **  Realizo la verificacin sobre que da me encuentro
                                                **  para graficar cada 7 dias el estado de la semana.
                                                **
                                                **  VIT4B - 07/12/2006
                                                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }

                summary = summary + Hours.intValue() - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                /*
                **  Realizo la verificacin sobre que da me encuentro
                **  para graficar cada 7 dias el estado de la semana.
                **
                **  VIT4B - 07/12/2006
                */

                if (days == 7 || days == 14 || days == 21 || days == 28) {
                    dataset.addValue(hoursAcum, namecapacity, day);
                    dataset.addValue(secondsAcum / 3600, nameload, day);
                    dataset.addValue(summary, namesummary, day);

                }
                summary = summary - (seconds / 3600);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        }

        days++;

    }
    return dataset;
}

From source file:com.borax12.materialdaterangepicker.date.DatePickerDialog.java

@SuppressWarnings("unused")
public void setFirstDayOfWeek(int startOfWeek, int startWeekEnd) {
    if (startOfWeek < Calendar.SUNDAY || startOfWeek > Calendar.SATURDAY) {
        throw new IllegalArgumentException("Value must be between Calendar.SUNDAY and " + "Calendar.SATURDAY");
    }/*from ww  w  .j av a2  s  .com*/
    mWeekStart = startOfWeek;
    mWeekStartEnd = startWeekEnd;

    if (mDayPickerView != null) {
        mDayPickerView.onChange();
    }

    if (mDayPickerViewEnd != null) {
        mDayPickerViewEnd.onChange();
    }
}