Example usage for java.util Calendar FRIDAY

List of usage examples for java.util Calendar FRIDAY

Introduction

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

Prototype

int FRIDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Friday.

Usage

From source file:Main.java

/**
 * Converts the day of the week from android.text.format.Time to java.util.Calendar
 *///from  w  ww.  j  ava  2 s. com
public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) {
    switch (timeDayOfWeek) {
    case Time.MONDAY:
        return Calendar.MONDAY;
    case Time.TUESDAY:
        return Calendar.TUESDAY;
    case Time.WEDNESDAY:
        return Calendar.WEDNESDAY;
    case Time.THURSDAY:
        return Calendar.THURSDAY;
    case Time.FRIDAY:
        return Calendar.FRIDAY;
    case Time.SATURDAY:
        return Calendar.SATURDAY;
    case Time.SUNDAY:
        return Calendar.SUNDAY;
    default:
        throw new IllegalArgumentException("Argument must be between Time.SUNDAY and " + "Time.SATURDAY");
    }
}

From source file:com.mirth.connect.donkey.model.channel.PollConnectorPropertiesAdvanced.java

public PollConnectorPropertiesAdvanced() {
    weekly = true;//  w w  w.  jav a 2 s .com
    inactiveDays = new boolean[8];

    inactiveDays[Calendar.SUNDAY] = false; // true means to exclude
    inactiveDays[Calendar.MONDAY] = false;
    inactiveDays[Calendar.TUESDAY] = false;
    inactiveDays[Calendar.WEDNESDAY] = false;
    inactiveDays[Calendar.THURSDAY] = false;
    inactiveDays[Calendar.FRIDAY] = false;
    inactiveDays[Calendar.SATURDAY] = false;

    dayOfMonth = 1;

    allDay = true;

    startingHour = 8;
    startingMinute = endingMinute = 0;
    endingHour = 17;
}

From source file:TimeUtil.java

public static String dayStringFormat(long msecs) {
    GregorianCalendar cal = new GregorianCalendar();

    cal.setTime(new Date(msecs));

    int dow = cal.get(Calendar.DAY_OF_WEEK);

    switch (dow) {
    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";
    }//w ww . j  av a 2 s.c  o m

    return "Unknown";
}

From source file:org.exoplatform.addons.sdpDemo.populator.services.Utils.java

/**
 * Gets the day as int.//from   w  w  w.j  a  va2  s . co m
 *
 * @param day the day
 * @return the day as int
 */
public static int getDayAsInt(String day) {
    if ("monday".equals(day))
        return Calendar.MONDAY;
    else if ("tuesday".equals(day))
        return Calendar.TUESDAY;
    else if ("wednesday".equals(day))
        return Calendar.WEDNESDAY;
    else if ("thursday".equals(day))
        return Calendar.THURSDAY;
    else if ("friday".equals(day))
        return Calendar.FRIDAY;
    else if ("saturday".equals(day))
        return Calendar.SATURDAY;
    else if ("sunday".equals(day))
        return Calendar.SUNDAY;
    return Calendar.MONDAY;
}

From source file:com.binary_machinery.avalonschedule.view.schedule.SchedulePageFragment.java

