lt.monarch.chart.spc.math
Class SigmaValuesCalculator

java.lang.Object
  extended by lt.monarch.chart.spc.math.ValuesCalculator
      extended by lt.monarch.chart.spc.math.ControlValuesCalculator
          extended by lt.monarch.chart.spc.math.SigmaValuesCalculator

public class SigmaValuesCalculator
extends ControlValuesCalculator

Calculates values for s (Sigma) chart Values are calculated using formulas: http://www.singleton-labs.com/doc/mcharts/guide/#guide/chart-types/4.3.1.html


Field Summary
Modifier and Type Field and Description
protected  java.lang.Double histLcl
           
protected  java.lang.Double histUcl
           
 
Fields inherited from class lt.monarch.chart.spc.math.ValuesCalculator
nullName
 
Constructor Summary
Constructor and Description
SigmaValuesCalculator()
          Constructs Sigma chart values calculator.
SigmaValuesCalculator(java.lang.Double lcl, java.lang.Double ucl)
          Constructs Sigma chart values calculator.
 
Method Summary
Modifier and Type Method and Description
 double averageSigma(ChartDataModel dataModel)
          Calculates the average sigma value (the center line value for control chart)
 ChartDataModel getCenter(ChartDataModel dataModel)
          Calculates the center line data model (usually the average of all data)
 void getCenter(ChartDataModel dataModel, ChartDataModel dstModel)
          Fill given data model with center line data.
 ChartDataModel getChartLine(ChartDataModel dataModel)
          Calculates chart line data model (measurements, averages, standard deviation of sample of measurements, depending on the chart type).
 void getChartLine(ChartDataModel dataModel, ChartDataModel dstModel)
          Fill given data model (measurements, averages, standard deviation of sample of measurements, depending on the chart type).
 ChartDataModel getLCL(ChartDataModel dataModel)
          Calculates chart lower control limit data model.
 void getLCL(ChartDataModel dataModel, ChartDataModel dstModel)
          Calculates chart lower control limit data and fills given data model.
 ChartDataModel getUCL(ChartDataModel dataModel)
          Calculates chart upper control limit data model.
 void getUCL(ChartDataModel dataModel, ChartDataModel dstModel)
          Calculates chart upper control limit data and fills given data model.
 double sigmaX(ChartDataModel dataModel)
          Calculates process sigma.
 double standardDeviation(java.util.List<java.lang.Object> values)
          Calculates the standard deviation value of input data.
protected  void validateDataModel(ChartDataModel dataModel)
          Validates data model.
 
Methods inherited from class lt.monarch.chart.spc.math.ControlValuesCalculator
averageRange, getLabels, getN, getRange
 
Methods inherited from class lt.monarch.chart.spc.math.ValuesCalculator
average, fill, fill, fillColumn, fillColumn, fillConstant, fillConstant, getAverage, getc4, getColumn, getd2, getd3, getD3, getD4, getDouble, getE, getF, getG, getH, isEmpty, isNconstant, validateDataModel, validateDataModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

histUcl

protected java.lang.Double histUcl

histLcl

protected java.lang.Double histLcl
Constructor Detail

SigmaValuesCalculator

public SigmaValuesCalculator()
Constructs Sigma chart values calculator. LCL and UCL values are calculated from the data.


SigmaValuesCalculator

public SigmaValuesCalculator(java.lang.Double lcl,
                             java.lang.Double ucl)
Constructs Sigma chart values calculator. LCL and UCL values given as a parameters (calculated from historical data). Given LCL and UCL values are used for calculating other chart parameters.

Parameters:
lcl - lower control limit
ucl - upper control limit
Method Detail

getCenter

public ChartDataModel getCenter(ChartDataModel dataModel)
                         throws DataFormatException
Description copied from class: ControlValuesCalculator
Calculates the center line data model (usually the average of all data)

Specified by:
getCenter in class ControlValuesCalculator
Parameters:
dataModel - input data.
Throws:
DataFormatException

getCenter

public void getCenter(ChartDataModel dataModel,
                      ChartDataModel dstModel)
               throws DataFormatException
