Example usage for java.util Collections reverseOrder

List of usage examples for java.util Collections reverseOrder

Introduction

In this page you can find the example usage for java.util Collections reverseOrder.

Prototype

@SuppressWarnings("unchecked")
public static <T> Comparator<T> reverseOrder(Comparator<T> cmp) 

Source Link

Document

Returns a comparator that imposes the reverse ordering of the specified comparator.

Usage

From source file:org.nuxeo.correspondence.web.relations.CorrespondenceRelationActionsBean.java

public List<StatementInfo> getIncomingStatementsInfo() throws ClientException {
    if (incomingStatementsInfo != null) {
        return incomingStatementsInfo;
    }//from   www  . java  2 s  . c  o m
    DocumentModel currentDoc = getCurrentCaseItem();
    Resource docResource = getDocumentResource(currentDoc);
    if (docResource == null) {
        incomingStatements = Collections.emptyList();
        incomingStatementsInfo = Collections.emptyList();
    } else {
        Statement pattern = new StatementImpl(null, null, docResource);
        incomingStatements = relationManager.getStatements(RelationConstants.GRAPH_NAME, pattern);
        incomingStatementsInfo = getStatementsInfo(incomingStatements);
        // sort by modification date, reverse
        Comparator<StatementInfo> comp = Collections.reverseOrder(new StatementInfoComparator());
        Collections.sort(incomingStatementsInfo, comp);
    }
    return incomingStatementsInfo;
}

From source file:org.wso2.carbon.andes.admin.mqtt.AndesMQTTAdminService.java

/**
 * Gets all subscriptions./*from  w ww. j  a v a2s. c  o m*/
 * Suppressing 'MismatchedQueryAndUpdateOfCollection' as 'allSubscriptions' is used to convert
 * to an array.
 *
 * @return An array of {@link Subscription}.
 * @throws BrokerManagerAdminException
 */
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
public Subscription[] getAllSubscriptions() throws BrokerManagerAdminException {
    List<Subscription> allSubscriptions = new ArrayList<Subscription>();
    Subscription[] subscriptionsDTO;
    try {
        SubscriptionManagerService subscriptionManagerService = AndesBrokerManagerMQTTAdminServiceDSHolder
                .getInstance().getSubscriptionManagerService();
        List<org.wso2.carbon.andes.core.types.Subscription> subscriptions = subscriptionManagerService
                .getAllSubscriptions();
        subscriptionsDTO = new Subscription[subscriptions.size()];
        for (org.wso2.carbon.andes.core.types.Subscription sub : subscriptions) {
            Subscription subscriptionDTO = new Subscription();
            subscriptionDTO.setSubscriptionIdentifier(sub.getSubscriptionIdentifier());
            subscriptionDTO.setSubscribedQueueOrTopicName(sub.getSubscribedQueueOrTopicName());
            subscriptionDTO.setSubscriberQueueBoundExchange(sub.getSubscriberQueueBoundExchange());
            subscriptionDTO.setSubscriberQueueName(sub.getSubscriberQueueName());
            subscriptionDTO.setDurable(sub.isDurable());
            subscriptionDTO.setActive(sub.isActive());
            subscriptionDTO
                    .setNumberOfMessagesRemainingForSubscriber(sub.getNumberOfMessagesRemainingForSubscriber());
            subscriptionDTO.setConnectedNodeAddress(sub.getConnectedNodeAddress());
            subscriptionDTO.setProtocolType(sub.getProtocolType());
            subscriptionDTO.setDestinationType(sub.getDestinationType());
            subscriptionDTO.setOriginHostAddress(sub.getOriginHostAddress());

            allSubscriptions.add(subscriptionDTO);
        }
        CustomSubscriptionComparator comparator = new CustomSubscriptionComparator();
        Collections.sort(allSubscriptions, Collections.reverseOrder(comparator));
        allSubscriptions.toArray(subscriptionsDTO);
    } catch (SubscriptionManagerException e) {
        String errorMessage = e.getMessage();
        log.error(errorMessage, e);
        throw new BrokerManagerAdminException(errorMessage, e);
    }
    return subscriptionsDTO;
}

From source file:it.uniud.ailab.dcore.Distiller.java

