當前位置: 首頁>>代碼示例>>Java>>正文


Java DayOfWeek.plus方法代碼示例

本文整理匯總了Java中java.time.DayOfWeek.plus方法的典型用法代碼示例。如果您正苦於以下問題:Java DayOfWeek.plus方法的具體用法?Java DayOfWeek.plus怎麽用?Java DayOfWeek.plus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.DayOfWeek的用法示例。


在下文中一共展示了DayOfWeek.plus方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testOnGetLongDayOfWeek

import java.time.DayOfWeek; //導入方法依賴的package包/類
@Test
public void testOnGetLongDayOfWeek() {
    PersianDate pd = PersianDate.of(1387, 12, 30);
    DayOfWeek dow = DayOfWeek.FRIDAY;
    // Check about three years
    for (int i = 0; i < 1000; i++) {
        assertEquals(dow.getValue(), pd.getLong(DAY_OF_WEEK));
        pd = pd.plusDays(1);
        dow = dow.plus(1);
    }
}
 
開發者ID:mfathi91,項目名稱:persian-date-time,代碼行數:12,代碼來源:PersianDateTest.java

示例2: test_getDayOfWeek

import java.time.DayOfWeek; //導入方法依賴的package包/類
@Test
public void test_getDayOfWeek() {
    DayOfWeek dow = DayOfWeek.MONDAY;
    for (Month month : Month.values()) {
        int length = month.length(false);
        for (int i = 1; i <= length; i++) {
            LocalDateTime d = LocalDateTime.of(LocalDate.of(2007, month, i),
                    TEST_2007_07_15_12_30_40_987654321.toLocalTime());
            assertSame(d.getDayOfWeek(), dow);
            dow = dow.plus(1);
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:14,代碼來源:TCKLocalDateTime.java

示例3: test_getDayOfWeek

import java.time.DayOfWeek; //導入方法依賴的package包/類
@Test
public void test_getDayOfWeek() {
    DayOfWeek dow = DayOfWeek.MONDAY;
    for (Month month : Month.values()) {
        int length = month.length(false);
        for (int i = 1; i <= length; i++) {
            LocalDate d = LocalDate.of(2007, month, i);
            assertSame(d.getDayOfWeek(), dow);
            dow = dow.plus(1);
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:13,代碼來源:TCKLocalDate.java

示例4: updateView

import java.time.DayOfWeek; //導入方法依賴的package包/類
private void updateView() {
    controlsMap.clear();

    MonthView view = getSkinnable();
    gridPane.getChildren().clear();

    displayedYearMonth = view.getYearMonth();

    WeekFields weekFields = view.getWeekFields();
    DayOfWeek dayOfWeek = weekFields.getFirstDayOfWeek();

    if (view.isShowWeekdays()) {
        for (int i = 0; i < 7; i++) {
            Label dayOfWeekLabel = new Label(dayOfWeek.getDisplayName(TextStyle.SHORT_STANDALONE, Locale.getDefault()));
            dayOfWeekLabel.setAlignment(Pos.CENTER_RIGHT);
            dayOfWeekLabel.setMaxSize(MAX_VALUE, MAX_VALUE);
            dayOfWeekLabel.getStyleClass().add(DAY_OF_WEEK_LABEL);

            if (view.isShowWeekends() && view.getWeekendDays().contains(dayOfWeek)) {
                dayOfWeekLabel.getStyleClass().add(DAY_OF_WEEKEND_LABEL);
            }

            GridPane.setHgrow(dayOfWeekLabel, ALWAYS);
            gridPane.add(dayOfWeekLabel, i, 0);
            dayOfWeek = dayOfWeek.plus(1);
        }
    }

    LocalDate date = view.getDate().with(TemporalAdjusters.firstDayOfMonth());

    date = Util.adjustToFirstDayOfWeek(date, getSkinnable().getFirstDayOfWeek());

    for (int week = 0; week < 6; week++) {
        for (int day = 0; day < 7; day++) {
            // TODO: this should be done via a factory (cell factory already defined on MonthViewBase
            MonthDayView dayOfMonthLabel = new MonthDayView(date, week, day);
            controlsMap.put(date, dayOfMonthLabel);
            GridPane.setHgrow(dayOfMonthLabel, ALWAYS);
            GridPane.setVgrow(dayOfMonthLabel, ALWAYS);
            gridPane.add(dayOfMonthLabel, day, week + 1);
            date = date.plusDays(1);
        }
    }

    updateDaySelection();
    updateEntries("view was updated after a view property change");
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:48,代碼來源:MonthViewSkin.java


注:本文中的java.time.DayOfWeek.plus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。