TimeWindow.Companion
Keywords: net.corda.core.contracts.TimeWindow.Companion class
Date: 2023-09-18

net.corda.core.contracts

## Class TimeWindow.Companion

- net.corda.core.contracts.TimeWindow.Companion

- Enclosing class:
    TimeWindow

      public static class TimeWindow.Companion

- - ### Method Detail

    - #### fromOnly

          @JvmStatic
           @NotNull
          public TimeWindow fromOnly(@NotNull
                                                          java.time.Instant fromTime)

      Creates a `class TimeWindow` with null `untilTime`, i.e. the time interval `[fromTime, ∞)`. `midpoint` will return null.

      See Also:
        `class TimeWindow`, `untilTime`, `midpoint`

    - #### untilOnly

          @JvmStatic
           @NotNull
          public TimeWindow untilOnly(@NotNull
                                                           java.time.Instant untilTime)

      Creates a `class TimeWindow` with null `fromTime`, i.e. the time interval `(∞, untilTime)`. `midpoint` will return null.

      See Also:
        `class TimeWindow`, `fromTime`, `midpoint`

    - #### between

          @JvmStatic
           @NotNull
          public TimeWindow between(@NotNull
                                                         java.time.Instant fromTime,
                                                         @NotNull
                                                         java.time.Instant untilTime)

      Creates a `class TimeWindow` with the time interval `[fromTime, untilTime)`. `midpoint` will return `fromTime + (untilTime - fromTime) / 2`.

      Throws:
        `IllegalArgumentException` - If `fromTime` ≥ `untilTime`
      See Also:
        `class TimeWindow`, `midpoint`

    - #### fromStartAndDuration

          @JvmStatic
           @NotNull
          public TimeWindow fromStartAndDuration(@NotNull
                                                                      java.time.Instant fromTime,
                                                                      @NotNull
                                                                      java.time.Duration duration)

      Creates a `class TimeWindow` with the time interval `[fromTime, fromTime + duration)`. `midpoint` will return `fromTime + duration / 2`

      See Also:
        `class TimeWindow`, `midpoint`

    - #### withTolerance

          @JvmStatic
           @NotNull
          public TimeWindow withTolerance(@NotNull
                                                               java.time.Instant instant,
                                                               @NotNull
                                                               java.time.Duration tolerance)

      Creates a `class TimeWindow` which is centered around `instant` with the given `tolerance` on both sides, i.e the time interval `[instant - tolerance, instant + tolerance)`. `midpoint` will return `instant`.

      See Also:
        `class TimeWindow`, `instant`, `tolerance`, `midpoint`, `instant`