Example usage for java.util List sort

List of usage examples for java.util List sort

Introduction

In this page you can find the example usage for java.util List sort.

Prototype

@SuppressWarnings({ "unchecked", "rawtypes" })
default void sort(Comparator<? super E> c) 

Source Link

Document

Sorts this list according to the order induced by the specified Comparator .

Usage

From source file:org.eclipse.packagedrone.repo.channel.web.channel.ChannelController.java

@Secured(false)
@RequestMapping(value = "/channel/{channelId}/viewPlain", method = RequestMethod.GET)
@HttpConstraint(PERMIT)//from   w ww . j  a  va  2  s  .  c  o  m
public ModelAndView viewPlain(@PathVariable("channelId") final String channelId) {
    try {
        return this.channelService.accessCall(By.id(channelId), ReadableChannel.class, (channel) -> {

            final Map<String, Object> model = new HashMap<>();

            model.put("channel", channel.getInformation());

            final Collection<ArtifactInformation> artifacts = channel.getContext().getArtifacts().values();

            if (artifacts.size() > maxWebListSize()) {
                return viewTooMany(channel);
            }

            // sort artifacts

            final List<ArtifactInformation> sortedArtifacts = new ArrayList<>(artifacts);
            sortedArtifacts.sort(Comparator.comparing(ArtifactInformation::getName));
            model.put("sortedArtifacts", sortedArtifacts);

            return new ModelAndView("channel/view", model);
        });
    } catch (final ChannelNotFoundException e) {
        return CommonController.createNotFound("channel", channelId);
    }
}

From source file:org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.java

/**
 * Look up the best-matching handler method for the current request.
 * If multiple matches are found, the best match is selected.
 * @param lookupPath mapping lookup path within the current servlet mapping
 * @param request the current request/* w w  w .ja  v  a2  s  . c  o m*/
 * @return the best-matching handler method, or {@code null} if no match
 * @see #handleMatch(Object, String, HttpServletRequest)
 * @see #handleNoMatch(Set, String, HttpServletRequest)
 */
@Nullable
protected HandlerMethod lookupHandlerMethod(String lookupPath, HttpServletRequest request) throws Exception {
    List<Match> matches = new ArrayList<>();
    List<T> directPathMatches = this.mappingRegistry.getMappingsByUrl(lookupPath);
    if (directPathMatches != null) {
        addMatchingMappings(directPathMatches, matches, request);
    }
    if (matches.isEmpty()) {
        // No choice but to go through all mappings...
        addMatchingMappings(this.mappingRegistry.getMappings().keySet(), matches, request);
    }

    if (!matches.isEmpty()) {
        Comparator<Match> comparator = new MatchComparator(getMappingComparator(request));
        matches.sort(comparator);
        Match bestMatch = matches.get(0);
        if (matches.size() > 1) {
            if (logger.isTraceEnabled()) {
                logger.trace(matches.size() + " matching mapppings: " + matches);
            }
            if (CorsUtils.isPreFlightRequest(request)) {
                return PREFLIGHT_AMBIGUOUS_MATCH;
            }
            Match secondBestMatch = matches.get(1);
            if (comparator.compare(bestMatch, secondBestMatch) == 0) {
                Method m1 = bestMatch.handlerMethod.getMethod();
                Method m2 = secondBestMatch.handlerMethod.getMethod();
                String uri = request.getRequestURI();
                throw new IllegalStateException(
                        "Ambiguous handler methods mapped for '" + uri + "': {" + m1 + ", " + m2 + "}");
            }
        }
        handleMatch(bestMatch.mapping, lookupPath, request);
        return bestMatch.handlerMethod;
    } else {
        return handleNoMatch(this.mappingRegistry.getMappings().keySet(), lookupPath, request);
    }
}

From source file:com.thoughtworks.go.server.persistence.MaterialRepository.java

private void sortPersistentObjectsById(List<? extends PersistentObject> persistentObjects, boolean asc) {
    Comparator<PersistentObject> ascendingSort = (po1, po2) -> (int) (po1.getId() - po2.getId());
    Comparator<PersistentObject> descendingSort = (po1, po2) -> (int) (po2.getId() - po1.getId());
    persistentObjects.sort(asc ? ascendingSort : descendingSort);
}

