Time window

A state to represent a window with fixed time capacity.

Every value pushed onto the state has an associated time, and time is taken to be strictly increasing. The window is taken to be fixed in terms of time duration rather than a fixed number of values.

AssociativeWindowAggregation.TimeWindowAssociativeOpType
TimeWindowAssociativeOp{Value, Time, TimeDiff}

State necessary for accumulation over a rolling window of fixed size, in terms of time.

When presented with a new time t', we guarantee that all times t remaining in the window satisfy:

t > t' - w

That is, at time t' this window represents the open-closed time interval (t' - w, t']

Fields

  • window_state::WindowedAssociativeOp{Value}: The underlying general-window state.
  • window::TimeDiff: The window, as a difference between two times.
  • times::Deque{Time}: The same length as the values stored in window_state, and representing the times of those observations.
  • window_full::Bool: For internal use - will be set to true once a point has dropped out of the window.
AssociativeWindowAggregation.update_state!Method
update_state!(
    state::TimeWindowAssociativeOp{Value,Time,TimeDiff},
    time,
    value
)::TimeWindowAssociativeOp{Value,Time,TimeDiff} where {Value,Time,TimeDiff}

Add the specified value to the state with associated time, and drop any values that are no longer in the time window.

Arguments

  • state::TimeWindowAssociativeOp{Value,Time,TimeDiff}:
  • time: The time to which value corresponds.
  • value: The value to add to the window.

Returns

  • ::TimeWindowAssociativeOp{Value,Time,TimeDiff}: state, which has been mutated.
AssociativeWindowAggregation.window_fullMethod
window_full(state::TimeWindowAssociativeOp)::Bool

Returns true iff the given state has had at least one value drop out of the window, indicating that the window is now full.