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:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

/**
 * @param infoExam/* ww w.j a va  2 s .co  m*/
 * @return
 */
private boolean atValidHour(InfoExam infoExam) {
    int curricularYear = infoExam.getInfoExecutionCourse().getCurricularYear().intValue();
    int beginning = infoExam.getBeginning().get(Calendar.HOUR_OF_DAY);
    int weekDay = infoExam.getDay().get(Calendar.DAY_OF_WEEK);

    return ((curricularYear == 1 || curricularYear == 2) && (beginning == 9))
            || (curricularYear == 3 && beginning == 17)
            || (curricularYear == 4
                    && (((weekDay == Calendar.TUESDAY || weekDay == Calendar.THURSDAY) && beginning == 17)
                            || (weekDay == Calendar.SATURDAY && beginning == 9)))
            || (curricularYear == 5 && beginning == 13);
}

From source file:com.autentia.jsf.component.ocupation.HtmlOcupationCalendarRenderer.java

private int mapCalendarDayToCommonDay(int day) {
    switch (day) {
    case Calendar.TUESDAY:
        return 1;
    case Calendar.WEDNESDAY:
        return 2;
    case Calendar.THURSDAY:
        return 3;
    case Calendar.FRIDAY:
        return 4;
    case Calendar.SATURDAY:
        return 5;
    case Calendar.SUNDAY:
        return 6;
    default:/*from w  w  w  .  ja  v  a 2  s  . c om*/
        return 0;
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

private boolean onValidWeekDay(InfoExam infoExam) {
    int curricularYear = infoExam.getInfoExecutionCourse().getCurricularYear().intValue();
    int weekDay = infoExam.getDay().get(Calendar.DAY_OF_WEEK);

    return ((curricularYear == 1 || curricularYear == 3 || curricularYear == 5)
            && (weekDay == Calendar.MONDAY || weekDay == Calendar.WEDNESDAY || weekDay == Calendar.FRIDAY))
            || ((curricularYear == 2 || curricularYear == 4) && (weekDay == Calendar.TUESDAY
                    || weekDay == Calendar.THURSDAY || weekDay == Calendar.SATURDAY));
}

From source file:cn.mypandora.util.MyDateUtils.java

/**
 * .//w w  w  .  j a  va 2  s. c o  m
 *
 * @param c
 * @return
 */
public static String getWeekDay(Calendar c) {
    if (c == null) {
        return "";
    }
    switch (c.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        return "";
    case Calendar.TUESDAY:
        return "";
    case Calendar.WEDNESDAY:
        return "";
    case Calendar.THURSDAY:
        return "";
    case Calendar.FRIDAY:
        return "";
    case Calendar.SATURDAY:
        return "";
    default:
        return "";
    }
}

From source file:com.ubundude.timesheet.ReportFragment.java

/**
 * Method to get the Calendar day of week Integer
 * //from  w  ww . j  av a  2 s.c  om
 * @param lFirstDay The day of the from the shared preferences
 * @return DOW The integer for the day of the week
 */
private int getFirstDay(String lFirstDay) {
    int DOW = Calendar.SUNDAY;

    if (lFirstDay == "MONDAY")
        DOW = Calendar.MONDAY;
    else if (lFirstDay == "TUESDAY")
        DOW = Calendar.TUESDAY;
    else if (lFirstDay == "WEDNESDAY")
        DOW = Calendar.WEDNESDAY;
    else if (lFirstDay == "THURSDAY")
        DOW = Calendar.THURSDAY;
    else if (lFirstDay == "FRIDAY")
        DOW = Calendar.FRIDAY;
    else if (lFirstDay == "SATURDAY")
        DOW = Calendar.SATURDAY;

    return DOW;
}

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//from   w  w  w.  j a  va  2  s.  c  o 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   ww w.j  a  v  a 2  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 www  .  java2s .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  ww .ja v a  2 s.  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/*w w w.ja v a2 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();
}