Search in sources :

Example 41 with LinkedHashSet

use of java.util.LinkedHashSet in project hazelcast by hazelcast.

the class MapServiceContextImpl method reloadOwnedPartitions.

@Override
public void reloadOwnedPartitions() {
    IPartitionService partitionService = nodeEngine.getPartitionService();
    Collection<Integer> partitions = partitionService.getMemberPartitions(nodeEngine.getThisAddress());
    ownedPartitions.set(Collections.unmodifiableSet(new LinkedHashSet<Integer>(partitions)));
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) LinkedHashSet(java.util.LinkedHashSet) IPartitionService(com.hazelcast.spi.partition.IPartitionService)

Example 42 with LinkedHashSet

use of java.util.LinkedHashSet in project gradle by gradle.

the class JsonProjectDependencyRenderer method createInsight.

private List createInsight(ModuleIdentifier module, final Configuration configuration) {
    final Spec<DependencyResult> dependencySpec = new StrictDependencyResultSpec(module);
    ResolutionResult result = configuration.getIncoming().getResolutionResult();
    final Set<DependencyResult> selectedDependencies = new LinkedHashSet<DependencyResult>();
    result.allDependencies(new Action<DependencyResult>() {

        @Override
        public void execute(DependencyResult it) {
            if (dependencySpec.isSatisfiedBy(it)) {
                selectedDependencies.add(it);
            }
        }
    });
    Collection<RenderableDependency> sortedDeps = new DependencyInsightReporter().prepare(selectedDependencies, versionSelectorScheme, versionComparator);
    return CollectionUtils.collect(sortedDeps, new Transformer<Object, RenderableDependency>() {

        @Override
        public Object transform(RenderableDependency dependency) {
            String name = replaceArrow(dependency.getName());
            LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(5);
            map.put("name", replaceArrow(dependency.getName()));
            map.put("description", dependency.getDescription());
            map.put("resolvable", dependency.getResolutionState());
            map.put("hasConflict", !name.equals(dependency.getName()));
            map.put("children", createInsightDependencyChildren(dependency, new HashSet<Object>(), configuration));
            return map;
        }
    });
}
Also used : LinkedHashSet(java.util.LinkedHashSet) RenderableDependency(org.gradle.api.tasks.diagnostics.internal.graph.nodes.RenderableDependency) DependencyResult(org.gradle.api.artifacts.result.DependencyResult) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) LinkedHashMap(java.util.LinkedHashMap) DependencyInsightReporter(org.gradle.api.tasks.diagnostics.internal.insight.DependencyInsightReporter)

Example 43 with LinkedHashSet

use of java.util.LinkedHashSet in project gradle by gradle.

the class DefaultArtifactSet method snapshot.

@Override
public ArtifactSet snapshot() {
    ImmutableSet.Builder<ResolvedVariant> result = ImmutableSet.builder();
    for (VariantMetadata variant : variants) {
        Set<? extends ComponentArtifactMetadata> artifacts = variant.getArtifacts();
        Set<ResolvedArtifact> resolvedArtifacts = new LinkedHashSet<ResolvedArtifact>(artifacts.size());
        // Add artifact format as an implicit attribute when all artifacts have the same format
        AttributeContainerInternal attributes = variant.getAttributes();
        if (!attributes.contains(ArtifactAttributes.ARTIFACT_FORMAT)) {
            String format = null;
            for (ComponentArtifactMetadata artifact : artifacts) {
                String candidateFormat = artifact.getName().getType();
                if (format == null) {
                    format = candidateFormat;
                } else if (!format.equals(candidateFormat)) {
                    format = null;
                    break;
                }
            }
            if (format != null) {
                attributes = attributesFactory.concat(attributes.asImmutable(), ArtifactAttributes.ARTIFACT_FORMAT, format);
            }
        }
        for (ComponentArtifactMetadata artifact : artifacts) {
            IvyArtifactName artifactName = artifact.getName();
            if (exclusions.excludeArtifact(moduleVersionIdentifier.getModule(), artifactName)) {
                continue;
            }
            ResolvedArtifact resolvedArtifact = allResolvedArtifacts.get(artifact.getId());
            if (resolvedArtifact == null) {
                Factory<File> artifactSource = new BuildOperationArtifactSource(buildOperationExecutor, artifact.getId(), new LazyArtifactSource(artifact, moduleSource, artifactResolver));
                resolvedArtifact = new DefaultResolvedArtifact(moduleVersionIdentifier, artifactName, artifact.getId(), artifact.getBuildDependencies(), artifactSource);
                allResolvedArtifacts.put(artifact.getId(), resolvedArtifact);
            }
            resolvedArtifacts.add(resolvedArtifact);
        }
        result.add(ArtifactBackedResolvedVariant.create(attributes, resolvedArtifacts));
    }
    return new ArtifactSetSnapshot(id, componentIdentifier, result.build());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) VariantMetadata(org.gradle.internal.component.model.VariantMetadata) DefaultResolvedArtifact(org.gradle.api.internal.artifacts.DefaultResolvedArtifact) ResolvedArtifact(org.gradle.api.artifacts.ResolvedArtifact) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal) ImmutableSet(com.google.common.collect.ImmutableSet) ComponentArtifactMetadata(org.gradle.internal.component.model.ComponentArtifactMetadata) DefaultResolvedArtifact(org.gradle.api.internal.artifacts.DefaultResolvedArtifact) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) File(java.io.File)