From source file:org.languagetool.rules.spelling.suggestions.SuggestionsOrdererFeatureExtractor.java

/**
 * compute features for training or prediction of a ranking model for suggestions
 * @param suggestions//from w  w w  .j ava 2  s  .c om
 * @param word
 * @param sentence
 * @param startPos
 * @return correction candidates, features for the match in general, features specific to candidates
 */
public Pair<List<SuggestedReplacement>, SortedMap<String, Float>> computeFeatures(List<String> suggestions,
        String word, AnalyzedSentence sentence, int startPos) {
    if (suggestions.isEmpty()) {
        return Pair.of(Collections.emptyList(), Collections.emptySortedMap());
    }
    if (topN <= 0) {
        topN = suggestions.size();
    }
    List<String> topSuggestions = suggestions.subList(0, Math.min(suggestions.size(), topN));
    //EditDistance<Integer> levenshteinDistance = new LevenshteinDistance(4);
    EditDistance levenstheinDistance = new EditDistance(word, EditDistance.DistanceAlgorithm.Damerau);
    SimilarityScore<Double> jaroWrinklerDistance = new JaroWinklerDistance();
    List<Feature> features = new ArrayList<>(topSuggestions.size());

    for (String candidate : topSuggestions) {
        double prob1 = languageModel.getPseudoProbability(Collections.singletonList(candidate)).getProb();
        double prob3 = LanguageModelUtils.get3gramProbabilityFor(language, languageModel, startPos, sentence,
                candidate);
        //double prob4 = LanguageModelUtils.get4gramProbabilityFor(language, languageModel, startPos, sentence, candidate);
        long wordCount = ((BaseLanguageModel) languageModel).getCount(candidate);
        int levenstheinDist = levenstheinDistance.compare(candidate, 3);
        double jaroWrinklerDist = jaroWrinklerDistance.apply(word, candidate);
        DetailedDamerauLevenstheinDistance.Distance detailedDistance = DetailedDamerauLevenstheinDistance
                .compare(word, candidate);

        features.add(new Feature(prob1, prob3, wordCount, levenstheinDist, detailedDistance, jaroWrinklerDist,
                candidate));
    }
    if (!"noop".equals(score)) {
        features.sort(Feature::compareTo);
    }
    //logger.trace("Features for '%s' in '%s': %n", word, sentence.getText());
    //features.stream().map(Feature::toString).forEach(logger::trace);
    List<String> words = features.stream().map(Feature::getWord).collect(Collectors.toList());

    // compute general features, not tied to candidates
    SortedMap<String, Float> matchData = new TreeMap<>();
    matchData.put("candidateCount", (float) words.size());

    List<SuggestedReplacement> suggestionsData = features.stream().map(f -> {
        SuggestedReplacement s = new SuggestedReplacement(f.getWord());
        s.setFeatures(f.getData());
        return s;
    }).collect(Collectors.toList());
    return Pair.of(suggestionsData, matchData);
}

From source file:org.cgiar.ccafs.marlo.action.impactpathway.OutcomesAction.java

@Override
public void prepare() throws Exception {

    // IAuditLog ia = auditLogManager.getHistory(4);
    loggedCrp = (GlobalUnit) this.getSession().get(APConstants.SESSION_CRP);
    outcomes = new ArrayList<CrpProgramOutcome>();
    loggedCrp = crpManager.getGlobalUnitById(loggedCrp.getId());
    targetUnitList = new HashMap<>();
    if (srfTargetUnitManager.findAll() != null) {

        List<SrfTargetUnit> targetUnits = new ArrayList<>();

        List<CrpTargetUnit> crpTargetUnits = new ArrayList<>(loggedCrp.getCrpTargetUnits().stream()
                .filter(tu -> tu.isActive()).collect(Collectors.toList()));

        for (CrpTargetUnit crpTargetUnit : crpTargetUnits) {
            targetUnits.add(crpTargetUnit.getSrfTargetUnit());
        }/*  w  w  w.  j a va 2 s . co  m*/

        Collections.sort(targetUnits,
                (tu1, tu2) -> tu1.getName().toLowerCase().trim().compareTo(tu2.getName().toLowerCase().trim()));

        for (SrfTargetUnit srfTargetUnit : targetUnits) {
            targetUnitList.put(srfTargetUnit.getId(), srfTargetUnit.getName());
        }

        // TODO
        targetUnitList = this.sortByComparator(targetUnitList);
    }

    if (this.getRequest().getParameter(APConstants.TRANSACTION_ID) != null) {

        transaction = StringUtils.trim(this.getRequest().getParameter(APConstants.TRANSACTION_ID));
        CrpProgram history = (CrpProgram) auditLogManager.getHistory(transaction);
        if (history != null) {
            crpProgramID = history.getId();
            selectedProgram = history;
            outcomes.addAll(history.getCrpProgramOutcomes().stream()
                    .filter(c -> c.isActive() && c.getPhase().equals(this.getActualPhase()))
                    .collect(Collectors.toList()));

            this.setEditable(false);
            this.setCanEdit(false);
            programs = new ArrayList<>();
            this.loadInfo();
            programs.add(history);

            List<HistoryDifference> differences = new ArrayList<>();
            Map<String, String> specialList = new HashMap<>();
            int i = 0;
            int j = 0;
            Collections.sort(outcomes, (lc1, lc2) -> lc1.getId().compareTo(lc2.getId()));
            for (CrpProgramOutcome crpProgramOutcome : outcomes) {
                int[] index = new int[1];
                index[0] = i;
                differences.addAll(historyComparator.getDifferencesList(crpProgramOutcome, transaction,
                        specialList, "outcomes[" + i + "]", "outcomes", 1));
                for (CrpMilestone crpMilestone : crpProgramOutcome.getMilestones()) {
                    differences.addAll(historyComparator.getDifferencesList(crpMilestone, transaction,
                            specialList, "outcomes[" + i + "].milestones[" + j + "]", "outcomes", 2));

                    j++;
                }
                j = 0;
                for (CrpOutcomeSubIdo crpOutcomeSubIdo : crpProgramOutcome.getSubIdos()) {
                    differences.addAll(historyComparator.getDifferencesList(crpOutcomeSubIdo, transaction,
                            specialList, "outcomes[" + i + "].subIdos[" + j + "]", "outcomes", 2));
                    j++;
                    int k = 0;

                    for (CrpAssumption crpAssumption : crpOutcomeSubIdo.getAssumptions()) {
                        differences.addAll(historyComparator.getDifferencesList(crpAssumption, transaction,
                                specialList, "outcomes[" + i + "].subIdos[" + j + "].assumptions[" + k + "]",
                                "outcomes", 3));
                        k++;
                    }
                }
                i++;
            }

            i = 0;

            this.setDifferences(differences);
        } else {
            programs = new ArrayList<>();
            this.transaction = null;

            this.setTransaction("-1");
        }

        Collections.sort(outcomes, (lc1, lc2) -> lc1.getId().compareTo(lc2.getId()));
    } else {

        List<CrpProgram> allPrograms = loggedCrp.getCrpPrograms().stream()
                .filter(c -> c.getProgramType() == ProgramType.FLAGSHIP_PROGRAM_TYPE.getValue() && c.isActive())
                .collect(Collectors.toList());
        allPrograms.sort((p1, p2) -> p1.getAcronym().compareTo(p2.getAcronym()));
        crpProgramID = -1;
        if (allPrograms != null) {

            this.programs = allPrograms;
            try {
                crpProgramID = Long.parseLong(
                        StringUtils.trim(this.getRequest().getParameter(APConstants.CRP_PROGRAM_ID)));
            } catch (Exception e) {

                User user = userManager.getUser(this.getCurrentUser().getId());
                List<CrpProgramLeader> userLeads = user.getCrpProgramLeaders().stream().filter(c -> c.isActive()
                        && c.getCrpProgram().isActive() && c.getCrpProgram() != null

                        && c.getCrpProgram().getProgramType() == ProgramType.FLAGSHIP_PROGRAM_TYPE.getValue())
                        .collect(Collectors.toList());
                if (!userLeads.isEmpty()) {
                    crpProgramID = userLeads.get(0).getCrpProgram().getId();
                } else {
                    if (!this.programs.isEmpty()) {
                        crpProgramID = this.programs.get(0).getId();
                    }
                }

            }
        } else {
            programs = new ArrayList<>();
        }

        if (crpProgramID != -1) {
            selectedProgram = crpProgramManager.getCrpProgramById(crpProgramID);
            outcomes.addAll(selectedProgram.getCrpProgramOutcomes().stream()
                    .filter(c -> c.isActive() && c.getPhase().equals(this.getActualPhase()))
                    .collect(Collectors.toList()));

        }

        if (selectedProgram != null) {

            milestoneYears = this.getTargetYears();

            Path path = this.getAutoSaveFilePath();

            if (path.toFile().exists() && this.getCurrentUser().isAutoSave()) {

                BufferedReader reader = null;

                reader = new BufferedReader(new FileReader(path.toFile()));

                Gson gson = new GsonBuilder().create();

                JsonObject jReader = gson.fromJson(reader, JsonObject.class);
                reader.close();

                AutoSaveReader autoSaveReader = new AutoSaveReader();

                selectedProgram = (CrpProgram) autoSaveReader.readFromJson(jReader);
                outcomes = selectedProgram.getOutcomes();
                selectedProgram
                        .setAcronym(crpProgramManager.getCrpProgramById(selectedProgram.getId()).getAcronym());
                selectedProgram.setBaseLine(
                        crpProgramManager.getCrpProgramById(selectedProgram.getId()).getBaseLine());

                selectedProgram.setCrp(loggedCrp);
                if (outcomes == null) {
                    outcomes = new ArrayList<>();
                }
                for (CrpProgramOutcome outcome : outcomes) {

                    if (outcome.getSubIdos() != null) {
                        for (CrpOutcomeSubIdo subIdo : outcome.getSubIdos()) {
                            if (subIdo.getSrfSubIdo() != null && subIdo.getSrfSubIdo().getId() != null) {
                                subIdo.setSrfSubIdo(
                                        srfSubIdoManager.getSrfSubIdoById(subIdo.getSrfSubIdo().getId()));
                            }
                        }
                    }
                    if (outcome.getFile() != null) {
                        if (outcome.getFile().getId() != null) {
                            outcome.setFile(fileDBManager.getFileDBById(outcome.getFile().getId()));
                        } else {
                            outcome.setFile(null);
                        }
                    }
                }

                this.setDraft(true);
            } else {
                this.loadInfo();
                this.setDraft(false);
            }

            String params[] = { loggedCrp.getAcronym(), selectedProgram.getId().toString() };
            this.setBasePermission(this.getText(Permission.IMPACT_PATHWAY_BASE_PERMISSION, params));
            if (!selectedProgram.getSubmissions().stream()
                    .filter(c -> c.getYear() == this.getActualPhase().getYear() && c.getCycle() != null
                            && c.getCycle().equals(this.getActualPhase().getDescription())
                            && (c.isUnSubmit() == null || !c.isUnSubmit()))
                    .collect(Collectors.toList()).isEmpty()) {
                if (!(this.canAccessSuperAdmin() || this.canAcessCrpAdmin())) {
                    this.setCanEdit(false);
                    this.setEditable(false);
                }

                this.setSubmission(selectedProgram.getSubmissions().stream()
                        .filter(c -> c.getYear() == this.getActualPhase().getYear() && c.getCycle() != null
                                && c.getCycle().equals(this.getActualPhase().getDescription()))
                        .collect(Collectors.toList()).get(0));
            }

        }

        if (this.isHttpPost()) {
            outcomes.clear();
        }
    }

    idoList = new HashMap<>();
    srfIdos = new ArrayList<>();
    for (SrfIdo srfIdo : srfIdoManager.findAll().stream().filter(c -> c.isActive())
            .collect(Collectors.toList())) {
        idoList.put(srfIdo.getId(), srfIdo.getDescription());

        srfIdo.setSubIdos(
                srfIdo.getSrfSubIdos().stream().filter(c -> c.isActive()).collect(Collectors.toList()));
        srfIdos.add(srfIdo);
    }

}

From source file:org.onosproject.EvacuateCommand.java

protected SortedMap<Device, List<FlowEntry>> getSortedFlows(DeviceService deviceService,
        FlowRuleService flowRuleService) {
    SortedMap<Device, List<FlowEntry>> sortedFlows = new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
    List<FlowEntry> flowList;
    FlowEntryState flowEntryState = null;

    if (state != null && !state.equals("any")) {
        flowEntryState = FlowEntryState.valueOf(state.toUpperCase());
    }//from   ww  w .  ja  v  a  2s .c  om
    Iterable<Device> devices = null;

    if (uri == null) {
        devices = deviceService.getDevices();
    } else {
        Device d = deviceService.getDevice(DeviceId.deviceId(uri));
        devices = (d == null) ? deviceService.getDevices() : Collections.singletonList(d);
    }

    for (Device d : devices) {
        if (flowEntryState == null) {
            flowList = newArrayList(flowRuleService.getFlowEntries(d.id()));
        } else {
            flowList = newArrayList();
            for (FlowEntry f : flowRuleService.getFlowEntries(d.id())) {
                if (f.state().equals(flowEntryState)) {
                    flowList.add(f);
                }
            }
        }
        flowList.sort(Comparators.FLOW_RULE_COMPARATOR);
        sortedFlows.put(d, flowList);
    }
    return sortedFlows;
}