/**
 * Perform the extraction of keyphrases of a specified string, and returns a
 * developer-friendly object that allows quick access to the extracted
 * information./* w  ww. j ava2s .c  om*/
 *
 * @param text the text to extract
 * @return the distilled output
 */
public DistilledOutput distill(String text) {

    DistilledOutput output = new DistilledOutput();

    output.setOriginalText(text);

    distillToBlackboard(text);

    output.setDetectedLanguage(blackboard.getStructure().getLanguage().getLanguage());

    // Copy the grams, sorted by descending score
    output.initializeGrams(blackboard.getKeyphrases().size());

    Collection<Gram> grams = blackboard.getKeyphrases();
    Map<Keyphrase, Double> scoredGrams = new HashMap<>();

    for (Gram g : grams) {
        Keyphrase k = (Keyphrase) g;
        scoredGrams.put(k, k.getFeature(GenericEvaluatorAnnotator.SCORE));
    }

    List<Map.Entry<Keyphrase, Double>> sortedGrams = scoredGrams.entrySet().stream()
            .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())).collect(Collectors.toList());

    for (int i = 0; i < output.getGrams().length; i++) {
        DetectedGram gram = output.getGrams()[i];
        Keyphrase originalGram = sortedGrams.get(i).getKey();
        gram.setSurface(originalGram.getSurface());
        gram.setKeyphraseness(originalGram
                .getFeature(it.uniud.ailab.dcore.annotation.annotators.GenericEvaluatorAnnotator.SCORE));

        UriAnnotation wikiAnn = (UriAnnotation) originalGram.getAnnotation(WIKIURI);
        if (wikiAnn != null) {
            gram.setConceptName(wikiAnn.getSurface());
            gram.setConceptPath(wikiAnn.getUri().toASCIIString());
        }
    }

    output.initializeRelatedConcepts(blackboard.getAnnotations(WikipediaInferenceAnnotator.RELATED).size());

    for (int i = 0; i < output.getRelatedConcepts().length; i++) {
        InferredConcept related = output.getRelatedConcepts()[i];
        InferenceAnnotation originalRelatedConcept = (InferenceAnnotation) blackboard
                .getAnnotations(WikipediaInferenceAnnotator.RELATED).get(i);

        related.setConcept(originalRelatedConcept.getConcept());
        related.setConceptPath(originalRelatedConcept.getUri().toASCIIString());
        related.setScore(originalRelatedConcept.getScore());
    }

    output.initializeHypernyms(blackboard.getAnnotations(WikipediaInferenceAnnotator.HYPERNYMS).size());

    for (int i = 0; i < output.getHypernyms().length; i++) {
        InferredConcept hypernym = output.getHypernyms()[i];
        InferenceAnnotation originalHypernym = (InferenceAnnotation) blackboard
                .getAnnotations(WikipediaInferenceAnnotator.HYPERNYMS).get(i);

        hypernym.setConcept(originalHypernym.getConcept());
        hypernym.setConceptPath(originalHypernym.getUri().toASCIIString());
        hypernym.setScore(originalHypernym.getScore());
    }

    output.setExtractionCompleted(true);

    return output;
}

From source file:org.apache.ode.utils.fs.TempFileManager.java

@SuppressWarnings("unchecked")
private synchronized void _cleanup() {
    try {/*w  ww.  ja  v  a2  s  .c  o  m*/
        // collect all subdirectory contents that still exist, ordered files-first
        SortedSet<File> allFiles = new TreeSet(Collections.reverseOrder(null));
        for (File f : _registeredFiles) {
            if (f.exists()) {
                allFiles.addAll(FileUtils.directoryEntriesInPath(f));
            }
        }

        if (__log.isDebugEnabled()) {
            __log.debug("cleaning up " + allFiles.size() + " files.");
        }

        // now delete all files
        for (File f : allFiles) {
            if (__log.isDebugEnabled()) {
                __log.debug("deleting: " + f.getAbsolutePath());
            }
            if (f.exists() && !f.delete()) {
                __log.error("Unable to delete file " + f.getAbsolutePath()
                        + "; this may be caused by a descriptor leak and should be reported.");
                // fall back to deletion on VM shutdown
                f.deleteOnExit();
            }
        }
    } finally {
        _registeredFiles.clear();
        __workDir = null;
        __log.debug("cleanup done.");
    }
}

From source file:com.google.gerrit.server.ReviewerRecommender.java

