org.joone.util
Class MovingAveragePlugIn

java.lang.Object
  extended by org.joone.util.AbstractConverterPlugIn
      extended by org.joone.util.ConverterPlugIn
          extended by org.joone.util.MovingAveragePlugIn
All Implemented Interfaces:
java.io.Serializable, PlugInListener

public class MovingAveragePlugIn
extends ConverterPlugIn

Changes the specified input serie data so that it becomes a moving average of itself. This plugin operates on specified serie/s of data in a vertical fashion.


For example if the serie to be converted contained the following data ....


5
15
5

and the requested moving average was set at 2 then the serie would become
0
10
12.5

Any data prior to the moving average spec is set at 0 as there is not enough data to calculate the actual moving average. The data is NOT normalised. To normalise the data use a NormalizerConverterPlugIn.

Author:
Julien Norman
See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
           
 
Fields inherited from class org.joone.util.AbstractConverterPlugIn
pluginListeners
 
Constructor Summary
MovingAveragePlugIn()
          Default MovingAveragePlugIn constructor.
MovingAveragePlugIn(java.lang.String newAdvSerieSel, java.lang.String newMovAvgSpec)
          MovingAveragePlugIn constructor that allows specification of the Advanced Serie Selector and the Moving Average Specification.
 
Method Summary
protected  boolean convert(int serie)
          Start the convertion to a moving average for the required serie.
 java.lang.String getAdvancedMovAvgSpec()
          Gets the Moving Average value/s requested by the user.
 void setAdvancedMovAvgSpec(java.lang.String newAdvancedMovAvgSpec)
          Sets the Moving Average value/s requested by the user.
 
Methods inherited from class org.joone.util.ConverterPlugIn
isApplyEveryCycle, newCycle, setApplyEveryCycle
 
Methods inherited from class org.joone.util.AbstractConverterPlugIn
addPlugIn, addPlugInListener, apply, applyOnColumns, applyOnRows, cascade, check, convertPatterns, dataChanged, fireDataChanged, getAdvancedSerieSelector, getInputVector, getName, getNextPlugIn, getPluginListeners, getSerieIndexNumber, getSerieSelected, getValuePoint, isConnected, removeAllPlugIns, removePlugInListener, setAdvancedSerieSelector, setConnected, setInputVector, setName, setNextPlugin, setNextPlugIn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

MovingAveragePlugIn

public MovingAveragePlugIn()
Default MovingAveragePlugIn constructor.


MovingAveragePlugIn

public MovingAveragePlugIn(java.lang.String newAdvSerieSel,
                           java.lang.String newMovAvgSpec)
MovingAveragePlugIn constructor that allows specification of the Advanced Serie Selector and the Moving Average Specification.

Method Detail

convert

protected boolean convert(int serie)
Start the convertion to a moving average for the required serie.

Specified by:
convert in class AbstractConverterPlugIn
Parameters:
serie - the serie to convert

getAdvancedMovAvgSpec

public java.lang.String getAdvancedMovAvgSpec()
Gets the Moving Average value/s requested by the user.

Returns:
double The moving average .

setAdvancedMovAvgSpec

public void setAdvancedMovAvgSpec(java.lang.String newAdvancedMovAvgSpec)
Sets the Moving Average value/s requested by the user. It must be a comma delimeted list of moving average values. E.g 10,20,12 would request a moving average 10 in the first specified serie as in the Advanced Serie Selector then a moving average of 20 on the second and a moving average of 12 on the third.

Parameters:
newMovAvg - double


Submit Feedback to pmarrone@users.sourceforge.net