Example 44 with LinkedHashSet

use of java.util.LinkedHashSet in project gradle by gradle.

the class ExternalResourceResolver method doListModuleVersions.

private void doListModuleVersions(DependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) {
    ModuleIdentifier module = moduleIdentifierFactory.module(dependency.getRequested().getGroup(), dependency.getRequested().getName());
    Set<String> versions = new LinkedHashSet<String>();
    VersionPatternVisitor visitor = versionLister.newVisitor(module, versions, result);
    // List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns())
    IvyArtifactName metaDataArtifact = getMetaDataArtifactName(dependency.getRequested().getName());
    listVersionsForAllPatterns(ivyPatterns, metaDataArtifact, visitor);
    // List modules with missing metadata files
    for (IvyArtifactName otherArtifact : getDependencyArtifactNames(dependency.getRequested().getName(), dependency.getArtifacts())) {
        listVersionsForAllPatterns(artifactPatterns, otherArtifact, visitor);
    }
    result.listed(versions);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier)

Example 45 with LinkedHashSet

use of java.util.LinkedHashSet in project grails-core by grails.

the class FetchAllTaskSelectorsBuildAction method execute.

public AllTasksModel execute(BuildController controller) {
    AllTasksModel model = new AllTasksModel();
    Map<String, Set<String>> allTaskSelectors = new LinkedHashMap<String, Set<String>>();
    model.allTaskSelectors = allTaskSelectors;
    Map<String, Set<String>> allTasks = new LinkedHashMap<String, Set<String>>();
    model.allTasks = allTasks;
    Map<String, String> projectPaths = new HashMap<String, String>();
    model.projectPaths = projectPaths;
    for (BasicGradleProject project : controller.getBuildModel().getProjects()) {
        BuildInvocations entryPointsForProject = controller.getModel(project, BuildInvocations.class);
        Set<String> selectorNames = new LinkedHashSet<String>();
        for (TaskSelector selector : entryPointsForProject.getTaskSelectors()) {
            selectorNames.add(selector.getName());
        }
        allTaskSelectors.put(project.getName(), selectorNames);
        Set<String> taskNames = new LinkedHashSet<String>();
        for (Task task : entryPointsForProject.getTasks()) {
            taskNames.add(task.getName());
        }
        allTasks.put(project.getName(), taskNames);
        projectPaths.put(project.getName(), project.getPath());
        if (project.getProjectDirectory().getAbsolutePath().equals(currentProjectPath)) {
            model.currentProject = project.getName();
        }
    }
    return model;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Task(org.gradle.tooling.model.Task) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) BasicGradleProject(org.gradle.tooling.model.gradle.BasicGradleProject) BuildInvocations(org.gradle.tooling.model.gradle.BuildInvocations) TaskSelector(org.gradle.tooling.model.TaskSelector) LinkedHashMap(java.util.LinkedHashMap) AllTasksModel(org.grails.cli.gradle.FetchAllTaskSelectorsBuildAction.AllTasksModel)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)1511 ArrayList (java.util.ArrayList)292 Set (java.util.Set)194 HashSet (java.util.HashSet)163 HashMap (java.util.HashMap)142 File (java.io.File)128 Map (java.util.Map)125 LinkedHashMap (java.util.LinkedHashMap)110 IOException (java.io.IOException)108 List (java.util.List)104 Test (org.junit.Test)103 ProcessResult (org.asqatasun.entity.audit.ProcessResult)77 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)73 LinkedList (java.util.LinkedList)63 URL (java.net.URL)43 Collection (java.util.Collection)41 DataCell (org.knime.core.data.DataCell)39 DataColumnSpec (org.knime.core.data.DataColumnSpec)39 Iterator (java.util.Iterator)38 TreeSet (java.util.TreeSet)35