use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class DomainHelper method createContiguousClosedBinsIntoDomain.
/**
* Method "createContiguousClosedBinsIntoDomain".
*
* @param domainName the domain name (can be null)
* @param bins the "closed" bins (the first value of array is the beginning of the bins and the last value of the
* array is the end of bins)
* @return the new Domain
*/
public static Domain createContiguousClosedBinsIntoDomain(String domainName, double[] bins) {
Domain domain = createDomain(domainName);
for (int i = 0; i < bins.length - 1; i++) {
double min = bins[i];
double max = bins[i + 1];
RangeRestriction rangeRestriction = createRealRangeRestriction(min, max);
domain.getRanges().add(rangeRestriction);
}
return domain;
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class AnalysisHelper method createDomain.
private static Domain createDomain(Analysis analysis, String datafilterString, String alias) {
// by default use same name as the analysis. This is ok as long as there is only one datafilter.
Domain domain = DomainHelper.createDomain(analysis.getName() + alias);
RangeRestriction rangeRestriction = DomainHelper.addRangeRestriction(domain);
BooleanExpressionNode expressionNode = BooleanExpressionHelper.createBooleanExpressionNode(datafilterString);
rangeRestriction.setExpressions(expressionNode);
return domain;
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class BinFrequencyIndicatorImpl method reset.
/**
* if it has bin parameters and the range name is null,set it by concating min/max values.
*/
@Override
public boolean reset() {
if (parameters == null || parameters.getBins() == null) {
return super.reset();
}
EList<RangeRestriction> ranges = parameters.getBins().getRanges();
for (RangeRestriction range : ranges) {
if (range.getName() == null) {
double minRealValue = DomainHelper.getRealValue(range.getLowerValue());
double maxRealValue = DomainHelper.getRealValue(range.getUpperValue());
String rangeName = analyzedElement.getName() + PluginConstant.SPACE_STRING + SqlPredicate.GREATER_EQUAL.getLiteral() + PluginConstant.SPACE_STRING + minRealValue + " AND " + analyzedElement.getName() + PluginConstant.SPACE_STRING + SqlPredicate.LESS.getLiteral() + PluginConstant.SPACE_STRING + maxRealValue;
range.setName(rangeName);
}
}
return super.reset();
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class BinLowFrequencyIndicatorImpl method getGroupLabel.
/*
* (non-Javadoc)
*
* if the bin parameter is set,look range name as a new name.
*/
protected String getGroupLabel(Object name) {
if (name == null) {
return null;
}
if (parameters != null) {
Domain bins = parameters.getBins();
if (bins != null) {
EList<RangeRestriction> ranges = bins.getRanges();
for (RangeRestriction range : ranges) {
double minRealValue = DomainHelper.getRealValue(range.getLowerValue());
double maxRealValue = DomainHelper.getRealValue(range.getUpperValue());
double inputValue = Double.valueOf(name.toString());
if (minRealValue <= inputValue && inputValue < maxRealValue) {
return range.getName();
}
}
// if the data(name) is not in these ranges,return null and ignor it.
return null;
}
}
return name.toString();
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class BinLowFrequencyIndicatorImpl method reset.
/**
* if it has bin parameters and the range name is null,set it by concating min/max values.
*/
@Override
public boolean reset() {
if (parameters == null || parameters.getBins() == null) {
return super.reset();
}
EList<RangeRestriction> ranges = parameters.getBins().getRanges();
for (RangeRestriction range : ranges) {
if (range.getName() == null) {
double minRealValue = DomainHelper.getRealValue(range.getLowerValue());
double maxRealValue = DomainHelper.getRealValue(range.getUpperValue());
String rangeName = analyzedElement.getName() + PluginConstant.SPACE_STRING + SqlPredicate.GREATER_EQUAL.getLiteral() + PluginConstant.SPACE_STRING + minRealValue + " AND " + analyzedElement.getName() + PluginConstant.SPACE_STRING + SqlPredicate.LESS.getLiteral() + PluginConstant.SPACE_STRING + maxRealValue;
range.setName(rangeName);
}
}
return super.reset();
}
Aggregations