return simple ewma if age is 0.0
Vladimir Bauer
6 years ago
| 26 | 26 | // work duration as second argument, in order for this decorator to |
| 27 | 27 | // work correctly. This decorator is a wrapper of MovingAverageETA. |
| 28 | 28 | func EwmaETA(style TimeStyle, age float64, wcc ...WC) Decorator { |
| 29 | return MovingAverageETA(style, ewma.NewMovingAverage(age), nil, wcc...) | |
| 29 | var average MovingAverage | |
| 30 | if age == 0.0 { | |
| 31 | average = ewma.NewMovingAverage() | |
| 32 | } else { | |
| 33 | average = ewma.NewMovingAverage(age) | |
| 34 | } | |
| 35 | return MovingAverageETA(style, average, nil, wcc...) | |
| 30 | 36 | } |
| 31 | 37 | |
| 32 | 38 | // MovingAverageETA decorator relies on MovingAverage implementation to calculate its average. |