ash_model.IntervalPresenceStore

class ash_model.IntervalPresenceStore[source]

Sparse interval representation.

Internally we keep:

_intervals – mapping id List[(start, end)] (sorted, disjoint). _starts – mapping id List[start] (parallel to intervals, for bisect). _time_events – difference array time delta for O(1) interval updates. _time_counts – rebuilt lazily from _time_events when needed.

Optimizations: - Binary search (bisect) for presence checks: O(log k) per id. - Event-diff updates: O(1) per interval add/remove (vs O(length)).

__init__()[source]

Methods

__init__()

get(t, default)

Dict‑style get.

keys()

Return iterable of snapshot indices.

setdefault(t, default)

Return mutable view for snapshot t (creates if absent).

setdefault(t, default)[source]

Return mutable view for snapshot t (creates if absent).

Parameters:
get(t, default)[source]

Dict‑style get.

Parameters:

t (int) –

keys()[source]

Return iterable of snapshot indices.

Return type:

Iterable[int]