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:org.activequant.util.charting.IntradayMarketTimeline.java

private long getEndTime(int day) {
    long endTime = 0;

    if (day == Calendar.SUNDAY) {
        endTime = this.sundayEnd;
    } else if (day == Calendar.MONDAY) {
        endTime = this.mondayEnd;
    } else if (day == Calendar.TUESDAY) {
        endTime = this.tuesdayEnd;
    } else if (day == Calendar.WEDNESDAY) {
        endTime = this.wednesdayEnd;
    } else if (day == Calendar.THURSDAY) {
        endTime = this.thursdayEnd;
    } else if (day == Calendar.FRIDAY) {
        endTime = this.fridayEnd;
    } else if (day == Calendar.SATURDAY) {
        endTime = this.saturdayEnd;
    }/*  w  w w.ja v a  2s.  c  o  m*/

    return endTime;
}

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

public CategoryDataset createWeightDataset(Timestamp start, MResource r) {

    GregorianCalendar gc1 = new GregorianCalendar();
    gc1.setTimeInMillis(start.getTime());
    gc1.clear(Calendar.MILLISECOND);
    gc1.clear(Calendar.SECOND);//from ww  w  .  jav  a 2  s  . c o m
    gc1.clear(Calendar.MINUTE);
    gc1.clear(Calendar.HOUR_OF_DAY);

    String namecapacity = Msg.translate(Env.getCtx(), "Capacity");
    String nameload = Msg.translate(Env.getCtx(), "Load");
    String namesummary = Msg.translate(Env.getCtx(), "Summary");
    String namepossiblecapacity = "Possible Capacity";

    MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    double currentweight = DB.getSQLValue(null,
            "Select SUM( (mo.qtyordered-mo.qtydelivered)*(Select mp.weight From m_product mp Where mo.m_product_id=mp.m_product_id )  )From mpc_order mo Where ad_client_id=?",
            r.getAD_Client_ID());
    // fjviejo e-evolution machineqty capacidad por el numero de maquinas
    // double dailyCapacity = DB.getSQLValue(null,"Select dailycapacity From s_resource Where s_resource_id=?",r.getS_Resource_ID());
    double dailyCapacity = DB.getSQLValue(null,
            "Select dailycapacity*MachineQty From s_resource Where s_resource_id=?", r.getS_Resource_ID());
    System.out.println("***** Capacidad diaria " + dailyCapacity);
    // e-evolution end
    double utilization = DB.getSQLValue(null,
            "Select percentutillization From s_resource Where s_resource_id=?", r.getS_Resource_ID());

    double summary = 0;

    int day = 0;

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

    while (day < 29) {

        day++;

        switch (gc1.get(Calendar.DAY_OF_WEEK)) {

        case Calendar.SUNDAY:

            if (t.isOnSunday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;

        case Calendar.MONDAY:

            if (t.isOnMonday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;

        case Calendar.TUESDAY:

            if (t.isOnTuesday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;

        case Calendar.WEDNESDAY:

            if (t.isOnWednesday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;

        case Calendar.THURSDAY:

            if (t.isOnThursday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;

        case Calendar.FRIDAY:

            if (t.isOnFriday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;

        case Calendar.SATURDAY:

            if (t.isOnSaturday()) {

                currentweight -= (dailyCapacity * utilization) / 100;
                summary += ((dailyCapacity * utilization) / 100);

                dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day));
                dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day));
            } else {

                dataset.addValue(0, namepossiblecapacity, new Integer(day));
                dataset.addValue(0, namecapacity, new Integer(day));
            }

            break;
        }

        dataset.addValue(currentweight, nameload, new Integer(day));
        dataset.addValue(summary, namesummary, new Integer(day));

        gc1.add(Calendar.DATE, 1);
    }

    return dataset;
}

From source file:org.hawkular.alerts.api.model.action.TimeConstraint.java

private int day(String sDay) {
    if (isEmpty(sDay)) {
        return -1;
    }/*from   w  ww  . jav  a2 s  .c om*/
    if (sDay.length() < 3) {
        return -1;
    }
    String prefix = sDay.substring(0, 3).toLowerCase();
    DAY d = DAY.fromString(prefix);
    if (d == null) {
        return -1;
    }
    switch (d) {
    case SUNDAY:
        return Calendar.SUNDAY;
    case MONDAY:
        return Calendar.MONDAY;
    case TUESDAY:
        return Calendar.TUESDAY;
    case WEDNESDAY:
        return Calendar.WEDNESDAY;
    case THURSDAY:
        return Calendar.THURSDAY;
    case FRIDAY:
        return Calendar.FRIDAY;
    case SATURDAY:
        return Calendar.SATURDAY;
    default:
        return -1;
    }
}

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

private boolean isActiveDate(Calendar cal) {
    int day = cal.get(Calendar.DAY_OF_WEEK);

    long timeSinceStart = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000
            + cal.get(Calendar.SECOND) * 1000;

    if (day == Calendar.SUNDAY) {
        return (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd);
    } else if (day == Calendar.MONDAY) {
        return (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd);
    } else if (day == Calendar.TUESDAY) {
        return (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd);
    } else if (day == Calendar.WEDNESDAY) {
        return (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd);
    } else if (day == Calendar.THURSDAY) {
        return (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd);
    } else if (day == Calendar.FRIDAY) {
        return (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd);
    } else if (day == Calendar.SATURDAY) {
        return (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd);
    } else {//from   w ww. j a  va2 s . c om
        return false;
    }
}

From source file:com.jdo.CloudContactUtils.java

public static String getDay() {

    int d = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
    String day = "sun";
    switch (d) {/*from ww w.j  a  v a 2 s .c o  m*/

    case Calendar.SUNDAY:
        day = "sun";
        break;

    case Calendar.MONDAY:
        day = "mon";
        break;

    case Calendar.TUESDAY:
        day = "tue";
        break;

    case Calendar.WEDNESDAY:
        day = "wed";
        break;

    case Calendar.THURSDAY:
        day = "thu";
        break;

    case Calendar.FRIDAY:
        day = "fri";
        break;

    case Calendar.SATURDAY:
        day = "sat";
        break;
    }

    return day;
}

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

private boolean isActiveDate(Calendar cal, Calendar cal2) {
    int day = cal.get(Calendar.DAY_OF_WEEK);

    long timeSinceStart = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000
            + cal.get(Calendar.SECOND) * 1000;

    boolean firstDate = false;

    if (day == Calendar.SUNDAY) {
        firstDate = (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd);
    } else if (day == Calendar.MONDAY) {
        firstDate = (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd);
    } else if (day == Calendar.TUESDAY) {
        firstDate = (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd);
    } else if (day == Calendar.WEDNESDAY) {
        firstDate = (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd);
    } else if (day == Calendar.THURSDAY) {
        firstDate = (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd);
    } else if (day == Calendar.FRIDAY) {
        firstDate = (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd);
    } else if (day == Calendar.SATURDAY) {
        firstDate = (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd);
    } else {//  ww w .j a v a 2 s  . c o m
        firstDate = false;
    }

    int day2 = cal2.get(Calendar.DAY_OF_WEEK);

    timeSinceStart = cal2.get(Calendar.HOUR_OF_DAY) * 3600000 + cal2.get(Calendar.MINUTE) * 60000
            + cal2.get(Calendar.SECOND) * 1000;

    boolean secondDate = false;

    if (day2 == Calendar.SUNDAY) {
        secondDate = (timeSinceStart > this.sundayStart && timeSinceStart < this.sundayEnd);
    } else if (day2 == Calendar.MONDAY) {
        secondDate = (timeSinceStart > this.mondayStart && timeSinceStart < this.mondayEnd);
    } else if (day2 == Calendar.TUESDAY) {
        secondDate = (timeSinceStart > this.tuesdayStart && timeSinceStart < this.tuesdayEnd);
    } else if (day2 == Calendar.WEDNESDAY) {
        secondDate = (timeSinceStart > this.wednesdayStart && timeSinceStart < this.wednesdayEnd);
    } else if (day2 == Calendar.THURSDAY) {
        secondDate = (timeSinceStart > this.thursdayStart && timeSinceStart < this.thursdayEnd);
    } else if (day2 == Calendar.FRIDAY) {
        secondDate = (timeSinceStart > this.fridayStart && timeSinceStart < this.fridayEnd);
    } else if (day2 == Calendar.SATURDAY) {
        secondDate = (timeSinceStart > this.saturdayStart && timeSinceStart < this.saturdayEnd);
    } else {
        secondDate = false;
    }

    return (firstDate && secondDate);
}

From source file:de.ribeiro.android.gso.dataclasses.Pager.java

private String ResolveWeekDay(int value) {
    switch (value) {
    case Calendar.MONDAY:
        return "Montag";
    case Calendar.TUESDAY:
        return "Dienstag";
    case Calendar.WEDNESDAY:
        return "Mittwoch";
    case Calendar.THURSDAY:
        return "Donnerstag";
    case Calendar.FRIDAY:
        return "Freitag";
    case Calendar.SATURDAY:
        return "Samstag";
    case Calendar.SUNDAY:
        return "Sonntag";
    default:/* w  w w  . ja v  a2s  .  c  om*/
        return String.valueOf(value);
    }

}

From source file:Time.java

/**
 * Get default locale name of this day ("Monday", "Tuesday", etc.
 * // www  .  j a  va 2s  .  co  m
 * @return Name of day.
 */
public String getDayName() {
    switch (getDayOfWeek()) {
    case Calendar.MONDAY:
        return "Monday";
    case Calendar.TUESDAY:
        return "Tuesday";
    case Calendar.WEDNESDAY:
        return "Wednesday";
    case Calendar.THURSDAY:
        return "Thursday";
    case Calendar.FRIDAY:
        return "Friday";
    case Calendar.SATURDAY:
        return "Saturday";
    case Calendar.SUNDAY:
        return "Sunday";
    }

    // This will never happen
    return null;
}

From source file:org.sakaiproject.tool.section.jsf.backingbean.AddSectionsBean.java

public String getTuesday() {
    return daysOfWeek[Calendar.TUESDAY];
}

From source file:org.jasig.schedassist.model.AvailableBlockBuilder.java

/**
 * Returns a {@link List} of {@link Date} objects that fall between startDate and endDate and
 * exist on the days specified by daysOfWeekPhrase.
 * //from w ww  .  j  ava2 s  .  c o  m
 * For instance, passing "MWF", a start Date of June 30 2008, and an end Date of July 04 2008, this 
 * method will return a list of 3 Date objects (one for Monday June 30, one for Wednesday July 2, and
 * one for Friday July 4).
 * 
 * The time values for returned {@link Date}s will always be 00:00:00 (in the JVM's default timezone).
 * 
 * @param daysOfWeekPhrase
 * @param startDate
 * @param endDate
 * @return a {@link List} of {@link Date} objects that fall between startDate and endDate and
 * exist on the days specified by daysOfWeekPhrase.
 */
protected static List<Date> matchingDays(final String daysOfWeekPhrase, final Date startDate,
        final Date endDate) {
    List<Date> matchingDays = new ArrayList<Date>();

    Set<Integer> daysOfWeek = new HashSet<Integer>();
    for (char character : daysOfWeekPhrase.toUpperCase().toCharArray()) {
        switch (character) {
        case 'N':
            daysOfWeek.add(Calendar.SUNDAY);
            break;
        case 'M':
            daysOfWeek.add(Calendar.MONDAY);
            break;
        case 'T':
            daysOfWeek.add(Calendar.TUESDAY);
            break;
        case 'W':
            daysOfWeek.add(Calendar.WEDNESDAY);
            break;
        case 'R':
            daysOfWeek.add(Calendar.THURSDAY);
            break;
        case 'F':
            daysOfWeek.add(Calendar.FRIDAY);
            break;
        case 'S':
            daysOfWeek.add(Calendar.SATURDAY);
            break;
        }
    }

    Calendar current = Calendar.getInstance();
    current.setTime(startDate);
    // set the time to 00:00:00 to insure the time doesn't affect our comparison)
    // (because there may be a valid time window on endDate)
    current = CommonDateOperations.zeroOutTimeFields(current);

    while (current.getTime().compareTo(endDate) < 0) {
        if (daysOfWeek.contains(current.get(Calendar.DAY_OF_WEEK))) {
            matchingDays.add(current.getTime());
        }
        // increment currentDate +1 day 
        current.add(Calendar.DATE, 1);
    }
    return matchingDays;
}