All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.sviperll.maven.profiledep.resolution.ProfileCollector Maven / Gradle / Ivy

The newest version!
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.github.sviperll.maven.profiledep.resolution;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.maven.model.Profile;

/**
 *
 * @author vir
 */
class ProfileCollector {
    private final List activeProfiles = new ArrayList();
    private final Set activeProfilesSet = new HashSet();

    ProfileCollector() {
    }

    private ProfileCollector(List activeProfiles, Set activeProfilesSet) {
        activeProfiles.addAll(activeProfiles);
        activeProfilesSet.addAll(activeProfilesSet);
    }

    void addAll(List profiles) {
        for (Profile profile: profiles) {
            add(profile);
        }
    }

    void add(Profile profile) {
        if (!activeProfilesSet.contains(profile)) {
            activeProfilesSet.add(profile);
            activeProfiles.add(profile);
        }
    }

    List activeProfiles() {
        List result = new ArrayList();
        result.addAll(activeProfiles);
        return result;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy