Example usage for java.util Calendar TUESDAY

List of usage examples for java.util Calendar TUESDAY

Introduction

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

Prototype

int TUESDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Tuesday.

Usage

From source file:saphion.services.ForegroundService.java

public String setNotText(String subtext, String mainText, int choice) {
    switch (choice) {
    case 0://from   w w w  . ja v  a  2 s.  c  o m
        return level + "% remaining";
    case 1:
        return "Temperature: " + temperature;
    case 2:
        return health + ", " + "Temperature: " + temperature;
    case 3:
        return subtext;
    case 4:
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date(System.currentTimeMillis() + (reqTime * 1000)));
        String day1 = "";
        switch (cal.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY:
            day1 = "Monday";
            break;
        case Calendar.TUESDAY:
            day1 = "Tuesday";
            break;
        case Calendar.WEDNESDAY:
            day1 = "Wednesday";
            break;
        case Calendar.THURSDAY:
            day1 = "Thursday";
            break;
        case Calendar.FRIDAY:
            day1 = "Friday";
            break;
        case Calendar.SATURDAY:
            day1 = "Saturday";
            break;
        case Calendar.SUNDAY:
            day1 = "Sunday";
            break;
        }
        String str = "";
        if (isconnected) {
            str = "Full Charge at ";
        } else {
            str = "Empty at ";
        }
        if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
            return str + ((cal.get(Calendar.HOUR) == 0) ? 12 : cal.get(Calendar.HOUR)) + ":"
                    + ((cal.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + cal.get(Calendar.MINUTE))
                            : cal.get(Calendar.MINUTE))
                    + (cal.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM");
        } else {
            int d = Calendar.getInstance().get(Calendar.DAY_OF_WEEK) + 1;
            if (d == 8)
                d = 1;
            if (cal.get(Calendar.DAY_OF_WEEK) == d)
                day1 = "Tomorrow";
            return str + ((cal.get(Calendar.HOUR) == 0) ? 12 : cal.get(Calendar.HOUR)) + ":"
                    + ((cal.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + cal.get(Calendar.MINUTE))
                            : cal.get(Calendar.MINUTE))
                    + (cal.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM") + ", " + day1;
        }
    case 5:
        Date mydate = TimeFuncs
                .GetItemDate(mPref.getString(PreferenceHelper.LAST_CHARGED, TimeFuncs.getCurrentTimeStamp()));
        Calendar c = Calendar.getInstance();
        c.setTime(mydate);
        String day = "";
        switch (c.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY:
            day = "Monday";
            break;
        case Calendar.TUESDAY:
            day = "Tuesday";
            break;
        case Calendar.WEDNESDAY:
            day = "Wednesday";
            break;
        case Calendar.THURSDAY:
            day = "Thursday";
            break;
        case Calendar.FRIDAY:
            day = "Friday";
            break;
        case Calendar.SATURDAY:
            day = "Saturday";
            break;
        case Calendar.SUNDAY:
            day = "Sunday";
            break;
        }

        if (c.get(Calendar.DAY_OF_WEEK) == Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
            if (isconnected)
                return "Plugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":"
                        + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE))
                                : c.get(Calendar.MINUTE))
                        + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM");
            else
                return "Unplugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":"
                        + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE))
                                : c.get(Calendar.MINUTE))
                        + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM");
        } else {
            int d = Calendar.getInstance().get(Calendar.DAY_OF_WEEK) - 1;
            if (d == 0)
                d = 7;
            if (c.get(Calendar.DAY_OF_WEEK) == d)
                day = "Yesterday";
            if (isconnected)
                return "Plugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":"
                        + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE))
                                : c.get(Calendar.MINUTE))
                        + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM") + ", " + day;
            else
                return "Unplugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":"
                        + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE))
                                : c.get(Calendar.MINUTE))
                        + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM") + ", " + day;
        }

    case 6:
        return mainText;
    }
    return mainText;

}

From source file:com.sonyericsson.hudson.plugins.gerrit.trigger.GerritServer.java

/**
 * Generates a list of helper objects for the jelly view.
 *
 * @return a list of helper objects./*from w  ww. j  av a2  s  .co  m*/
 */
public List<ExceptionDataHelper> generateHelper() {
    WatchTimeExceptionData data = config.getExceptionData();
    List<ExceptionDataHelper> list = new LinkedList<ExceptionDataHelper>();
    list.add(new ExceptionDataHelper(Messages.MondayDisplayName(), Calendar.MONDAY, data));
    list.add(new ExceptionDataHelper(Messages.TuesdayDisplayName(), Calendar.TUESDAY, data));
    list.add(new ExceptionDataHelper(Messages.WednesdayDisplayName(), Calendar.WEDNESDAY, data));
    list.add(new ExceptionDataHelper(Messages.ThursdayDisplayName(), Calendar.THURSDAY, data));
    list.add(new ExceptionDataHelper(Messages.FridayDisplayName(), Calendar.FRIDAY, data));
    list.add(new ExceptionDataHelper(Messages.SaturdayDisplayName(), Calendar.SATURDAY, data));
    list.add(new ExceptionDataHelper(Messages.SundayDisplayName(), Calendar.SUNDAY, data));
    return list;
}

