use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class BinFrequencyIndicatorImpl 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 BinsDesignerForm method initialize.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.utils.AbstractForm#initialize()
*/
@Override
protected void initialize() {
Domain domain = parameters.getBins();
if (domain != null) {
minValue.setText(String.valueOf(DomainHelper.getMinBinValue(domain)));
maxValue.setText(String.valueOf(DomainHelper.getMaxBinValue(domain)));
numbOfBins.setText(String.valueOf(DomainHelper.getNumberOfBins(domain)));
EList<RangeRestriction> ranges = domain.getRanges();
if (!ranges.isEmpty()) {
addSlice.setEnabled(true);
delSlice.setEnabled(true);
minValue.setEnabled(false);
maxValue.setEnabled(false);
numbOfBins.setEnabled(false);
isSetRange.setSelection(true);
tableViewer.setInput(ranges);
}
}
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class DomainHelper method createRealRangeRestriction.
/**
* Method "createRangeRestriction".
*
* @param min the min value of the range
* @param max the max value of the range
* @return the new Range restriction.
*/
public static RangeRestriction createRealRangeRestriction(double min, double max) {
RangeRestriction rangeRestriction = DOMAIN.createRangeRestriction();
rangeRestriction.setLowerValue(createRealNumberValue(null, min));
rangeRestriction.setUpperValue(createRealNumberValue(null, max));
return rangeRestriction;
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class DomainHelper method addRangeRestriction.
/**
* Method "addRangeRestriction" creates a new range restriction and adds it to the given domain.
*
* @param domain the domain to which a new range restriction will be added
* @return the newly created range restriction
*/
public static RangeRestriction addRangeRestriction(Domain domain) {
RangeRestriction rangeRestriction = DOMAIN.createRangeRestriction();
domain.getRanges().add(rangeRestriction);
return rangeRestriction;
}
use of org.talend.dataquality.domain.RangeRestriction in project tdq-studio-se by Talend.
the class IndicatorHelper method addThresholdToIndiParameterDomain.
/**
* DOC yyin Comment method "addThresholdToIndiParameterDomain".
*
* @param min
* @param max
* @param thresholdType
* @param validDomain
*/
private static void addThresholdToIndiParameterDomain(String min, String max, ThresholdType thresholdType, Domain validDomain) {
EList<RangeRestriction> ranges = validDomain.getRanges();
for (RangeRestriction rangeRestriction : ranges) {
if (thresholdType.getLabel().equals(rangeRestriction.getName())) {
rangeRestriction.setLowerValue(DomainHelper.createStringValue(null, min));
rangeRestriction.setUpperValue(DomainHelper.createStringValue(null, max));
return;
}
}
// else no previous range found, create a new one
RangeRestriction rangeRestriction = DomainHelper.createStringRangeRestriction(min, max);
rangeRestriction.setName(thresholdType.getLabel());
ranges.add(rangeRestriction);
}
Aggregations