Interface IWindowAccumulator
- All Known Implementing Classes:
ConsecutiveWindowAccumulator,WindowAccumulator
public interface IWindowAccumulator
The
IWindowAccumulator interface defines the operations for
accumulating statistical elements over a window of time. It allows for the
addition of elements with associated times and values, and provides methods
to query the sum, average, maximum, and minimum of the elements within a
specified time frame.- Author:
- Andrey Malykhanov
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double time, double value) Adds a new statistical element to the accumulator.voidclear()Clears all the data from the accumulator.doubleget(double time) Returns the sum of elements in the accumulator whose time of addition does not exceed the specified time.default doublegetAvg(double time) Returns the average value among all elements in the accumulator whose time of addition does not exceed the specified time.default doublegetMax(double time) Returns the maximum value among all elements in the accumulator whose time of addition does not exceed the specified time.default doublegetMin(double time) Returns the minimum value among all elements in the accumulator whose time of addition does not exceed the specified time.
-
Method Details
-
add
void add(double time, double value) Adds a new statistical element to the accumulator.- Parameters:
time- The time associated with the statistical element.value- The value of the statistical element.
-
get
double get(double time) Returns the sum of elements in the accumulator whose time of addition does not exceed the specified time.- Parameters:
time- The maximum time up to which values are accumulated.- Returns:
- The sum of elements added to the accumulator up to the specified time.
-
clear
void clear()Clears all the data from the accumulator. -
getAvg
default double getAvg(double time) Returns the average value among all elements in the accumulator whose time of addition does not exceed the specified time.- Parameters:
time- The maximum time up to which values are considered for averaging.- Returns:
- The average value of elements up to the specified time.
-
getMax
default double getMax(double time) Returns the maximum value among all elements in the accumulator whose time of addition does not exceed the specified time.- Parameters:
time- The maximum time up to which values are considered for finding the maximum.- Returns:
- The maximum value of elements up to the specified time.
-
getMin
default double getMin(double time) Returns the minimum value among all elements in the accumulator whose time of addition does not exceed the specified time.- Parameters:
time- The maximum time up to which values are considered for finding the minimum.- Returns:
- The minimum value of elements up to the specified time.
-