Github user R-Rajkumar commented on a diff in the pull request: https://github.com/apache/stratos/pull/382#discussion_r35234774 --- Diff: extensions/cep/stratos-cep-extension/src/main/java/org/apache/stratos/cep/extension/ExponentialMovingAverage.java --- @@ -0,0 +1,32 @@ +package org.apache.stratos.cep.extension; + +/** + * class to demonstrate how EMA works + */ +public class ExponentialMovingAverage { + public Double value; + + /** + * smooth the value with respect to the previous value + * @param value + * @return + */ + public double getAverage(double value){ + if(this.value == null){ + this.value = value; + return value; + } + + /** + * calculating smoothed value + */ + double newValue = CurveFinderWindowProcessor.ALPHA * value + (1.0 - CurveFinderWindowProcessor.ALPHA)*value; + this.value = newValue; + + return newValue; + } + + public Double getValue() { + return value; + } +} --- End diff -- add the licence header to this class
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---