public List<Account.Id> suggestReviewers(ChangeNotes changeNotes, SuggestReviewers suggestReviewers,
        ProjectControl projectControl, List<Account.Id> candidateList) throws OrmException {
    String query = suggestReviewers.getQuery();
    double baseWeight = config.getInt("addReviewer", "baseWeight", 1);

    Map<Account.Id, MutableDouble> reviewerScores;
    if (Strings.isNullOrEmpty(query)) {
        reviewerScores = baseRankingForEmptyQuery(baseWeight);
    } else {//from ww  w .j a v a 2s .c  o m
        reviewerScores = baseRankingForCandidateList(candidateList, projectControl, baseWeight);
    }

    // Send the query along with a candidate list to all plugins and merge the
    // results. Plugins don't necessarily need to use the candidates list, they
    // can also return non-candidate account ids.
    List<Callable<Set<SuggestedReviewer>>> tasks = new ArrayList<>(
            reviewerSuggestionPluginMap.plugins().size());
    List<Double> weights = new ArrayList<>(reviewerSuggestionPluginMap.plugins().size());

    for (DynamicMap.Entry<ReviewerSuggestion> plugin : reviewerSuggestionPluginMap) {
        tasks.add(() -> plugin.getProvider().get().suggestReviewers(projectControl.getProject().getNameKey(),
                changeNotes.getChangeId(), query, reviewerScores.keySet()));
        String pluginWeight = config.getString("addReviewer",
                plugin.getPluginName() + "-" + plugin.getExportName(), "weight");
        if (Strings.isNullOrEmpty(pluginWeight)) {
            pluginWeight = "1";
        }
        try {
            weights.add(Double.parseDouble(pluginWeight));
        } catch (NumberFormatException e) {
            log.error("Exception while parsing weight for " + plugin.getPluginName() + "-"
                    + plugin.getExportName(), e);
            weights.add(1d);
        }
    }

    try {
        List<Future<Set<SuggestedReviewer>>> futures = workQueue.getDefaultQueue().invokeAll(tasks,
                PLUGIN_QUERY_TIMEOUT, TimeUnit.MILLISECONDS);
        Iterator<Double> weightIterator = weights.iterator();
        for (Future<Set<SuggestedReviewer>> f : futures) {
            double weight = weightIterator.next();
            for (SuggestedReviewer s : f.get()) {
                if (reviewerScores.containsKey(s.account)) {
                    reviewerScores.get(s.account).add(s.score * weight);
                } else {
                    reviewerScores.put(s.account, new MutableDouble(s.score * weight));
                }
            }
        }
    } catch (ExecutionException | InterruptedException e) {
        log.error("Exception while suggesting reviewers", e);
        return ImmutableList.of();
    }

    if (changeNotes != null) {
        // Remove change owner
        reviewerScores.remove(changeNotes.getChange().getOwner());

        // Remove existing reviewers
        reviewerScores.keySet()
                .removeAll(approvalsUtil.getReviewers(dbProvider.get(), changeNotes).byState(REVIEWER));
    }

    // Sort results
    Stream<Entry<Account.Id, MutableDouble>> sorted = reviewerScores.entrySet().stream()
            .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()));
    List<Account.Id> sortedSuggestions = sorted.map(Map.Entry::getKey).collect(toList());
    return sortedSuggestions;
}

From source file:org.orbisgis.corejdbc.ReadTable.java