@Nullable
@Override/*from w ww . j  a v  a  2s  . c  om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.schedule_page, container, false);
    Bundle arguments = getArguments();

    FragmentManager fragmentManager = getChildFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

    Func2<Integer, Integer, ?> setRecord = (dayOfWeek, layoutId) -> {
        String key = ARG_DAY + dayOfWeek;
        ScheduleRecord record = arguments.getParcelable(key);

        if (record != null) {
            Fragment fragment = (record.course != null) ? new RecordFragment() : new EmptyRecordFragment();
            Bundle args = new Bundle();
            args.putParcelable(RecordFragment.ARG_RECORD, record);
            fragment.setArguments(args);
            fragmentTransaction.replace(layoutId, fragment);
        }

        return 0;
    };

    setRecord.call(Calendar.MONDAY, R.id.layoutMonday);
    setRecord.call(Calendar.TUESDAY, R.id.layoutTuesday);
    setRecord.call(Calendar.WEDNESDAY, R.id.layoutWednesday);
    setRecord.call(Calendar.THURSDAY, R.id.layoutThursday);
    setRecord.call(Calendar.FRIDAY, R.id.layoutFriday);
    setRecord.call(Calendar.SATURDAY, R.id.layoutSaturday);
    setRecord.call(Calendar.SUNDAY, R.id.layoutSunday);

    fragmentTransaction.commit();
    return rootView;
}

From source file:org.kuali.student.r2.core.scheduling.util.SchedulingServiceUtil.java

/**
 * Converts a list of Calendar constants (i.e. Calendar.MONDAY, Calendar.FRIDAY) into a string of characters representing those days
 * Used in DTO/Entity translations for TimeSlot
 *
 * @param weekdaysList/* ww w. j  a  v a2s  .c  o m*/
 * @return
 */
public static String weekdaysList2WeekdaysString(List<Integer> weekdaysList) {
    StringBuilder result = new StringBuilder();

    for (Integer day : weekdaysList) {
        switch (day) {
        case Calendar.MONDAY: {
            result.append(SchedulingServiceConstants.MONDAY_TIMESLOT_DAY_CODE);
            break;
        }
        case Calendar.TUESDAY: {
            result.append(SchedulingServiceConstants.TUESDAY_TIMESLOT_DAY_CODE);
            break;
        }
        case Calendar.WEDNESDAY: {
            result.append(SchedulingServiceConstants.WEDNESDAY_TIMESLOT_DAY_CODE);
            break;
        }
        case Calendar.THURSDAY: {
            result.append(SchedulingServiceConstants.THURSDAY_TIMESLOT_DAY_CODE);
            break;
        }
        case Calendar.FRIDAY: {
            result.append(SchedulingServiceConstants.FRIDAY_TIMESLOT_DAY_CODE);
            break;
        }
        case Calendar.SATURDAY: {
            result.append(SchedulingServiceConstants.SATURDAY_TIMESLOT_DAY_CODE);
            break;
        }
        case Calendar.SUNDAY: {
            result.append(SchedulingServiceConstants.SUNDAY_TIMESLOT_DAY_CODE);
            break;
        }
        }
    }

    return result.toString();
}

From source file:calendar.services.transformers.EntryToWeekRowTransformer.java

private BigDecimal setEntryToDayInWeekRow(Entry entry, WeekRow weekRow) {
    Date date = entry.getDate();//from w  ww . j av a 2  s.co m
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    Integer dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
    BigDecimal entryHours = entry.getHours();
    switch (cal.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.SUNDAY:
        weekRow.setDay7Total(weekRow.getDay7Total().add(entryHours));
        weekRow.setDay7(entry.getDate());
        break;
    case Calendar.MONDAY:
        weekRow.setDay1Total(weekRow.getDay1Total().add(entryHours));
        weekRow.setDay1(entry.getDate());
        break;
    case Calendar.TUESDAY:
        weekRow.setDay2Total(weekRow.getDay2Total().add(entryHours));
        weekRow.setDay2(entry.getDate());
        break;
    case Calendar.WEDNESDAY:
        weekRow.setDay3Total(weekRow.getDay3Total().add(entryHours));
        weekRow.setDay3(entry.getDate());
        break;
    case Calendar.THURSDAY:
        weekRow.setDay4Total(weekRow.getDay4Total().add(entryHours));
        weekRow.setDay4(entry.getDate());
        break;
    case Calendar.FRIDAY:
        weekRow.setDay5Total(weekRow.getDay5Total().add(entryHours));
        weekRow.setDay5(entry.getDate());
        break;
    case Calendar.SATURDAY:
        weekRow.setDay6Total(weekRow.getDay6Total().add(entryHours));
        weekRow.setDay6(entry.getDate());
        break;

    }

    return entryHours;
}