Description copied from class: ControlValuesCalculator
Fill given data model with center line data.

Specified by:
getCenter in class ControlValuesCalculator
Parameters:
dataModel - input data model.
dstModel - destination data model
Throws:
DataFormatException - when the invalid data is found.

getChartLine

public ChartDataModel getChartLine(ChartDataModel dataModel)
                            throws DataFormatException
Description copied from class: ControlValuesCalculator
Calculates chart line data model (measurements, averages, standard deviation of sample of measurements, depending on the chart type).

Specified by:
getChartLine in class ControlValuesCalculator
Parameters:
dataModel - input data model.
Returns:
chart line data model.
Throws:
DataFormatException - when the input data are invalid.

getChartLine

public void getChartLine(ChartDataModel dataModel,
                         ChartDataModel dstModel)
                  throws DataFormatException
Description copied from class: ControlValuesCalculator
Fill given data model (measurements, averages, standard deviation of sample of measurements, depending on the chart type).

Specified by:
getChartLine in class ControlValuesCalculator
Parameters:
dataModel - input data model.
dstModel - destination data model
Throws:
DataFormatException - when the invalid data is found.

getLCL

public ChartDataModel getLCL(ChartDataModel dataModel)
                      throws DataFormatException
Description copied from class: ControlValuesCalculator
Calculates chart lower control limit data model.

Specified by:
getLCL in class ControlValuesCalculator
Parameters:
dataModel - input data model.
Returns:
chart lower control limit data model.
Throws:
DataFormatException - when the input data are invalid.

getLCL

public void getLCL(ChartDataModel dataModel,
                   ChartDataModel dstModel)
            throws DataFormatException
Description copied from class: ControlValuesCalculator
Calculates chart lower control limit data and fills given data model.

Specified by:
getLCL in class ControlValuesCalculator
Parameters:
dataModel - input data model.
dstModel - lower control limit destination data model.
Throws:
DataFormatException - when the input data are invalid.

getUCL

public ChartDataModel getUCL(ChartDataModel dataModel)
                      throws DataFormatException
Description copied from class: ControlValuesCalculator
Calculates chart upper control limit data model.

Specified by:
getUCL in class ControlValuesCalculator
Parameters:
dataModel - input data model.
Returns:
chart upper control limit data model.
Throws:
DataFormatException - when the input data are invalid.

getUCL

public void getUCL(ChartDataModel dataModel,
                   ChartDataModel dstModel)
            throws DataFormatException
Description copied from class: ControlValuesCalculator
Calculates chart upper control limit data and fills given data model.

Specified by:
getUCL in class ControlValuesCalculator
Parameters:
dataModel - input data model.
dstModel - upper control limit destination data model.
Throws:
DataFormatException - when the input data are invalid.

averageSigma

public double averageSigma(ChartDataModel dataModel)
                    throws DataFormatException
Calculates the average sigma value (the center line value for control chart)

Parameters:
dataModel - input data model
Returns:
center line value
Throws:
DataFormatException - when the invalid input data are provided

standardDeviation

public double standardDeviation(java.util.List<java.lang.Object> values)
                         throws DataFormatException
Calculates the standard deviation value of input data. If the empty list is provided, exception is thrown. If the list contains only 1 number, 0 value is returned. Empty and null values are ignored in the input data.

Parameters:
values - list of numbers
Returns:
standard deviation value
Throws:
DataFormatException - then list is empty, or values list does not contain numbers.

sigmaX

public double sigmaX(ChartDataModel dataModel)
              throws DataFormatException
Calculates process sigma.

Overrides:
sigmaX in class ControlValuesCalculator
Parameters:
dataModel - input data model.
Returns:
process sigma value.
Throws:
DataFormatException - when the input data are invalid

validateDataModel

protected void validateDataModel(ChartDataModel dataModel)
                          throws DataFormatException
Description copied from class: ValuesCalculator
Validates data model. Checks if it satisfies chart type requirements.

Specified by:
validateDataModel in class ValuesCalculator
Parameters:
dataModel - input chart data model.
Throws:
DataFormatException - when the data is invalid.