public class MovingAverage extends Object implements stream.StatefulProcessor
Central means it has one pivot element in the center of the window and the same number of elements left and right to it. This implies that only uneven window lengths are supported.
This is a somewhat naive implementation which could be made much faster. See the Wikipedia article at https://en.wikipedia.org/wiki/Moving_average
| Constructor and Description |
|---|
MovingAverage() |
| Modifier and Type | Method and Description |
|---|---|
void |
finish() |
void |
init(stream.ProcessContext context) |
stream.Data |
process(stream.Data item) |
void |
resetState() |
@Parameter(required=true) public String key
@Parameter(required=true) public String outputKey
@Parameter(required=true) public int length
public stream.Data process(stream.Data item)
process in interface stream.Processorpublic void init(stream.ProcessContext context)
throws Exception
init in interface stream.StatefulProcessorExceptionpublic void resetState()
throws Exception
resetState in interface stream.StatefulProcessorExceptionCopyright © 2019. All rights reserved.