Java Code Examples for org.gradle.util.CollectionUtils#sort()
The following examples show how to use
org.gradle.util.CollectionUtils#sort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskTreePopulationVisitor.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private static <P, T> List<T> visitTasks(Visitor<P, T> visitor, ProjectAndTaskFilter filter, ProjectView project, int startingIndex, P userProjectObject, Comparator<TaskView> taskSorter) { List<T> taskObjects = new ArrayList<T>(); List<TaskView> tasks = CollectionUtils.sort(project.getTasks(), taskSorter); //make a copy because we're going to sort them Iterator<TaskView> iterator = tasks.iterator(); int index = startingIndex; while (iterator.hasNext()) { TaskView task = iterator.next(); if (filter.doesAllowTask(task)) { T taskObject = visitor.visitTask(task, index, project, userProjectObject); taskObjects.add(taskObject); } index++; } return taskObjects; }
Example 2
Source File: TaskTreePopulationVisitor.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private static <P, T> List<T> visitTasks(Visitor<P, T> visitor, ProjectAndTaskFilter filter, ProjectView project, int startingIndex, P userProjectObject, Comparator<TaskView> taskSorter) { List<T> taskObjects = new ArrayList<T>(); List<TaskView> tasks = CollectionUtils.sort(project.getTasks(), taskSorter); //make a copy because we're going to sort them Iterator<TaskView> iterator = tasks.iterator(); int index = startingIndex; while (iterator.hasNext()) { TaskView task = iterator.next(); if (filter.doesAllowTask(task)) { T taskObject = visitor.visitTask(task, index, project, userProjectObject); taskObjects.add(taskObject); } index++; } return taskObjects; }
Example 3
Source File: ModelPathSuggestionProvider.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public List<ModelPath> transform(final ModelPath unavailable) { Iterable<Suggestion> suggestions = Iterables.transform(availablePaths, new Function<ModelPath, Suggestion>() { public Suggestion apply(ModelPath available) { int distance = StringUtils.getLevenshteinDistance(unavailable.toString(), available.toString()); boolean suggest = distance <= Math.min(3, unavailable.toString().length() / 2); if (suggest) { return new Suggestion(distance, available); } else { // avoid excess creation of Suggestion objects return null; } } }); suggestions = Iterables.filter(suggestions, REMOVE_NULLS); List<Suggestion> sortedSuggestions = CollectionUtils.sort(suggestions); return CollectionUtils.collect(sortedSuggestions, Suggestion.EXTRACT_PATH); }
Example 4
Source File: TaskTreePopulationVisitor.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private static <P, T> List<T> visitTasks(Visitor<P, T> visitor, ProjectAndTaskFilter filter, ProjectView project, int startingIndex, P userProjectObject, Comparator<TaskView> taskSorter) { List<T> taskObjects = new ArrayList<T>(); List<TaskView> tasks = CollectionUtils.sort(project.getTasks(), taskSorter); //make a copy because we're going to sort them Iterator<TaskView> iterator = tasks.iterator(); int index = startingIndex; while (iterator.hasNext()) { TaskView task = iterator.next(); if (filter.doesAllowTask(task)) { T taskObject = visitor.visitTask(task, index, project, userProjectObject); taskObjects.add(taskObject); } index++; } return taskObjects; }
Example 5
Source File: BuildMetrics.java From gradle-metrics-plugin with Apache License 2.0 | 5 votes |
public CompositeOperation<Operation> getProjectConfiguration() { List<Operation> operations = new ArrayList<Operation>(); for (ProjectMetrics projectMetrics : projects.values()) { operations.add(projectMetrics.getConfigurationOperation()); } operations = CollectionUtils.sort(operations, Operation.slowestFirst()); return new CompositeOperation<Operation>(operations); }
Example 6
Source File: BuildProfile.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public CompositeOperation<Operation> getProjectConfiguration() { List<Operation> operations = new ArrayList<Operation>(); for (ProjectProfile projectProfile : projects.values()) { operations.add(projectProfile.getConfigurationOperation()); } operations = CollectionUtils.sort(operations, Operation.slowestFirst()); return new CompositeOperation<Operation>(operations); }
Example 7
Source File: TaskTreePopulationVisitor.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private static <P, T> List<P> visitProjects(Visitor<P, T> visitor, ProjectAndTaskFilter filter, List<ProjectView> sourceProjects, P parentProjectObject, Comparator<ProjectView> projectSorter, Comparator<TaskView> taskSorter) { List<P> projectObjects = new ArrayList<P>(); sourceProjects = CollectionUtils.sort(sourceProjects, projectSorter); //make a copy because we're going to sort them. Iterator<ProjectView> iterator = sourceProjects.iterator(); int index = 0; while (iterator.hasNext()) { ProjectView project = iterator.next(); if (filter.doesAllowProject(project)) { P userProjectObject = visitor.visitProject(project, index, parentProjectObject); projectObjects.add(userProjectObject); //visit sub projects List<P> subProjectObjects = visitProjects(visitor, filter, project.getSubProjects(), userProjectObject, projectSorter, taskSorter); //visit tasks. Notice that we pass in the number of subprojects as a starting index. This is so they'll come afterwards. List<T> taskObjects = visitTasks(visitor, filter, project, subProjectObjects.size(), userProjectObject, taskSorter); visitor.completedVisitingProject(userProjectObject, subProjectObjects, taskObjects); } index++; } return projectObjects; }
Example 8
Source File: OptionReader.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public List<OptionDescriptor> getOptions(Object target) { final Class<?> targetClass = target.getClass(); Map<String, OptionDescriptor> options = new HashMap<String, OptionDescriptor>(); if (!cachedOptionElements.containsKey(targetClass)) { loadClassDescriptorInCache(target); } for (OptionElement optionElement : cachedOptionElements.get(targetClass)) { JavaMethod<Object, Collection> optionValueMethod = cachedOptionValueMethods.get(optionElement); options.put(optionElement.getOptionName(), new InstanceOptionDescriptor(target, optionElement, optionValueMethod)); } return CollectionUtils.sort(options.values()); }
Example 9
Source File: LatestVersionStrategy.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public <T extends Versioned> List<T> sort(Collection<T> versions) { return CollectionUtils.sort(versions, this); }
Example 10
Source File: ProjectProfile.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Returns the task executions for this project. */ public CompositeOperation<TaskExecution> getTasks() { List<TaskExecution> taskExecutions = CollectionUtils.sort(tasks.values(), Operation.slowestFirst()); return new CompositeOperation<TaskExecution>(taskExecutions); }
Example 11
Source File: BuildMetrics.java From gradle-metrics-plugin with Apache License 2.0 | 4 votes |
public CompositeOperation<ContinuousOperation> getDependencySets() { final List<ContinuousOperation> profiles = CollectionUtils.sort(dependencySets.values(), Operation.slowestFirst()); return new CompositeOperation<ContinuousOperation>(profiles); }
Example 12
Source File: ProjectReportTask.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private List<Project> getChildren(Project project) { return CollectionUtils.sort(project.getChildProjects().values()); }
Example 13
Source File: BuildProfile.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public CompositeOperation<ContinuousOperation> getDependencySets() { final List<ContinuousOperation> profiles = CollectionUtils.sort(dependencySets.values(), Operation.slowestFirst()); return new CompositeOperation<ContinuousOperation>(profiles); }
Example 14
Source File: ProjectProfile.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Returns the task executions for this project. */ public CompositeOperation<TaskExecution> getTasks() { List<TaskExecution> taskExecutions = CollectionUtils.sort(tasks.values(), Operation.slowestFirst()); return new CompositeOperation<TaskExecution>(taskExecutions); }
Example 15
Source File: BuildProfile.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public CompositeOperation<ContinuousOperation> getDependencySets() { final List<ContinuousOperation> profiles = CollectionUtils.sort(dependencySets.values(), Operation.slowestFirst()); return new CompositeOperation<ContinuousOperation>(profiles); }
Example 16
Source File: UniqueNameProjectAndTaskVisitor.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public List<String> getSortedProjectNames() { return CollectionUtils.sort(projectNames); }
Example 17
Source File: ProjectProfile.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Returns the task executions for this project. */ public CompositeOperation<TaskExecution> getTasks() { List<TaskExecution> taskExecutions = CollectionUtils.sort(tasks.values(), Operation.slowestFirst()); return new CompositeOperation<TaskExecution>(taskExecutions); }
Example 18
Source File: UniqueNameProjectAndTaskVisitor.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public List<String> getSortedProjectNames() { return CollectionUtils.sort(projectNames); }
Example 19
Source File: AmbiguousBindingReporter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public AmbiguousBindingReporter(String referenceType, String referenceDescription, List<Provider> providers) { this.referenceType = referenceType; this.referenceDescription = referenceDescription; this.providers = CollectionUtils.sort(providers, PROVIDER_COMPARATOR); }
Example 20
Source File: BuildProfile.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Get a list of the profiling containers for all projects * @return list */ public List<ProjectProfile> getProjects() { return CollectionUtils.sort(projects.values(), Operation.slowestFirst()); }