module VirtualTime::Search

Overview

Search provides monotonic, DST-safe, policy-free temporal traversal suitable for scheduling. Stateless. Not related to other methods above. Advances by at least 1 step before evaluation.

Defined in:

virtualtime.cr

Class Method Summary

Class Method Detail

def self.is_shifted_from_base?(target : Time, step : Time::Span, *, max_shift : Time::Span | Nil = nil, max_shifts : Int32, &producer : Time -> Time::Span | Nil) : Bool #

Inverse reachability check: determine backwards whether target can be obtained as base + delta, stepping by step. Returns bool value.

Notes:

  • successor-based: first base is target - step
  • max_shift bounds the produced delta (inclusive)
  • max_shifts bounds number of step applications (inclusive)
  • stepping is done on Time values (DST-safe)

[View source]
def self.shift_from_base(base : Time, step : Time::Span, *, domain : Domain | Nil = nil, max_shift : Time::Span | Nil = nil, max_shifts : Int32 | Nil = nil, &blocked : Time -> Bool) : Result::Result #

Moves forward from base by repeated application of step (successor behavior: first candidate is base + step).

Returns:

  • Time::Span delta to the first unblocked candidate
  • false if bounds are exceeded

Notes:

  • step must be non-zero
  • max_shift bounds the returned delta (inclusive)
  • max_shifts bounds the number of step applications (inclusive)
  • stepping is done on Time values (DST-safe)

[View source]