Search in sources :

Example 6 with IQRIndicator

use of org.talend.dataquality.indicators.IQRIndicator in project tdq-studio-se by Talend.

the class ModelElementIndicatorImpl method createCategoryIndicatorUnits.

/**
 * create indicatorMappings according category indicatorEnum.
 *
 * @param categoryEnums
 * @return
 */
private IndicatorUnit[] createCategoryIndicatorUnits(IndicatorEnum[] categoryEnums) {
    List<IndicatorUnit> indicatorUnitList = new ArrayList<IndicatorUnit>();
    IndicatorUnit indicatorUnit;
    for (IndicatorEnum categoryEnum : categoryEnums) {
        if (null == categoryEnum) {
            continue;
        }
        if (!IndicatorEnum.isPlainIndicatorEnum(categoryEnum)) {
            // tempSpecialIndicatorEnumList.add(categoryEnum);
            continue;
        }
        indicatorUnit = getPlainIndicatorUnit(categoryEnum);
        switch(categoryEnum) {
            case CountsIndicatorEnum:
                CountsIndicator countsIndicator = (CountsIndicator) indicatorUnit.getIndicator();
                countsIndicator.setBlankCountIndicator((BlankCountIndicator) getPlainIndicatorUnit(IndicatorEnum.BlankCountIndicatorEnum).getIndicator());
                countsIndicator.setDistinctCountIndicator((DistinctCountIndicator) getPlainIndicatorUnit(IndicatorEnum.DistinctCountIndicatorEnum).getIndicator());
                countsIndicator.setDuplicateCountIndicator((DuplicateCountIndicator) getPlainIndicatorUnit(IndicatorEnum.DuplicateCountIndicatorEnum).getIndicator());
                countsIndicator.setRowCountIndicator((RowCountIndicator) getPlainIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum).getIndicator());
                countsIndicator.setNullCountIndicator((NullCountIndicator) getPlainIndicatorUnit(IndicatorEnum.NullCountIndicatorEnum).getIndicator());
                countsIndicator.setUniqueCountIndicator((UniqueCountIndicator) getPlainIndicatorUnit(IndicatorEnum.UniqueIndicatorEnum).getIndicator());
                // MOD klliu bug 13411 2010-06-03
                countsIndicator.setDefaultValueIndicator((DefValueCountIndicator) getPlainIndicatorUnit(IndicatorEnum.DefValueCountIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.CountsIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case TextIndicatorEnum:
                TextIndicator textIndicator = (TextIndicator) indicatorUnit.getIndicator();
                textIndicator.setMinLengthIndicator((MinLengthIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthIndicator((MaxLengthIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthIndicatorEnum).getIndicator());
                textIndicator.setAverageLengthIndicator((AverageLengthIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthIndicatorEnum).getIndicator());
                // MOD yyi 2010-08-05
                textIndicator.setAvgLengthWithBlankIndicator((AvgLengthWithBlankIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthWithBlankIndicatorEnum).getIndicator());
                textIndicator.setAvgLengthWithNullIndicator((AvgLengthWithNullIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthWithNullIndicatorEnum).getIndicator());
                textIndicator.setAvgLengthWithBlankNullIndicator((AvgLengthWithBlankNullIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthWithNullBlankIndicatorEnum).getIndicator());
                textIndicator.setMinLengthWithBlankIndicator((MinLengthWithBlankIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthWithBlankIndicatorEnum).getIndicator());
                textIndicator.setMinLengthWithNullIndicator((MinLengthWithNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthWithNullIndicatorEnum).getIndicator());
                textIndicator.setMinLengthWithBlankNullIndicator((MinLengthWithBlankNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthWithBlankNullIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthWithBlankIndicator((MaxLengthWithBlankIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthWithBlankIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthWithNullIndicator((MaxLengthWithNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthWithNullIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthWithBlankNullIndicator((MaxLengthWithBlankNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthWithBlankNullIndicatorEnum).getIndicator());
                // ~
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.TextIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case BoxIIndicatorEnum:
                BoxIndicator boxtIndicator = (BoxIndicator) indicatorUnit.getIndicator();
                boxtIndicator.setRangeIndicator((RangeIndicator) getPlainIndicatorUnit(IndicatorEnum.RangeIndicatorEnum).getIndicator());
                boxtIndicator.setIQR((IQRIndicator) getPlainIndicatorUnit(IndicatorEnum.IQRIndicatorEnum).getIndicator());
                boxtIndicator.setMeanIndicator((MeanIndicator) getPlainIndicatorUnit(IndicatorEnum.MeanIndicatorEnum).getIndicator());
                boxtIndicator.setMedianIndicator((MedianIndicator) getPlainIndicatorUnit(IndicatorEnum.MedianIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.BoxIIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case IQRIndicatorEnum:
                IQRIndicator iqrIndicator = (IQRIndicator) indicatorUnit.getIndicator();
                iqrIndicator.setLowerValue((LowerQuartileIndicator) getPlainIndicatorUnit(IndicatorEnum.LowerQuartileIndicatorEnum).getIndicator());
                iqrIndicator.setUpperValue((UpperQuartileIndicator) getPlainIndicatorUnit(IndicatorEnum.UpperQuartileIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.IQRIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case RangeIndicatorEnum:
                RangeIndicator rangeIndicator = (RangeIndicator) indicatorUnit.getIndicator();
                rangeIndicator.setLowerValue((MinValueIndicator) getPlainIndicatorUnit(IndicatorEnum.MinValueIndicatorEnum).getIndicator());
                rangeIndicator.setUpperValue((MaxValueIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxValueIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.RangeIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case PhoneNumbStatisticsIndicatorEnum:
                PhoneNumbStatisticsIndicator phoneNumbIndicator = (PhoneNumbStatisticsIndicator) indicatorUnit.getIndicator();
                phoneNumbIndicator.setValidPhoneCountIndicator((ValidPhoneCountIndicator) getPlainIndicatorUnit(IndicatorEnum.ValidPhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setPossiblePhoneCountIndicator((PossiblePhoneCountIndicator) getPlainIndicatorUnit(IndicatorEnum.PossiblePhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setValidRegCodeCountIndicator((ValidRegCodeCountIndicator) getPlainIndicatorUnit(IndicatorEnum.ValidRegCodeCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setInvalidRegCodeCountIndicator((InvalidRegCodeCountIndicator) getPlainIndicatorUnit(IndicatorEnum.InvalidRegCodeCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setWellFormE164PhoneCountIndicator((WellFormE164PhoneCountIndicator) getPlainIndicatorUnit(IndicatorEnum.WellFormE164PhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setWellFormIntePhoneCountIndicator((WellFormIntePhoneCountIndicatorImpl) getPlainIndicatorUnit(IndicatorEnum.WellFormIntePhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setWellFormNationalPhoneCountIndicator((WellFormNationalPhoneCountIndicatorImpl) getPlainIndicatorUnit(IndicatorEnum.WellFormNationalPhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setFormatFreqPieIndicator((FormatFreqPieIndicatorImpl) getPlainIndicatorUnit(IndicatorEnum.FormatFreqPieIndictorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.PhoneNumbStatisticsIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            default:
                indicatorUnitList.add(indicatorUnit);
                break;
        }
    }
    return indicatorUnitList.toArray(new IndicatorUnit[indicatorUnitList.size()]);
}
Also used : BoxIndicator(org.talend.dataquality.indicators.BoxIndicator) TextIndicator(org.talend.dataquality.indicators.TextIndicator) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) CountsIndicator(org.talend.dataquality.indicators.CountsIndicator) RangeIndicator(org.talend.dataquality.indicators.RangeIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) ArrayList(java.util.ArrayList) IQRIndicator(org.talend.dataquality.indicators.IQRIndicator)

Aggregations

IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)6 RangeIndicator (org.talend.dataquality.indicators.RangeIndicator)5 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)3 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)3 TdColumn (org.talend.cwm.relational.TdColumn)2 CountsIndicator (org.talend.dataquality.indicators.CountsIndicator)2 MaxValueIndicator (org.talend.dataquality.indicators.MaxValueIndicator)2 MeanIndicator (org.talend.dataquality.indicators.MeanIndicator)2 MedianIndicator (org.talend.dataquality.indicators.MedianIndicator)2 MinValueIndicator (org.talend.dataquality.indicators.MinValueIndicator)2 TextIndicator (org.talend.dataquality.indicators.TextIndicator)2 ArrayList (java.util.ArrayList)1 EList (org.eclipse.emf.common.util.EList)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Test (org.junit.Test)1 TdSqlDataType (org.talend.cwm.relational.TdSqlDataType)1 TdTable (org.talend.cwm.relational.TdTable)1 ColumnIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)1 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)1 Analysis (org.talend.dataquality.analysis.Analysis)1