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;
}
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);
}
}
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);
}
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);
}
Aggregations