From source file:org.sakaiproject.sitestats.impl.chart.ChartServiceImpl.java

private Map<Integer, String> getWeekDaysMap() {
    weekDaysMap = new HashMap<Integer, String>();
    weekDaysMap.put(Calendar.SUNDAY, msgs.getString("day_sun"));
    weekDaysMap.put(Calendar.MONDAY, msgs.getString("day_mon"));
    weekDaysMap.put(Calendar.TUESDAY, msgs.getString("day_tue"));
    weekDaysMap.put(Calendar.WEDNESDAY, msgs.getString("day_wed"));
    weekDaysMap.put(Calendar.THURSDAY, msgs.getString("day_thu"));
    weekDaysMap.put(Calendar.FRIDAY, msgs.getString("day_fri"));
    weekDaysMap.put(Calendar.SATURDAY, msgs.getString("day_sat"));
    return weekDaysMap;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

private static String[] mapShortWeekdaysStartingWithSunday(DateFormatSymbols symbols) {
    String[] weekdays = new String[7];

    String[] localeWeekdays = symbols.getShortWeekdays();

    weekdays[0] = localeWeekdays[Calendar.SUNDAY];
    weekdays[1] = localeWeekdays[Calendar.MONDAY];
    weekdays[2] = localeWeekdays[Calendar.TUESDAY];
    weekdays[3] = localeWeekdays[Calendar.WEDNESDAY];
    weekdays[4] = localeWeekdays[Calendar.THURSDAY];
    weekdays[5] = localeWeekdays[Calendar.FRIDAY];
    weekdays[6] = localeWeekdays[Calendar.SATURDAY];

    return weekdays;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

private static String[] mapShortWeekdaysStartingWithSaturday(DateFormatSymbols symbols) {
    String[] weekdays = new String[7];

    String[] localeWeekdays = symbols.getShortWeekdays();

    weekdays[0] = localeWeekdays[Calendar.SATURDAY];
    weekdays[1] = localeWeekdays[Calendar.SUNDAY];
    weekdays[2] = localeWeekdays[Calendar.MONDAY];
    weekdays[3] = localeWeekdays[Calendar.TUESDAY];
    weekdays[4] = localeWeekdays[Calendar.WEDNESDAY];
    weekdays[5] = localeWeekdays[Calendar.THURSDAY];
    weekdays[6] = localeWeekdays[Calendar.FRIDAY];

    return weekdays;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

private static String[] mapWeekdaysStartingWithSunday(DateFormatSymbols symbols) {
    String[] weekdays = new String[7];

    String[] localeWeekdays = symbols.getWeekdays();

    weekdays[0] = localeWeekdays[Calendar.SUNDAY];
    weekdays[1] = localeWeekdays[Calendar.MONDAY];
    weekdays[2] = localeWeekdays[Calendar.TUESDAY];
    weekdays[3] = localeWeekdays[Calendar.WEDNESDAY];
    weekdays[4] = localeWeekdays[Calendar.THURSDAY];
    weekdays[5] = localeWeekdays[Calendar.FRIDAY];
    weekdays[6] = localeWeekdays[Calendar.SATURDAY];

    return weekdays;
}

From source file:com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer.java

private static String[] mapWeekdays(DateFormatSymbols symbols) {
    String[] weekdays = new String[7];

    String[] localeWeekdays = symbols.getShortWeekdays();

    weekdays[0] = localeWeekdays[Calendar.MONDAY];
    weekdays[1] = localeWeekdays[Calendar.TUESDAY];
    weekdays[2] = localeWeekdays[Calendar.WEDNESDAY];
    weekdays[3] = localeWeekdays[Calendar.THURSDAY];
    weekdays[4] = localeWeekdays[Calendar.FRIDAY];
    weekdays[5] = localeWeekdays[Calendar.SATURDAY];
    weekdays[6] = localeWeekdays[Calendar.SUNDAY];

    return weekdays;
}

From source file:com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer.java

private static String[] mapWeekdaysLong(DateFormatSymbols symbols) {
    String[] weekdays = new String[7];

    String[] localeWeekdays = symbols.getWeekdays();

    weekdays[0] = localeWeekdays[Calendar.MONDAY];
    weekdays[1] = localeWeekdays[Calendar.TUESDAY];
    weekdays[2] = localeWeekdays[Calendar.WEDNESDAY];
    weekdays[3] = localeWeekdays[Calendar.THURSDAY];
    weekdays[4] = localeWeekdays[Calendar.FRIDAY];
    weekdays[5] = localeWeekdays[Calendar.SATURDAY];
    weekdays[6] = localeWeekdays[Calendar.SUNDAY];

    return weekdays;
}

From source file:edu.jhuapl.openessence.controller.ReportController.java

private int getCalWeekStartDay(Map<String, ResolutionHandler> resolutionHandlers) {
    ResolutionHandler handler = resolutionHandlers.get("weekly");
    int startDay;
    if (handler == null || !(handler instanceof PgSqlWeeklyHandler)) {
        switch (Integer.parseInt(messageSource.getMessage("epidemiological.day.start",
                Integer.toString(DEFAULT_WEEK_STARTDAY)))) {
        case 0://from   w w  w . j a v a 2 s  . co  m
            startDay = Calendar.SUNDAY;
            break;
        case 2:
            startDay = Calendar.TUESDAY;
            break;
        case 3:
            startDay = Calendar.WEDNESDAY;
            break;
        case 4:
            startDay = Calendar.THURSDAY;
            break;
        case 5:
            startDay = Calendar.FRIDAY;
            break;
        case 6:
            startDay = Calendar.SATURDAY;
            break;
        default:
            startDay = Calendar.MONDAY;
            break;
        }
        return startDay;
    }
    return ((PgSqlWeeklyHandler) handler).getCalWeekStartDay();
}

From source file:org.unitime.timetable.solver.studentsct.StudentSectioningDatabaseLoader.java

private String datePatternName(DatePattern dp, TimeLocation time) {
    if ("never".equals(iDatePatternFormat))
        return dp.getName();
    if ("extended".equals(iDatePatternFormat) && dp.getType() != DatePattern.sTypeExtended)
        return dp.getName();
    if ("alternate".equals(iDatePatternFormat) && dp.getType() == DatePattern.sTypeAlternate)
        return dp.getName();
    if (time.getWeekCode().isEmpty())
        return time.getDatePatternName();
    Calendar cal = Calendar.getInstance(Locale.US);
    cal.setLenient(true);//from  w  ww .jav a  2s  .c o m
    cal.setTime(iDatePatternFirstDate);
    int idx = time.getWeekCode().nextSetBit(0);
    cal.add(Calendar.DAY_OF_YEAR, idx);
    Date first = null;
    while (idx < time.getWeekCode().size() && first == null) {
        if (time.getWeekCode().get(idx)) {
            int dow = cal.get(Calendar.DAY_OF_WEEK);
            switch (dow) {
            case Calendar.MONDAY:
                if ((time.getDayCode() & DayCode.MON.getCode()) != 0)
                    first = cal.getTime();
                break;
            case Calendar.TUESDAY:
                if ((time.getDayCode() & DayCode.TUE.getCode()) != 0)
                    first = cal.getTime();
                break;
            case Calendar.WEDNESDAY:
                if ((time.getDayCode() & DayCode.WED.getCode()) != 0)
                    first = cal.getTime();
                break;
            case Calendar.THURSDAY:
                if ((time.getDayCode() & DayCode.THU.getCode()) != 0)
                    first = cal.getTime();
                break;
            case Calendar.FRIDAY:
                if ((time.getDayCode() & DayCode.FRI.getCode()) != 0)
                    first = cal.getTime();
                break;
            case Calendar.SATURDAY:
                if ((time.getDayCode() & DayCode.SAT.getCode()) != 0)
                    first = cal.getTime();
                break;
            case Calendar.SUNDAY:
                if ((time.getDayCode() & DayCode.SUN.getCode()) != 0)
                    first = cal.getTime();
                break;
            }
        }
        cal.add(Calendar.DAY_OF_YEAR, 1);
        idx++;
    }
    if (first == null)
        return time.getDatePatternName();
    cal.setTime(iDatePatternFirstDate);
    idx = time.getWeekCode().length() - 1;
    cal.add(Calendar.DAY_OF_YEAR, idx);
    Date last = null;
    while (idx >= 0 && last == null) {
        if (time.getWeekCode().get(idx)) {
            int dow = cal.get(Calendar.DAY_OF_WEEK);
            switch (dow) {
            case Calendar.MONDAY:
                if ((time.getDayCode() & DayCode.MON.getCode()) != 0)
                    last = cal.getTime();
                break;
            case Calendar.TUESDAY:
                if ((time.getDayCode() & DayCode.TUE.getCode()) != 0)
                    last = cal.getTime();
                break;
            case Calendar.WEDNESDAY:
                if ((time.getDayCode() & DayCode.WED.getCode()) != 0)
                    last = cal.getTime();
                break;
            case Calendar.THURSDAY:
                if ((time.getDayCode() & DayCode.THU.getCode()) != 0)
                    last = cal.getTime();
                break;
            case Calendar.FRIDAY:
                if ((time.getDayCode() & DayCode.FRI.getCode()) != 0)
                    last = cal.getTime();
                break;
            case Calendar.SATURDAY:
                if ((time.getDayCode() & DayCode.SAT.getCode()) != 0)
                    last = cal.getTime();
                break;
            case Calendar.SUNDAY:
                if ((time.getDayCode() & DayCode.SUN.getCode()) != 0)
                    last = cal.getTime();
                break;
            }
        }
        cal.add(Calendar.DAY_OF_YEAR, -1);
        idx--;
    }
    if (last == null)
        return time.getDatePatternName();
    Formats.Format<Date> dpf = Formats.getDateFormat(Formats.Pattern.DATE_PATTERN);
    return dpf.format(first) + (first.equals(last) ? "" : " - " + dpf.format(last));
}