From source file:org.eclipse.packagedrone.repo.channel.web.channel.ChannelController.java

@Secured(false)
@RequestMapping(value = "/channel", method = RequestMethod.GET)
@HttpConstraint(PERMIT)//from  ww  w . j  a v  a2  s . c  o  m
public ModelAndView list(@RequestParameter(value = "start", required = false) final Integer startPage) {
    final ModelAndView result = new ModelAndView("channel/list");

    final List<ChannelListEntry> channels = this.channelService.list().stream()
            .flatMap(ChannelController::toEntry).collect(Collectors.toList());
    channels.sort(CHANNEL_LIST_ENTRY_COMPARATOR);

    result.put("channels", Pagination.paginate(startPage, 10, channels));

    return result;
}

From source file:org.cgiar.ccafs.marlo.action.powb.PowbCollaborationAction.java

public void loadLocElementsRelations(LocElement locElement) {

    HashSet<Project> project = new HashSet<>();
    HashSet<FundingSource> fundingSources = new HashSet<>();

    List<ProjectLocation> locations = locElement
            .getProjectLocations().stream().filter(c -> c.isActive() && c.getPhase() != null
                    && c.getPhase().equals(this.getActualPhase()) && c.getProject().isActive())
            .collect(Collectors.toList());
    locations.sort((p1, p2) -> p1.getProject().getId().compareTo(p2.getProject().getId()));
    for (ProjectLocation projectLocation : locations) {
        projectLocation.getProject()/*from   www .j a va2  s .  co  m*/
                .setProjectInfo(projectLocation.getProject().getProjecInfoPhase(this.getActualPhase()));
        if (globalUnitProjectManager.findByProjectId(projectLocation.getProject().getId()).getGlobalUnit()
                .equals(loggedCrp)) {
            if (projectLocation.getProject().getProjectInfo().getStatus().intValue() == Integer
                    .parseInt(ProjectStatusEnum.Ongoing.getStatusId())
                    || projectLocation.getProject().getProjectInfo().getStatus().intValue() == Integer
                            .parseInt(ProjectStatusEnum.Extended.getStatusId())) {
                if (projectLocation.getProject().isActive()
                        && projectLocation.getProject().getProjectInfo() != null) {
                    project.add(projectLocation.getProject());
                }

            }
        }

    }

    List<LocElement> locElementsParent = locElementManager.findAll().stream()
            .filter(c -> c.getLocElement() != null && c.getLocElement().getId().equals(locElement.getId()))
            .collect(Collectors.toList());

    for (LocElement locElementParent : locElementsParent) {

        locations = locElementParent
                .getProjectLocations().stream().filter(c -> c.isActive() && c.getPhase() != null
                        && c.getPhase().equals(this.getActualPhase()) && c.getProject().isActive())
                .collect(Collectors.toList());
        locations.sort((p1, p2) -> p1.getProject().getId().compareTo(p2.getProject().getId()));
        for (ProjectLocation projectLocation : locations) {
            projectLocation.getProject()
                    .setProjectInfo(projectLocation.getProject().getProjecInfoPhase(this.getActualPhase()));
            if (globalUnitProjectManager.findByProjectId(projectLocation.getProject().getId()).getGlobalUnit()
                    .equals(loggedCrp)) {
                if (projectLocation.getProject().getProjectInfo().getStatus().intValue() == Integer
                        .parseInt(ProjectStatusEnum.Ongoing.getStatusId())
                        || projectLocation.getProject().getProjectInfo().getStatus().intValue() == Integer
                                .parseInt(ProjectStatusEnum.Extended.getStatusId())) {
                    if (projectLocation.getProject().isActive()
                            && projectLocation.getProject().getProjectInfo() != null) {
                        project.add(projectLocation.getProject());
                    }

                }
            }

        }
    }

    List<FundingSourceLocation> locationsFunding = locElement.getFundingSourceLocations().stream()
            .filter(c -> c.isActive() && c.getPhase().equals(this.getActualPhase())
                    && c.getFundingSource().isActive() && c.getFundingSource().getCrp().equals(loggedCrp))
            .collect(Collectors.toList());
    locationsFunding.sort((p1, p2) -> p1.getFundingSource().getId().compareTo(p2.getFundingSource().getId()));

    for (FundingSourceLocation fundingSourceLocation : locationsFunding) {
        fundingSourceLocation.getFundingSource().setFundingSourceInfo(
                fundingSourceLocation.getFundingSource().getFundingSourceInfo(this.getActualPhase()));
        if (fundingSourceLocation.getFundingSource().getFundingSourceInfo(this.getActualPhase())
                .getStatus() == Integer.parseInt(FundingStatusEnum.Ongoing.getStatusId())
                || fundingSourceLocation.getFundingSource().getFundingSourceInfo(this.getActualPhase())
                        .getStatus() == Integer.parseInt(FundingStatusEnum.Pipeline.getStatusId())
                || fundingSourceLocation.getFundingSource().getFundingSourceInfo(this.getActualPhase())
                        .getStatus() == Integer.parseInt(FundingStatusEnum.Informally.getStatusId())

                || fundingSourceLocation.getFundingSource().getFundingSourceInfo(this.getActualPhase())
                        .getStatus() == Integer.parseInt(FundingStatusEnum.Extended.getStatusId())) {
            if (fundingSourceLocation.getFundingSource().getFundingSourceInfo() != null
                    && fundingSourceLocation.getFundingSource().isActive()) {
                fundingSources.add(fundingSourceLocation.getFundingSource());
            }

        }
    }

    locElement.setProjects(new ArrayList<>());
    locElement.setFundingSources(new ArrayList<>());
    locElement.getProjects().addAll(project);
    locElement.getFundingSources().addAll(fundingSources);
}

