当前位置: 首页>>代码示例>>Java>>正文


Java DayOfWeek.MONDAY属性代码示例

本文整理汇总了Java中java.time.DayOfWeek.MONDAY属性的典型用法代码示例。如果您正苦于以下问题:Java DayOfWeek.MONDAY属性的具体用法?Java DayOfWeek.MONDAY怎么用?Java DayOfWeek.MONDAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.time.DayOfWeek的用法示例。


在下文中一共展示了DayOfWeek.MONDAY属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: data_week

@DataProvider(name="IsoWeekData")
Object[][] data_week() {
    return new Object[][] {
            {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970},
            {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012},
            {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012},
            {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012},
            {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012},
            {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012},
            {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012},
            {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013},
            {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013},
            {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:TCKWeekFields.java

示例2: testRangeOfLocalDates

@Test(dataProvider = "LocalDateRanges")
public void testRangeOfLocalDates(LocalDate start, LocalDate end, Period step, boolean parallel) {
    final boolean ascend = start.isBefore(end);
    final Range<LocalDate> range = Range.of(start, end, step, v -> v.getDayOfWeek() == DayOfWeek.MONDAY);
    final Array<LocalDate> array = range.toArray(parallel);
    final LocalDate first = array.first(v -> true).map(ArrayValue::getValue).get();
    final LocalDate last = array.last(v -> true).map(ArrayValue::getValue).get();
    Assert.assertEquals(array.typeCode(), ArrayType.LOCAL_DATE);
    Assert.assertTrue(!array.style().isSparse());
    Assert.assertEquals(range.start(), start, "The range start");
    Assert.assertEquals(range.end(), end, "The range end");
    int index = 0;
    LocalDate value = first;
    while (ascend ? value.isBefore(last) : value.isAfter(last)) {
        final LocalDate actual = array.getValue(index);
        Assert.assertEquals(actual, value, "Value matches at " + index);
        Assert.assertTrue(ascend ? actual.compareTo(start) >= 0 && actual.isBefore(end) : actual.compareTo(start) <= 0 && actual.isAfter(end), "Value in bounds at " + index);
        value = ascend ? value.plus(step) : value.minus(step);
        while (value.getDayOfWeek() == DayOfWeek.MONDAY) value = ascend ? value.plus(step) : value.minus(step);
        index++;
    }
}
 
开发者ID:zavtech,项目名称:morpheus-core,代码行数:22,代码来源:RangeFilterTests.java

示例3: it_filters_the_hours_for_a_given_day

@Test
public void it_filters_the_hours_for_a_given_day() {
    DayOfWeek monday = DayOfWeek.MONDAY;
    LinkedHashMap<DayOfWeek, List<Hours>> hours = new LinkedHashMap<>();
    Hours mondayHours = new Hours(
        DayOfWeek.MONDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
    );
    hours.put(monday, Arrays.asList(mondayHours));
    hours.put(
        DayOfWeek.TUESDAY,
        Arrays.asList(new Hours(
            DayOfWeek.TUESDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    hours.put(
        DayOfWeek.WEDNESDAY,
        Arrays.asList(new Hours(
            DayOfWeek.WEDNESDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    hours.put(
        DayOfWeek.THURSDAY,
        Arrays.asList(new Hours(
            DayOfWeek.THURSDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    hours.put(
        DayOfWeek.FRIDAY,
        Arrays.asList(new Hours(
            DayOfWeek.FRIDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    Schedule schedule = new Schedule(true, hours);

    List<Hours> onlyMondayHours = schedule.hoursFor(monday);

    assertThat(onlyMondayHours.size(), is(1));
    assertThat(onlyMondayHours.get(0).equals(mondayHours), is(true));
}
 
开发者ID:MontealegreLuis,项目名称:yelpv3-java-client,代码行数:39,代码来源:ScheduleTest.java

示例4: of

/**
 * Obtains an instance of {@code WeekDefinition} appropriate for a locale.
 * <p>
 * This will look up appropriate values from the provider of localization data.
 * 
 * @param locale the locale to use, not null
 * @return the week-definition, not null
 */
public static WeekDefinition of(Locale locale) {

  Jdk7Methods.Objects_requireNonNull(locale, "locale");
  DayOfWeek dow = DayOfWeek.MONDAY;
  if ("US".equals(locale.getCountry())) {
    dow = DayOfWeek.SUNDAY;
  }
  int minDays = 4; // ISO-08601 // gcal.getMinimalDaysInFirstWeek();
  return WeekDefinition.of(dow, minDays);
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:18,代码来源:WeekDefinition.java

示例5: test_getDayOfWeek

@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,代码行数:13,代码来源:TCKLocalDateTime.java

示例6: test_getDayOfWeek

@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,代码行数:12,代码来源:TCKLocalDate.java

示例7: providerDayOfWeekData

@DataProvider(name="parseDayOfWeekText")
Object[][] providerDayOfWeekData() {
    return new Object[][] {
        // Locale, pattern, input text, expected DayOfWeek
        {Locale.US, "e",  "1",  DayOfWeek.SUNDAY},
        {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
        {Locale.US, "c",  "1",  DayOfWeek.SUNDAY},

        {Locale.UK, "e",  "1",  DayOfWeek.MONDAY},
        {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
        {Locale.UK, "c",  "1",  DayOfWeek.MONDAY},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TestTextParser.java

示例8: providerDayOfWeekData

@DataProvider(name="print_DayOfWeekData")
Object[][] providerDayOfWeekData() {
    return new Object[][] {
        // Locale, pattern, expected text, input DayOfWeek
        {Locale.US, "e",  "1",  DayOfWeek.SUNDAY},
        {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
        {Locale.US, "c",  "1",  DayOfWeek.SUNDAY},

        {Locale.UK, "e",  "1",  DayOfWeek.MONDAY},
        {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
        {Locale.UK, "c",  "1",  DayOfWeek.MONDAY},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TestTextPrinter.java

示例9: it_filters_schedules_with_more_than_one_hour_per_day

@Test
public void it_filters_schedules_with_more_than_one_hour_per_day() {
    DayOfWeek monday = DayOfWeek.MONDAY;
    Hours morningMondayHours = new Hours(
        DayOfWeek.MONDAY, LocalTime.of(8, 0), LocalTime.of(12, 0)
    );
    Hours eveningMondayHours = new Hours(
        DayOfWeek.MONDAY, LocalTime.of(16, 0), LocalTime.of(20, 0)
    );
    LinkedHashMap<DayOfWeek, List<Hours>> hours = new LinkedHashMap<>();
    hours.put(monday, Arrays.asList(morningMondayHours, eveningMondayHours));
    hours.put(
        DayOfWeek.TUESDAY,
        Arrays.asList(new Hours(
            DayOfWeek.TUESDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    hours.put(
        DayOfWeek.WEDNESDAY,
        Arrays.asList(new Hours(
            DayOfWeek.WEDNESDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    hours.put(
        DayOfWeek.THURSDAY,
        Arrays.asList(new Hours(
            DayOfWeek.THURSDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    hours.put(
        DayOfWeek.FRIDAY,
        Arrays.asList(new Hours(
            DayOfWeek.FRIDAY, LocalTime.of(8, 0), LocalTime.of(16, 0)
        ))
    );
    Schedule schedule = new Schedule(true, hours);

    List<Hours> onlyMondayHours = schedule.hoursFor(monday);

    assertThat(onlyMondayHours.size(), is(2));
    assertThat(onlyMondayHours.get(0).equals(morningMondayHours), is(true));
    assertThat(onlyMondayHours.get(1).equals(eveningMondayHours), is(true));
}
 
开发者ID:MontealegreLuis,项目名称:yelpv3-java-client,代码行数:43,代码来源:ScheduleTest.java

示例10: setup

@Before
public void setup() {

    // Create shifts
    Shift shift0 = new Shift(0, DayOfWeek.MONDAY, LocalTime.of(16, 45), LocalTime.of(19, 45));
    Shift shift1 = new Shift(1, DayOfWeek.TUESDAY, LocalTime.of(18, 0), LocalTime.of(21, 0));
    Shift shift2 = new Shift(2, DayOfWeek.WEDNESDAY, LocalTime.of(19, 0), LocalTime.of(21, 0));
    Shift shift3 = new Shift(3, DayOfWeek.THURSDAY, LocalTime.of(18, 30), LocalTime.of(21, 30));
    Shift shift4 = new Shift(4, DayOfWeek.FRIDAY, LocalTime.of(17, 15), LocalTime.of(20, 45));
    this.shifts.add(shift0);
    this.shifts.add(shift1);
    this.shifts.add(shift2);
    this.shifts.add(shift3);
    this.shifts.add(shift4);

    // Required shifts for courses
    Set<Shift> shiftSet0 = new HashSet<>();
    shiftSet0.add(shift0);
    Set<Shift> shiftSet1 = new HashSet<>();
    shiftSet1.add(shift1);
    shiftSet1.add(shift4);
    Set<Shift> shiftSet2 = new HashSet<>();
    shiftSet2.add(shift1);
    shiftSet2.add(shift2);
    shiftSet2.add(shift3);
    Set<Shift> shiftSet3 = new HashSet<>();
    shiftSet3.add(shift0);
    shiftSet3.add(shift2);
    shiftSet3.add(shift3);
    shiftSet3.add(shift4);

    // Create courses
    Course course0 = new Course(0, "CS 301", new CourseRequirements(shiftSet1, 1, 3, CourseIntensity.MEDIUM, null, 0));
    Course course1 = new Course(1, "CS 302", new CourseRequirements(shiftSet2, 2, 2, CourseIntensity.HIGH, null, 0));
    Course course2 = new Course(2, "CS 577", new CourseRequirements(shiftSet0, 1, 2, CourseIntensity.LOW, null, 0));
    Course course3 = new Course(3, "EMA 201", new CourseRequirements(shiftSet3, 4, 4, CourseIntensity.HIGH, null, 0));
    Course course4 = new Course(4, "ECE 210", new CourseRequirements(shiftSet0, 1, 1, CourseIntensity.LOW, null, 0));
    this.courses.add(course0);
    this.courses.add(course1);
    this.courses.add(course2);
    this.courses.add(course3);
    this.courses.add(course4);
}
 
开发者ID:cocolocomoco21,项目名称:ULCRS,代码行数:43,代码来源:TutorTest.java

示例11: data_format_withZone_withChronology

@DataProvider(name="formatWithZoneWithChronology")
Object[][] data_format_withZone_withChronology() {
    YearMonth ym = YearMonth.of(2008, 6);
    LocalDate ld = LocalDate.of(2008, 6, 30);
    LocalTime lt = LocalTime.of(11, 30);
    LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 11, 30);
    OffsetTime ot = OffsetTime.of(LocalTime.of(11, 30), OFFSET_PONE);
    OffsetDateTime odt = OffsetDateTime.of(LocalDateTime.of(2008, 6, 30, 11, 30), OFFSET_PONE);
    ZonedDateTime zdt = ZonedDateTime.of(LocalDateTime.of(2008, 6, 30, 11, 30), ZONE_PARIS);
    ChronoZonedDateTime<ThaiBuddhistDate> thaiZdt = ThaiBuddhistChronology.INSTANCE.zonedDateTime(zdt);
    Instant instant = Instant.ofEpochSecond(3600);
    return new Object[][] {
            {null, null, DayOfWeek.MONDAY, "::::"},
            {null, null, ym, "2008::::ISO"},
            {null, null, ld, "2008::::ISO"},
            {null, null, lt, ":11:::"},
            {null, null, ldt, "2008:11:::ISO"},
            {null, null, ot, ":11:+01:00::"},
            {null, null, odt, "2008:11:+01:00::ISO"},
            {null, null, zdt, "2008:11:+02:00:Europe/Paris:ISO"},
            {null, null, instant, "::::"},

            {IsoChronology.INSTANCE, null, DayOfWeek.MONDAY, "::::ISO"},
            {IsoChronology.INSTANCE, null, ym, "2008::::ISO"},
            {IsoChronology.INSTANCE, null, ld, "2008::::ISO"},
            {IsoChronology.INSTANCE, null, lt, ":11:::ISO"},
            {IsoChronology.INSTANCE, null, ldt, "2008:11:::ISO"},
            {IsoChronology.INSTANCE, null, ot, ":11:+01:00::ISO"},
            {IsoChronology.INSTANCE, null, odt, "2008:11:+01:00::ISO"},
            {IsoChronology.INSTANCE, null, zdt, "2008:11:+02:00:Europe/Paris:ISO"},
            {IsoChronology.INSTANCE, null, instant, "::::ISO"},

            {null, ZONE_PARIS, DayOfWeek.MONDAY, ":::Europe/Paris:"},
            {null, ZONE_PARIS, ym, "2008:::Europe/Paris:ISO"},
            {null, ZONE_PARIS, ld, "2008:::Europe/Paris:ISO"},
            {null, ZONE_PARIS, lt, ":11::Europe/Paris:"},
            {null, ZONE_PARIS, ldt, "2008:11::Europe/Paris:ISO"},
            {null, ZONE_PARIS, ot, ":11:+01:00:Europe/Paris:"},
            {null, ZONE_PARIS, odt, "2008:12:+02:00:Europe/Paris:ISO"},
            {null, ZONE_PARIS, zdt, "2008:11:+02:00:Europe/Paris:ISO"},
            {null, ZONE_PARIS, instant, "1970:02:+01:00:Europe/Paris:ISO"},

            {null, OFFSET_PTHREE, DayOfWeek.MONDAY, ":::+03:00:"},
            {null, OFFSET_PTHREE, ym, "2008:::+03:00:ISO"},
            {null, OFFSET_PTHREE, ld, "2008:::+03:00:ISO"},
            {null, OFFSET_PTHREE, lt, ":11::+03:00:"},
            {null, OFFSET_PTHREE, ldt, "2008:11::+03:00:ISO"},
            {null, OFFSET_PTHREE, ot, null},  // offset and zone clash
            {null, OFFSET_PTHREE, odt, "2008:13:+03:00:+03:00:ISO"},
            {null, OFFSET_PTHREE, zdt, "2008:12:+03:00:+03:00:ISO"},
            {null, OFFSET_PTHREE, instant, "1970:04:+03:00:+03:00:ISO"},

            {ThaiBuddhistChronology.INSTANCE, null, DayOfWeek.MONDAY, null},  // not a complete date
            {ThaiBuddhistChronology.INSTANCE, null, ym, null},  // not a complete date
            {ThaiBuddhistChronology.INSTANCE, null, ld, "2551::::ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, null, lt, ":11:::ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, null, ldt, "2551:11:::ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, null, ot, ":11:+01:00::ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, null, odt, "2551:11:+01:00::ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, null, zdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, null, instant, "::::ThaiBuddhist"},

            {ThaiBuddhistChronology.INSTANCE, null, DayOfWeek.MONDAY, null},  // not a complete date
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ym, null},  // not a complete date
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ld, "2551:::Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, lt, ":11::Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ldt, "2551:11::Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ot, ":11:+01:00:Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, odt, "2551:12:+02:00:Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, zdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, instant, "2513:02:+01:00:Europe/Paris:ThaiBuddhist"},

            {null, ZONE_PARIS, thaiZdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
            {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, thaiZdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
            {IsoChronology.INSTANCE, ZONE_PARIS, thaiZdt, "2008:11:+02:00:Europe/Paris:ISO"},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:77,代码来源:TCKDateTimeFormatter.java


注:本文中的java.time.DayOfWeek.MONDAY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。