Search in sources :

Example 1 with GroupStatisticsRow

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.provider.GroupStatisticsRow in project tdq-studio-se by Talend.

the class GroupStatisticsRowCompartor method compare.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object,
     * java.lang.Object)
     */
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    GroupStatisticsRow row1 = (GroupStatisticsRow) e1;
    GroupStatisticsRow row2 = (GroupStatisticsRow) e2;
    int rc;
    switch(propertyIndex) {
        case 0:
            rc = row1.getGroupSize().compareTo(row2.getGroupSize());
            break;
        case 1:
            rc = row1.getGroupCount().compareTo(row2.getGroupCount());
            break;
        case 2:
            rc = row1.getRecordCount().compareTo(row2.getRecordCount());
            break;
        case 3:
            Double v1 = Double.valueOf(row1.getRecordPercentage().substring(0, row1.getRecordPercentage().length() - 1));
            Double v2 = Double.valueOf(row2.getRecordPercentage().substring(0, row2.getRecordPercentage().length() - 1));
            rc = v1.compareTo(v2);
            break;
        default:
            rc = 0;
    }
    // If descending order, flip the direction
    if (direction == DESCENDING) {
        rc = -rc;
    }
    return rc;
}
Also used : GroupStatisticsRow(org.talend.dataquality.record.linkage.ui.composite.tableviewer.provider.GroupStatisticsRow)

Example 2 with GroupStatisticsRow

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.provider.GroupStatisticsRow in project tdq-studio-se by Talend.

the class GroupStatisticsSection method setGroupStatisticsTableInput.

/**
 * DOC zhao Comment method "setGroupStatisticsTableInput".
 */
private void setGroupStatisticsTableInput() {
    RecordMatchingIndicator recordMatchingIndicator = MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
    // Row count
    Long rowCount = recordMatchingIndicator.getCount();
    Map<Object, Long> groupSize2GroupFreq = recordMatchingIndicator.getGroupSize2groupFrequency();
    Iterator<Object> groupSizeIterator = groupSize2GroupFreq.keySet().iterator();
    List<GroupStatisticsRow> groups = new ArrayList<GroupStatisticsRow>();
    while (groupSizeIterator.hasNext()) {
        Object groupSize = groupSizeIterator.next();
        Long groupFreq = groupSize2GroupFreq.get(groupSize);
        GroupStatisticsRow groupStatsRow = new GroupStatisticsRow();
        groupStatsRow.setGroupSize(Long.valueOf(groupSize.toString()));
        groupStatsRow.setGroupCount(groupFreq);
        groupStatsRow.setRecordCount(groupStatsRow.getGroupSize() * groupStatsRow.getGroupCount());
        setPercentage(groupStatsRow.getRecordCount(), rowCount, groupStatsRow);
        groups.add(groupStatsRow);
    }
    groupStatisticsTableViewer.setInput(groups);
}
Also used : ArrayList(java.util.ArrayList) GroupStatisticsRow(org.talend.dataquality.record.linkage.ui.composite.tableviewer.provider.GroupStatisticsRow) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)

Aggregations

GroupStatisticsRow (org.talend.dataquality.record.linkage.ui.composite.tableviewer.provider.GroupStatisticsRow)2 ArrayList (java.util.ArrayList)1 RecordMatchingIndicator (org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)1