Search in sources :

Example 1 with RangeRestriction

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();
}
Also used : RangeRestriction(org.talend.dataquality.domain.RangeRestriction) Domain(org.talend.dataquality.domain.Domain)

Example 2 with RangeRestriction

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);
        }
    }
}
Also used : RangeRestriction(org.talend.dataquality.domain.RangeRestriction) Domain(org.talend.dataquality.domain.Domain)

Example 3 with RangeRestriction

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;
}
Also used : RangeRestriction(org.talend.dataquality.domain.RangeRestriction)

Example 4 with 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;
}
Also used : RangeRestriction(org.talend.dataquality.domain.RangeRestriction)

Example 5 with 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);
}
Also used : RangeRestriction(org.talend.dataquality.domain.RangeRestriction)

Aggregations

RangeRestriction (org.talend.dataquality.domain.RangeRestriction)22 Domain (org.talend.dataquality.domain.Domain)13 BooleanExpressionNode (org.talend.dataquality.expressions.BooleanExpressionNode)4 Expression (orgomg.cwm.objectmodel.core.Expression)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 TdColumn (org.talend.cwm.relational.TdColumn)1 AnalysisParameters (org.talend.dataquality.analysis.AnalysisParameters)1 DateGrain (org.talend.dataquality.indicators.DateGrain)1 DateParameters (org.talend.dataquality.indicators.DateParameters)1 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)1 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)1 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)1