Package io.deephaven.time.calendar
Class CalendarDay<T extends Comparable<T> & Temporal>
java.lang.Object
io.deephaven.time.calendar.CalendarDay<T>
- Type Parameters:
T
- time type
Schedule for a single calendar day. The schedule contains a list of business time ranges, which are the ranges of
time during which businesses are open.
A business day may contain multiple business time ranges. For example, some financial exchanges have a morning and an afternoon trading session. This would be represented by a business day with two business time ranges.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CalendarDay<LocalTime>
A holiday with no business time ranges. -
Method Summary
Modifier and TypeMethodDescriptionGets the length of the business day.businessDurationElapsed
(T time) Amount of business time that has elapsed on the given day by the specified time.businessDurationRemaining
(T time) Amount of business time that remains until the end of the day.End of the business day.long
Gets the length of the business day in nanoseconds.long
businessNanosElapsed
(T time) Amount of business time in nanoseconds that has elapsed on the given day by the specified time.long
businessNanosRemaining
(T time) Amount of business time in nanoseconds that remains until the end of the day.Start of the business day.Business time ranges for the day.boolean
int
hashCode()
boolean
Is this day a business day? A business day is a day that contains at least some business time.boolean
isBusinessTime
(T time) Determines if the specified time is a business time for the day.boolean
Is the end of the business day inclusive? Equivalent to the end of the last business time range.static CalendarDay<Instant>
toInstant
(CalendarDay<LocalTime> s, LocalDate date, ZoneId timeZone) Converts a business schedule in local time to a specific date and time zone.toString()
-
Field Details
-
HOLIDAY
A holiday with no business time ranges.
-
-
Method Details
-
businessTimeRanges
Business time ranges for the day.- Returns:
- business time ranges for the day
-
businessStart
Start of the business day. Equivalent to the start of the first business time range.- Returns:
- start of the business day, or
null
for a holiday schedule
-
businessEnd
End of the business day. Equivalent to the end of the last business time range.- Returns:
- end of the business day, or
null
for a holiday schedule
-
isInclusiveEnd
public boolean isInclusiveEnd()Is the end of the business day inclusive? Equivalent to the end of the last business time range.- Returns:
- is the end of the business day inclusive?
-
businessNanos
public long businessNanos()Gets the length of the business day in nanoseconds. If the business day has multiple business time ranges, only the time during the ranges is counted.- Returns:
- length of the day in nanoseconds
-
businessDuration
Gets the length of the business day. If the business day has multiple business time ranges, only the time during the ranges is counted.- Returns:
- length of the day
-
businessNanosElapsed
Amount of business time in nanoseconds that has elapsed on the given day by the specified time.- Parameters:
time
- time- Returns:
- business time in nanoseconds that has elapsed on the given day by the specified time, or
QueryConstants.NULL_LONG
if the input isnull
.
-
businessDurationElapsed
Amount of business time that has elapsed on the given day by the specified time.- Parameters:
time
- time- Returns:
- business time that has elapsed on the given day by the specified time, or
null
if the input isnull
.
-
businessNanosRemaining
Amount of business time in nanoseconds that remains until the end of the day.- Parameters:
time
- time- Returns:
- business time in nanoseconds that remains until the end of the day, or
QueryConstants.NULL_LONG
if the input isnull
.
-
businessDurationRemaining
Amount of business time that remains until the end of the day.- Parameters:
time
- time- Returns:
- business time that remains until the end of the day, or
null
if the input isnull
.
-
isBusinessDay
public boolean isBusinessDay()Is this day a business day? A business day is a day that contains at least some business time.- Returns:
- true if it is a business day; false otherwise.
-
isBusinessTime
Determines if the specified time is a business time for the day.- Parameters:
time
- time.- Returns:
- true if the time is a business time for the day; otherwise, false. If the input is
null
, returns false.
-
equals
-
hashCode
public int hashCode() -
toString
-
toInstant
public static CalendarDay<Instant> toInstant(CalendarDay<LocalTime> s, LocalDate date, ZoneId timeZone) Converts a business schedule in local time to a specific date and time zone.- Parameters:
s
- business schedule in local timedate
- date for the new business scheduletimeZone
- time zone for the new business schedule- Returns:
- new business schedule in the specified date and time zone
-