From 847acd65b2793281c1c2d5e37645aedf1db721d5 Mon Sep 17 00:00:00 2001 From: Chip Kent Date: Wed, 10 Jan 2024 13:08:45 -0700 Subject: [PATCH] Spotless --- .../time/calendar/BusinessCalendar.java | 22 +++++++------- .../io/deephaven/time/calendar/Calendar.java | 13 ++++---- .../time/calendar/TestBusinessCalendar.java | 30 ++++++++++++++----- .../deephaven/time/calendar/TestCalendar.java | 6 ++-- 4 files changed, 45 insertions(+), 26 deletions(-) diff --git a/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java b/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java index 8dc8345145b..1fea411d9a3 100644 --- a/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java +++ b/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java @@ -165,7 +165,7 @@ private YearData getYearData(final int year) { // region Getters - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Returns the first valid date for the business calendar. * @@ -175,7 +175,7 @@ public LocalDate firstValidDate() { return firstValidDate; } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Returns the last valid date for the business calendar. * @@ -1222,8 +1222,9 @@ public String[] businessDates(final String start, final String end, final boolea return null; } - final LocalDate[] dates = businessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, - endInclusive); + final LocalDate[] dates = + businessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, + endInclusive); return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); } @@ -1366,8 +1367,9 @@ public String[] nonBusinessDates(final String start, final String end, final boo return null; } - final LocalDate[] dates = nonBusinessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, - endInclusive); + final LocalDate[] dates = + nonBusinessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, + endInclusive); return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); } @@ -2097,7 +2099,7 @@ public ZonedDateTime minusNonBusinessDays(final ZonedDateTime time, final int da return plusNonBusinessDays(time, -days); } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Adds a specified number of business days to the current date. Adding negative days is equivalent to subtracting * days. @@ -2115,7 +2117,7 @@ public LocalDate futureBusinessDate(final int days) { return plusBusinessDays(calendarDate(), days); } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Subtracts a specified number of business days from the current date. Subtracting negative days is equivalent to * adding days. @@ -2133,7 +2135,7 @@ public LocalDate pastBusinessDate(final int days) { return minusBusinessDays(calendarDate(), days); } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Adds a specified number of non-business days to the current date. Adding negative days is equivalent to * subtracting days. @@ -2151,7 +2153,7 @@ public LocalDate futureNonBusinessDate(final int days) { return this.plusNonBusinessDays(calendarDate(), days); } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Subtracts a specified number of non-business days to the current date. Subtracting negative days is equivalent to * adding days. diff --git a/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java b/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java index 95f675dae4c..5db32d450f5 100644 --- a/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java +++ b/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java @@ -90,7 +90,7 @@ public String toString() { // region Now - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * The current date for the calendar. * @@ -119,7 +119,7 @@ public DayOfWeek dayOfWeek(final LocalDate date) { return DateTimeUtils.dayOfWeek(date); } - //TODO: should this return a String? + // TODO: should this return a String? /** * The current day of the week for the calendar. * @@ -397,7 +397,7 @@ public ZonedDateTime minusDays(final ZonedDateTime time, final int days) { return plusDays(time, -days); } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Adds a specified number of days to the current date. Adding negative days is equivalent to subtracting days. * @@ -409,7 +409,7 @@ public LocalDate futureDate(final int days) { return plusDays(calendarDate(), days); } - //TODO: should there be a string equivalent? + // TODO: should there be a string equivalent? /** * Subtracts a specified number of days from the current date. Subtracting negative days is equivalent to adding * days. @@ -470,8 +470,9 @@ public String[] calendarDates(final String start, final String end, final boolea return null; } - final LocalDate[] dates = calendarDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, - endInclusive); + final LocalDate[] dates = + calendarDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, + endInclusive); return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); } diff --git a/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java b/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java index 779ec960f12..92da0b7eacf 100644 --- a/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java +++ b/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java @@ -644,14 +644,17 @@ public void testBusinessDates() { }; assertEquals(bus, bCalendar.businessDates(start, end)); - assertEquals(Arrays.stream(bus).map(DateTimeUtils::formatDate).toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString())); + assertEquals(Arrays.stream(bus).map(DateTimeUtils::formatDate).toArray(String[]::new), + bCalendar.businessDates(start.toString(), end.toString())); assertEquals(bus, bCalendar.businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone))); assertEquals(bus, bCalendar.businessDates(start.atTime(1, 24).atZone(timeZone).toInstant(), end.atTime(1, 24).atZone(timeZone).toInstant())); assertEquals(Arrays.copyOfRange(bus, 0, bus.length - 1), bCalendar.businessDates(start, end, true, false)); - assertEquals(Arrays.stream(Arrays.copyOfRange(bus, 0, bus.length - 1)).map(DateTimeUtils::formatDate).toArray(String[]::new), + assertEquals( + Arrays.stream(Arrays.copyOfRange(bus, 0, bus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString(), true, false)); assertEquals(Arrays.copyOfRange(bus, 0, bus.length - 1), bCalendar .businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), true, false)); @@ -660,7 +663,9 @@ public void testBusinessDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), true, false)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length), bCalendar.businessDates(start, end, false, true)); - assertEquals(Arrays.stream(Arrays.copyOfRange(bus, 1, bus.length)).map(DateTimeUtils::formatDate).toArray(String[]::new), + assertEquals( + Arrays.stream(Arrays.copyOfRange(bus, 1, bus.length)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString(), false, true)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length), bCalendar .businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, true)); @@ -669,7 +674,9 @@ public void testBusinessDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), false, true)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length - 1), bCalendar.businessDates(start, end, false, false)); - assertEquals(Arrays.stream(Arrays.copyOfRange(bus, 1, bus.length - 1)).map(DateTimeUtils::formatDate).toArray(String[]::new), + assertEquals( + Arrays.stream(Arrays.copyOfRange(bus, 1, bus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString(), false, false)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length - 1), bCalendar .businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, false)); @@ -779,7 +786,8 @@ public void testNonBusinessDates() { // }; assertEquals(nonBus, bCalendar.nonBusinessDates(start, end)); - assertEquals(Arrays.stream(nonBus).map(DateTimeUtils::formatDate).toArray(String[]::new), bCalendar.nonBusinessDates(start.toString(), end.toString())); + assertEquals(Arrays.stream(nonBus).map(DateTimeUtils::formatDate).toArray(String[]::new), + bCalendar.nonBusinessDates(start.toString(), end.toString())); assertEquals(nonBus, bCalendar.nonBusinessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone))); assertEquals(nonBus, bCalendar.nonBusinessDates(start.atTime(1, 24).atZone(timeZone).toInstant(), @@ -787,7 +795,9 @@ public void testNonBusinessDates() { assertEquals(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0], nonBus[nonBus.length - 1], true, false)); - assertEquals(Arrays.stream(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1)).map(DateTimeUtils::formatDate).toArray(String[]::new), + assertEquals( + Arrays.stream(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.nonBusinessDates(nonBus[0].toString(), nonBus[nonBus.length - 1].toString(), true, false)); assertEquals(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0].atTime(1, 24).atZone(timeZone), @@ -798,7 +808,9 @@ public void testNonBusinessDates() { assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length), bCalendar.nonBusinessDates(nonBus[0], nonBus[nonBus.length - 1], false, true)); - assertEquals(Arrays.stream(Arrays.copyOfRange(nonBus, 1, nonBus.length)).map(DateTimeUtils::formatDate).toArray(String[]::new), + assertEquals( + Arrays.stream(Arrays.copyOfRange(nonBus, 1, nonBus.length)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.nonBusinessDates(nonBus[0].toString(), nonBus[nonBus.length - 1].toString(), false, true)); assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length), bCalendar.nonBusinessDates(nonBus[0].atTime(1, 24).atZone(timeZone), @@ -809,7 +821,9 @@ public void testNonBusinessDates() { assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0], nonBus[nonBus.length - 1], false, false)); - assertEquals(Arrays.stream(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1)).map(DateTimeUtils::formatDate).toArray(String[]::new), + assertEquals( + Arrays.stream(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.nonBusinessDates(nonBus[0].toString(), nonBus[nonBus.length - 1].toString(), false, false)); assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0].atTime(1, 24).atZone(timeZone), diff --git a/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java b/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java index 680ec1c1bf0..892f23baed6 100644 --- a/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java +++ b/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java @@ -180,7 +180,8 @@ public void testCalendarDates() { final LocalDate end = LocalDate.of(2023, 2, 5); assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates(start, end)); - assertEquals(new String[] {start.toString(), middle.toString(), end.toString()}, calendar.calendarDates(start.toString(), end.toString())); + assertEquals(new String[] {start.toString(), middle.toString(), end.toString()}, + calendar.calendarDates(start.toString(), end.toString())); assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone))); assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates( @@ -205,7 +206,8 @@ public void testCalendarDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), false, true)); assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start, end, false, false)); - assertEquals(new String[] {middle.toString()}, calendar.calendarDates(start.toString(), end.toString(), false, false)); + assertEquals(new String[] {middle.toString()}, + calendar.calendarDates(start.toString(), end.toString(), false, false)); assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, false)); assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone).toInstant(),