From source file:com.karthikb351.vitinfo2.fragment.schedule.ScheduleFragment.java

private int getEquivalentDay(int day) {
    switch (day) {
    case Calendar.SUNDAY:
        day = 6;/* w w  w . j av  a2 s  .c o  m*/
        break;
    case Calendar.MONDAY:
    case Calendar.TUESDAY:
    case Calendar.WEDNESDAY:
    case Calendar.THURSDAY:
    case Calendar.FRIDAY:
    case Calendar.SATURDAY:
        day -= 2;
        break;
    default:
        day = 0;
    }
    return day;
}

From source file:JapaneseCalendar.java

public void paintComponent(Graphics g) {
    int width = 400;
    int height = 400;

    Calendar cal = Calendar.getInstance(locale);
    cal.setTime(new Date());

    String header = cal.getDisplayName(Calendar.MONTH, Calendar.LONG, locale);
    header += " " + cal.get(Calendar.YEAR);

    FontMetrics fm = g.getFontMetrics();
    Insets insets = getInsets();// w ww  . j av  a 2s  .c om
    g.setColor(Color.black);
    g.drawString(header, (width - fm.stringWidth(header)) / 2, insets.top + fm.getHeight());

    DateFormatSymbols dfs = new DateFormatSymbols(locale);
    String[] weekdayNames = dfs.getShortWeekdays();
    int fieldWidth = (width - insets.left - insets.right) / 7;
    g.drawString(weekdayNames[Calendar.SUNDAY],
            insets.left + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.SUNDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.MONDAY],
            insets.left + fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.MONDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.TUESDAY],
            insets.left + 2 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.TUESDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.WEDNESDAY],
            insets.left + 3 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.WEDNESDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.THURSDAY],
            insets.left + 4 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.THURSDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.FRIDAY],
            insets.left + 5 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.FRIDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.SATURDAY],
            insets.left + 6 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.SATURDAY])) / 2,
            insets.top + 3 * fm.getHeight());

    int dom = cal.get(Calendar.DAY_OF_MONTH);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    int col = 0;
    switch (cal.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        col = 1;
        break;

    case Calendar.TUESDAY:
        col = 2;
        break;

    case Calendar.WEDNESDAY:
        col = 3;
        break;

    case Calendar.THURSDAY:
        col = 4;
        break;

    case Calendar.FRIDAY:
        col = 5;
        break;

    case Calendar.SATURDAY:
        col = 6;
    }
    cal.set(Calendar.DAY_OF_MONTH, dom);

    int row = 5 * fm.getHeight();
    for (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
        g.drawString("" + i, insets.left + fieldWidth * col + (fieldWidth - fm.stringWidth("" + i)) / 2, row);
        if (++col > 6) {
            col = 0;
            row += fm.getHeight();
        }
    }
}

From source file:org.ohmage.reminders.types.time.TimeTrigDesc.java

private void initialize(boolean repeatStatus) {
    mIsRandomized = false;/*from   ww w  .j a v  a2 s . c om*/
    mIsRangeEnabled = false;

    mRepeatList.put(getDayOfWeekString(Calendar.SUNDAY), repeatStatus);
    mRepeatList.put(getDayOfWeekString(Calendar.MONDAY), repeatStatus);
    mRepeatList.put(getDayOfWeekString(Calendar.TUESDAY), repeatStatus);
    mRepeatList.put(getDayOfWeekString(Calendar.WEDNESDAY), repeatStatus);
    mRepeatList.put(getDayOfWeekString(Calendar.THURSDAY), repeatStatus);
    mRepeatList.put(getDayOfWeekString(Calendar.FRIDAY), repeatStatus);
    mRepeatList.put(getDayOfWeekString(Calendar.SATURDAY), repeatStatus);
}