From source file:com.github.pierods.ramltoapidocconverter.RAMLToApidocConverter.java

private List<Apidoc.Operation> walkSubresources(Resource rootResource) {

    List<Apidoc.Operation> operations = new ArrayList<>();

    class NameAndResource {

        public NameAndResource(String name, Resource resource) {
            this.name = name;
            this.resource = resource;
        }//from www . j  av  a  2 s  . com

        public String name;
        public Resource resource;
    }

    Queue<NameAndResource> bfsAccumulator = new LinkedList<>();

    // path is specified only once for the resource. Subpaths will be only specified if parameters (:xxx), see getOperations()
    bfsAccumulator.add(new NameAndResource("", rootResource));

    while (!bfsAccumulator.isEmpty()) {

        NameAndResource nr = bfsAccumulator.remove();

        operations.addAll(getOperations(nr.name, nr.resource));

        Map<String, Resource> subresources = nr.resource.getResources();

        for (String resourceName : subresources.keySet()) {
            bfsAccumulator.add(new NameAndResource(nr.name + resourceName, subresources.get(resourceName)));
        }

    }

    operations.sort((operation1, operation2) -> {
        if (operation1.path == null) {
            return 1;
        }
        if (operation2.path == null) {
            return -1;
        }

        return operation1.path.compareTo(operation2.path);
    });

    return operations;
}

From source file:org.opencb.opencga.storage.mongodb.variant.load.variants.MongoDBVariantMerger.java

private List<Integer> buildIndexedSamplesList(List<Integer> fileIds) {
    List<Integer> indexedSamples = new LinkedList<>(
            StudyConfiguration.getIndexedSamples(studyConfiguration).values());
    for (Integer fileId : fileIds) {
        indexedSamples.removeAll(getSamplesInFile(fileId));
    }/*from  w  w w  .j a va2 s  .c o  m*/
    indexedSamples.sort(Integer::compareTo);
    return indexedSamples;
}