Search in sources :

Example 6 with PatternMatchingExt

use of org.talend.dq.indicators.ext.PatternMatchingExt in project tdq-studio-se by Talend.

the class PatternStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        String label = unit.getIndicator().getName();
        PatternMatchingExt patternExt = PatternStatisticeStateUtil.getUnitValue(unit.getIndicator(), unit.getValue());
        String notMathCount = PatternStatisticeStateUtil.getNotMatchCount(patternExt);
        String machCount = PatternStatisticeStateUtil.getMatchCount(patternExt);
        customerdataset.addValue(Double.parseDouble(notMathCount), DefaultMessagesImpl.getString("PatternStatisticsState.NotMatching"), // $NON-NLS-1$
        label);
        customerdataset.addValue(Double.parseDouble(machCount), DefaultMessagesImpl.getString("PatternStatisticsState.Matching"), // $NON-NLS-1$
        label);
        PatternChartDataEntity patternEntity = PatternStatisticeStateUtil.createDataEntity(unit, label, notMathCount, machCount);
        customerdataset.addDataEntity(patternEntity);
    }
    return customerdataset;
}
Also used : PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 7 with PatternMatchingExt

use of org.talend.dq.indicators.ext.PatternMatchingExt in project tdq-studio-se by Talend.

the class PatternDynamicChartEventReceiver method settingDatasetValue.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver#settingDatasetValue()
     */
@Override
protected void settingDatasetValue(Object indValue) {
    if (indValue instanceof PatternMatchingExt) {
        PatternMatchingExt patternExt = (PatternMatchingExt) indValue;
        TOPChartUtils.getInstance().setValue(dataset, patternExt.getNotMatchingValueCount(), DefaultMessagesImpl.getString("PatternStatisticsState.NotMatching"), // $NON-NLS-1$
        this.indicatorName);
        TOPChartUtils.getInstance().setValue(dataset, patternExt.getMatchingValueCount(), DefaultMessagesImpl.getString("PatternStatisticsState.Matching"), // $NON-NLS-1$
        this.indicatorName);
    }
}
Also used : PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt)

Example 8 with PatternMatchingExt

use of org.talend.dq.indicators.ext.PatternMatchingExt in project tdq-studio-se by Talend.

the class PatternStatisticeStateUtilTest method testGetUnitValueCase3.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.editor.preview.model.states.pattern.PatternStatisticeStateUtil#getUnitValue(org.talend.dataquality.indicators.Indicator, java.lang.Object)}
 * .
 * case3:normal SqlPatternMatchingIndicator case
 */
@Test
public void testGetUnitValueCase3() {
    PatternMatchingExt pMatchExt = null;
    SqlPatternMatchingIndicator sqlMatchingIndicator = IndicatorsFactoryImpl.eINSTANCE.createSqlPatternMatchingIndicator();
    sqlMatchingIndicator.setComputed(true);
    sqlMatchingIndicator.setMatchingValueCount(40l);
    sqlMatchingIndicator.setNotMatchingValueCount(50l);
    PatternMatchingExt unitValue = PatternStatisticeStateUtil.getUnitValue(sqlMatchingIndicator, pMatchExt);
    // $NON-NLS-1$
    Assert.assertEquals("Matching count value shoud be 40l", 40l, unitValue.getMatchingValueCount());
    // $NON-NLS-1$
    Assert.assertEquals("Not matching count value shoud be 50l", 50l, unitValue.getNotMatchingValueCount());
    // $NON-NLS-1$
    Assert.assertNotEquals("unitValue should not same with pMatchExt but it is not now", pMatchExt, unitValue);
}
Also used : SqlPatternMatchingIndicator(org.talend.dataquality.indicators.SqlPatternMatchingIndicator) PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) Test(org.junit.Test)

Example 9 with PatternMatchingExt

use of org.talend.dq.indicators.ext.PatternMatchingExt in project tdq-studio-se by Talend.

the class PatternStatisticeStateUtilTest method testGetUnitValueCase4.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.editor.preview.model.states.pattern.PatternStatisticeStateUtil#getUnitValue(org.talend.dataquality.indicators.Indicator, java.lang.Object)}
 * .
 * case4:Input value is PatternMatchingExt so that return directly
 */
@Test
public void testGetUnitValueCase4() {
    PatternMatchingExt pMatchExt = new PatternMatchingExt();
    pMatchExt.setMatchingValueCount(40l);
    pMatchExt.setNotMatchingValueCount(50l);
    RegexpMatchingIndicator regexpMatchingIndicator = IndicatorsFactoryImpl.eINSTANCE.createRegexpMatchingIndicator();
    regexpMatchingIndicator.setComputed(true);
    PatternMatchingExt unitValue = PatternStatisticeStateUtil.getUnitValue(regexpMatchingIndicator, pMatchExt);
    // $NON-NLS-1$
    Assert.assertEquals("Matching count value shoud be 40l", 40l, unitValue.getMatchingValueCount());
    // $NON-NLS-1$
    Assert.assertEquals("Not matching count value shoud be 50l", 50l, unitValue.getNotMatchingValueCount());
    // $NON-NLS-1$
    Assert.assertEquals("unitValue should same with pMatchExt but it is not now", pMatchExt, unitValue);
}
Also used : PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) Test(org.junit.Test)

Aggregations

PatternMatchingExt (org.talend.dq.indicators.ext.PatternMatchingExt)9 Test (org.junit.Test)4 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)2 RegexpMatchingIndicator (org.talend.dataquality.indicators.RegexpMatchingIndicator)2 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)2 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)2 PatternChartDataEntity (org.talend.dq.indicators.preview.table.PatternChartDataEntity)2 ArrayList (java.util.ArrayList)1 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)1 Indicator (org.talend.dataquality.indicators.Indicator)1 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)1 SqlPatternMatchingIndicator (org.talend.dataquality.indicators.SqlPatternMatchingIndicator)1 ValueIndicator (org.talend.dataquality.indicators.ValueIndicator)1