public static Collection<Integer> getSortedColumnRowIndex(Connection connection, ReadRowSet originalOrder,
        String table, String originalColumnName, boolean ascending, ProgressMonitor progressMonitor)
        throws SQLException {
    String quoteIdentifier = TableLocation.quoteIdentifier(originalColumnName);
    TableLocation tableLocation = TableLocation.parse(table);
    Collection<Integer> columnValues;
    try (Statement st = connection.createStatement()) {
        int rowCount = 0;
        try (ResultSet rs = st.executeQuery("SELECT COUNT(*) cpt from " + tableLocation.toString())) {
            if (rs.next()) {
                rowCount = rs.getInt(1);
            }//from w  w  w.j av a 2  s .  c o  m
        }
        columnValues = new ArrayList<>(rowCount);
        PropertyChangeListener listener = EventHandler.create(PropertyChangeListener.class, st, "cancel");
        progressMonitor.addPropertyChangeListener(ProgressMonitor.PROP_CANCEL, listener);
        try {
            int pkIndex = JDBCUtilities.getIntegerPrimaryKey(connection, tableLocation.toString());
            if (pkIndex > 0) {
                ProgressMonitor jobProgress = progressMonitor.startTask(2);
                // Do not cache values
                // Use SQL sort
                DatabaseMetaData meta = connection.getMetaData();
                String pkFieldName = TableLocation
                        .quoteIdentifier(JDBCUtilities.getFieldName(meta, table, pkIndex));
                String desc = "";
                if (!ascending) {
                    desc = " DESC";
                }
                // Create a map of Row Id to Pk Value
                ProgressMonitor cacheProgress = jobProgress.startTask(I18N.tr("Cache primary key values"),
                        rowCount);
                Map<Long, Integer> pkValueToRowId = new HashMap<>(rowCount);
                int rowId = 0;
                Lock lock = originalOrder.getReadLock();
                lock.tryLock();
                try {
                    originalOrder.beforeFirst();
                    while (originalOrder.next()) {
                        rowId++;
                        pkValueToRowId.put(originalOrder.getPk(), rowId);
                        cacheProgress.endTask();
                    }
                } finally {
                    lock.unlock();
                }
                // Read ordered pk values
                ProgressMonitor sortProgress = jobProgress.startTask(I18N.tr("Read sorted keys"), rowCount);
                try (ResultSet rs = st.executeQuery(
                        "select " + pkFieldName + " from " + table + " ORDER BY " + quoteIdentifier + desc)) {
                    while (rs.next()) {
                        columnValues.add(pkValueToRowId.get(rs.getLong(1)));
                        sortProgress.endTask();
                    }
                }
            } else {
                ProgressMonitor jobProgress = progressMonitor.startTask(2);
                //Cache values
                ProgressMonitor cacheProgress = jobProgress.startTask(I18N.tr("Cache table values"), rowCount);
                Comparable[] cache = new Comparable[rowCount];
                Lock lock = originalOrder.getReadLock();
                lock.tryLock();
                try {
                    originalOrder.beforeFirst();
                    int i = 0;
                    final int fieldIndex = originalOrder.findColumn(originalColumnName);
                    long time1 = 0, time2 = 0, time3 = 0, time4 = 0, time5 = 0;
                    time5 -= System.currentTimeMillis();
                    while (originalOrder.next()) {
                        time5 += System.currentTimeMillis();
                        time1 -= System.currentTimeMillis();
                        Object obj = originalOrder.getObject(fieldIndex);
                        time1 += System.currentTimeMillis();
                        time2 -= System.currentTimeMillis();
                        if (obj != null && !(obj instanceof Comparable)) {
                            throw new SQLException(I18N.tr("Could only sort comparable database object type"));
                        }
                        time2 += System.currentTimeMillis();
                        time3 -= System.currentTimeMillis();
                        cache[i++] = (Comparable) obj;
                        time3 += System.currentTimeMillis();
                        time4 -= System.currentTimeMillis();
                        cacheProgress.endTask();
                        time4 += System.currentTimeMillis();
                        time5 -= System.currentTimeMillis();
                    }
                    time5 += System.currentTimeMillis();
                    System.out.println("time 1:" + time1 + ";" + "time 2:" + time2 + ";" + "time 3:" + time3
                            + ";" + "time 4:" + time4 + ";" + "time 5:" + time5 + ";");
                } finally {
                    lock.unlock();
                }
                ProgressMonitor sortProgress = jobProgress.startTask(I18N.tr("Sort table values"), rowCount);
                Comparator<Integer> comparator = new SortValueCachedComparator(cache);
                if (!ascending) {
                    comparator = Collections.reverseOrder(comparator);
                }
                columnValues = new TreeSet<>(comparator);
                for (int i = 1; i <= rowCount; i++) {
                    columnValues.add(i);
                    sortProgress.endTask();
                }
            }
        } finally {
            progressMonitor.removePropertyChangeListener(listener);
        }
        return columnValues;
    }
}

From source file:org.pentaho.reporting.designer.core.editor.drilldown.DrillDownParameterTableModel.java

