Interface MaxPeriodical<T extends Comparable<T>>
-
- All Known Implementing Classes:
StoredMaxPeriodical
public interface MaxPeriodical<T extends Comparable<T>>Created by Andrey Titov on 1/30/17.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMaxPeriodical.Data<T extends Comparable<T>>
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetLastUpdateTime()TgetMinValue()Tpeek()MaxPeriodical.Data<T>peek(long timestamp)List<MaxPeriodical.Data<T>>peek(long since, long till)MaxPeriodical.Data<T>reset(long timestamp)Sets current maximum to minimal value (seegetMinValue()) and start new periodbooleanupdate(T currentValue, long timestamp)Updates current maximum if provided value is greater than currentpeek()and if provided timestamp is not less thangetLastUpdateTime()
-
-
-
Method Detail
-
peek
@NotNull List<MaxPeriodical.Data<T>> peek(long since, long till)
- Parameters:
since- start of the rangetill- end of the range- Returns:
- A list of available maximums. Empty list if the range is not available.
-
peek
@NotNull T peek()
- Returns:
- current maximum
-
peek
@NotNull MaxPeriodical.Data<T> peek(long timestamp)
- Returns:
- current maximum with range data (since last reset till passed timestamp)
-
getLastUpdateTime
long getLastUpdateTime()
- Returns:
- timestamp of last update
-
getMinValue
@NotNull T getMinValue()
- Returns:
- minimal value of this metric
-
reset
MaxPeriodical.Data<T> reset(long timestamp)
Sets current maximum to minimal value (seegetMinValue()) and start new period- Parameters:
timestamp-- Returns:
-
update
boolean update(@NotNull T currentValue, long timestamp)Updates current maximum if provided value is greater than currentpeek()and if provided timestamp is not less thangetLastUpdateTime()- Parameters:
currentValue- value to settimestamp- current timestamp- Returns:
- true if current maximum was updated
-
-