Class TimeRange

java.lang.Object
cloud.opencode.base.date.range.TimeRange

@Deprecated(since="1.0.0", forRemoval=false) public final class TimeRange extends Object
Deprecated.
Use LocalTimeRange instead
TimeRange - Compatibility wrapper for LocalTimeRange 时间范围 - LocalTimeRange的兼容性包装器

This class provides a compatibility layer for the extra.LocalTimeRange class, offering the same functionality with a simpler name for legacy code compatibility.

此类为extra.LocalTimeRange类提供兼容层,使用更简单的名称以兼容遗留代码。

Features | 主要功能:

  • Compatibility wrapper for LocalTimeRange - LocalTimeRange的兼容性包装器
  • Containment and overlap checking - 包含和重叠检查
  • Duration calculation - 持续时间计算
  • Intersection and span operations - 交集和跨度操作

Usage Examples | 使用示例:

TimeRange range = TimeRange.of(LocalTime.of(9, 0), LocalTime.of(17, 0));
Duration duration = range.toDuration();
boolean contains = range.contains(LocalTime.of(12, 0));

Security | 安全性:

  • Thread-safe: Yes (immutable, delegates to immutable LocalTimeRange) - 线程安全: 是(不可变,委托给不可变的LocalTimeRange)
  • Null-safe: No (delegates null handling to LocalTimeRange) - 空值安全: 否(空值处理委托给LocalTimeRange)
Since:
JDK 25, opencode-base-date V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • of

      public static TimeRange of(LocalTime start, LocalTime end)
      Deprecated.
      Creates a TimeRange 创建时间范围
      Parameters:
      start - the start time | 起始时间
      end - the end time | 结束时间
      Returns:
      the TimeRange | 时间范围
    • businessHours

      public static TimeRange businessHours()
      Deprecated.
      Creates a TimeRange for business hours (9:00 - 17:00) 创建工作时间范围(9:00 - 17:00)
      Returns:
      the business hours TimeRange | 工作时间范围
    • from

      public static TimeRange from(LocalTimeRange range)
      Deprecated.
      Creates a TimeRange from a LocalTimeRange 从LocalTimeRange创建TimeRange
      Parameters:
      range - the LocalTimeRange | LocalTimeRange
      Returns:
      the TimeRange | 时间范围
    • getStart

      public LocalTime getStart()
      Deprecated.
    • getEnd

      public LocalTime getEnd()
      Deprecated.
    • toDuration

      public Duration toDuration()
      Deprecated.
    • isEmpty

      public boolean isEmpty()
      Deprecated.
    • contains

      public boolean contains(LocalTime time)
      Deprecated.
    • overlaps

      public boolean overlaps(TimeRange other)
      Deprecated.
    • encloses

      public boolean encloses(TimeRange other)
      Deprecated.
    • intersection

      public Optional<TimeRange> intersection(TimeRange other)
      Deprecated.
    • span

      public TimeRange span(TimeRange other)
      Deprecated.
    • toLocalTimeRange

      public LocalTimeRange toLocalTimeRange()
      Deprecated.
      Converts to LocalTimeRange 转换为LocalTimeRange
      Returns:
      the LocalTimeRange | LocalTimeRange
    • equals

      public boolean equals(Object obj)
      Deprecated.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Deprecated.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object