protected void updateData(final DrillDownParameter[] elements) {
    this.elements = elements.clone();

    final DrillDownParameter[] metaData = filter(elements);
    if (tableStyle == TableStyle.ASCENDING) {
        Arrays.sort(metaData, new PlainParameterComparator());
        this.groupings = new GroupingHeader[metaData.length];
        this.groupedElements = metaData;
    } else if (tableStyle == TableStyle.DESCENDING) {
        Arrays.sort(metaData, Collections.reverseOrder(new PlainParameterComparator()));
        this.groupings = new GroupingHeader[metaData.length];
        this.groupedElements = metaData;
    } else {/*from ww w.j  a  v a 2s. c  om*/
        Arrays.sort(metaData, new GroupedParameterComparator());

        int groupCount = 0;
        if (metaData.length > 0) {
            DrillDownParameter.Type oldValue = null;

            for (int i = 0; i < metaData.length; i++) {
                if (groupCount == 0) {
                    groupCount = 1;
                    final DrillDownParameter firstdata = metaData[i];
                    oldValue = firstdata.getType();
                    continue;
                }

                final DrillDownParameter data = metaData[i];
                final DrillDownParameter.Type grouping = data.getType();
                if ((ObjectUtilities.equal(oldValue, grouping)) == false) {
                    oldValue = grouping;
                    groupCount += 1;
                }
            }
        }

        final DrillDownParameter[] groupedMetaData = new DrillDownParameter[metaData.length + groupCount];
        this.groupings = new GroupingHeader[groupedMetaData.length];
        int targetIdx = 0;
        GroupingHeader group = null;
        for (int sourceIdx = 0; sourceIdx < metaData.length; sourceIdx++) {
            final DrillDownParameter data = metaData[sourceIdx];
            if (sourceIdx == 0) {
                group = new GroupingHeader(data.getType().toString());
                groupings[targetIdx] = group;
                targetIdx += 1;
            } else {
                final String newgroup = data.getType().toString();
                if ((ObjectUtilities.equal(newgroup, group.getHeaderText())) == false) {
                    group = new GroupingHeader(newgroup);
                    groupings[targetIdx] = group;
                    targetIdx += 1;
                }
            }

            groupings[targetIdx] = group;
            groupedMetaData[targetIdx] = data;
            targetIdx += 1;
        }
        this.groupedElements = groupedMetaData;
    }

    fireTableDataChanged();
}

From source file:org.wso2.carbon.andes.admin.AndesAdminService.java

/**
 * Gets all queues./*  w w w .j  a v  a2  s  . c  o m*/
 * Suppressing 'MismatchedQueryAndUpdateOfCollection' as 'allQueues' is used to sort and to
 * convert to an array.
 *
 * @return An array of queues.
 * @throws BrokerManagerAdminException
 */
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
public org.wso2.carbon.andes.admin.internal.Queue[] getAllQueues() throws BrokerManagerAdminException {
    List<org.wso2.carbon.andes.admin.internal.Queue> allQueues = new ArrayList<org.wso2.carbon.andes.admin.internal.Queue>();
    org.wso2.carbon.andes.admin.internal.Queue[] queuesDTO;
    try {
        QueueManagerService queueManagerService = AndesBrokerManagerAdminServiceDSHolder.getInstance()
                .getQueueManagerService();
        List<org.wso2.carbon.andes.core.types.Queue> queues = queueManagerService.getAllQueues();
        queuesDTO = new org.wso2.carbon.andes.admin.internal.Queue[queues.size()];
        for (org.wso2.carbon.andes.core.types.Queue queue : queues) {
            org.wso2.carbon.andes.admin.internal.Queue queueDTO = new org.wso2.carbon.andes.admin.internal.Queue();
            queueDTO.setQueueName(queue.getQueueName());
            queueDTO.setMessageCount(queue.getMessageCount());
            queueDTO.setCreatedTime(queue.getCreatedTime());
            queueDTO.setUpdatedTime(queue.getUpdatedTime());
            allQueues.add(queueDTO);
        }
        CustomQueueComparator comparator = new CustomQueueComparator();
        Collections.sort(allQueues, Collections.reverseOrder(comparator));
        allQueues.toArray(queuesDTO);
    } catch (QueueManagerException e) {
        String errorMessage = e.getMessage();
        log.error(errorMessage, e);
        throw new BrokerManagerAdminException(errorMessage, e);
    }
    return queuesDTO;
}

