當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。