当前位置: 首页>>代码示例>>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;未经允许,请勿转载。