From source file:org.nuxeo.correspondence.web.relations.CorrespondenceRelationActionsBean.java

public List<StatementInfo> getOutgoingStatementsInfo() throws ClientException {
    if (outgoingStatementsInfo != null) {
        return outgoingStatementsInfo;
    }// w  w w  . j  av  a2 s.  c o  m
    DocumentModel currentDoc = getCurrentCaseItem();
    Resource docResource = getDocumentResource(currentDoc);
    if (docResource == null) {
        outgoingStatements = Collections.emptyList();
        outgoingStatementsInfo = Collections.emptyList();
    } else {
        Statement pattern = new StatementImpl(docResource, null, null);
        outgoingStatements = relationManager.getStatements(RelationConstants.GRAPH_NAME, pattern);
        outgoingStatementsInfo = getStatementsInfo(outgoingStatements);
        // sort by modification date, reverse
        Comparator<StatementInfo> comp = Collections.reverseOrder(new StatementInfoComparator());
        Collections.sort(outgoingStatementsInfo, comp);
    }
    return outgoingStatementsInfo;
}

From source file:org.pentaho.reporting.designer.core.editor.styles.StyleTableModel.java

protected DefaultStyleDataBackend updateData(final Element[] elements) {
    final StyleMetaData[] metaData = selectCommonAttributes(elements);
    final TableStyle tableStyle = getTableStyle();
    if (tableStyle == TableStyle.ASCENDING) {
        Arrays.sort(metaData, new PlainMetaDataComparator());
        return (new DefaultStyleDataBackend(metaData, new GroupingHeader[metaData.length], elements));
    } else if (tableStyle == TableStyle.DESCENDING) {
        Arrays.sort(metaData, Collections.reverseOrder(new PlainMetaDataComparator()));
        return (new DefaultStyleDataBackend(metaData, new GroupingHeader[metaData.length], elements));
    } else {/*from   w ww  .  j ava  2 s  .  c  o m*/
        Arrays.sort(metaData, new GroupedMetaDataComparator());
        final Locale locale = Locale.getDefault();
        int groupCount = 0;
        int metaDataCount = 0;

        if (metaData.length > 0) {
            String oldValue = null;

            for (int i = 0; i < metaData.length; i++) {
                final StyleMetaData data = metaData[i];
                if (data.isHidden()) {
                    continue;
                }
                if (!WorkspaceSettings.getInstance().isVisible(data)) {
                    continue;
                }

                metaDataCount += 1;

                if (groupCount == 0) {
                    groupCount = 1;
                    final StyleMetaData firstdata = metaData[i];
                    oldValue = firstdata.getGrouping(locale);
                    continue;
                }

                final String grouping = data.getGrouping(locale);
                if ((ObjectUtilities.equal(oldValue, grouping)) == false) {
                    oldValue = grouping;
                    groupCount += 1;
                }
            }
        }

        final StyleMetaData[] groupedMetaData = new StyleMetaData[metaDataCount + groupCount];
        int targetIdx = 0;
        GroupingHeader[] groupings = new GroupingHeader[groupedMetaData.length];
        GroupingHeader group = null;
        for (int sourceIdx = 0; sourceIdx < metaData.length; sourceIdx++) {
            final StyleMetaData data = metaData[sourceIdx];
            if (data.isHidden()) {
                continue;
            }
            if (!WorkspaceSettings.getInstance().isVisible(data)) {
                continue;
            }

            if (targetIdx == 0) {
                group = new GroupingHeader(data.getGrouping(locale));
                groupings[targetIdx] = group;
                targetIdx += 1;
            } else {
                final String newgroup = data.getGrouping(locale);
                //noinspection ConstantConditions
                if ((ObjectUtilities.equal(newgroup, group.getHeaderText())) == false) {
                    group = new GroupingHeader(newgroup);
                    groupings[targetIdx] = group;
                    targetIdx += 1;
                }
            }

            groupings[targetIdx] = group;
            groupedMetaData[targetIdx] = data;
            targetIdx += 1;
        }

        if (oldDataBackend != null) {
            groupings = reconcileState(groupings, oldDataBackend.getGroupings());
        }

        return new DefaultStyleDataBackend(groupedMetaData, groupings, elements);
    }
}