Example usage for java.util Map putIfAbsent

List of usage examples for java.util Map putIfAbsent

Introduction

In this page you can find the example usage for java.util Map putIfAbsent.

Prototype

default V putIfAbsent(K key, V value) 

Source Link

Document

If the specified key is not already associated with a value (or is mapped to null ) associates it with the given value and returns null , else returns the current value.

Usage

From source file:org.springframework.boot.actuate.endpoint.annotation.AnnotationEndpointDiscoverer.java

private void addExtension(Map<Class<?>, DiscoveredEndpoint> endpoints,
        Map<Class<?>, DiscoveredExtension> extensions, String beanName) {
    Class<?> extensionType = this.applicationContext.getType(beanName);
    Class<?> endpointType = getEndpointType(extensionType);
    DiscoveredEndpoint endpoint = getExtendingEndpoint(endpoints, extensionType, endpointType);
    if (isExtensionExposed(endpointType, extensionType, endpoint.getInfo())) {
        Assert.state(endpoint.isExposed() || isEndpointFiltered(endpoint.getInfo()),
                () -> "Invalid extension " + extensionType.getName() + "': endpoint '" + endpointType.getName()
                        + "' does not support such extension");
        Object target = this.applicationContext.getBean(beanName);
        Map<Method, T> operations = this.operationsFactory.createOperations(endpoint.getInfo().getId(), target,
                extensionType);/*  ww  w. j av  a2s.  c o m*/
        DiscoveredExtension extension = new DiscoveredExtension(extensionType, operations.values());
        DiscoveredExtension previous = extensions.putIfAbsent(endpointType, extension);
        Assert.state(previous == null,
                () -> "Found two extensions for the same endpoint '" + endpointType.getName() + "': "
                        + extension.getExtensionType().getName() + " and "
                        + previous.getExtensionType().getName());
    }
}

From source file:org.onosproject.influxdbmetrics.DefaultInfluxDbMetricsRetriever.java

@Override
public Map<NodeId, List<InfluxMetric>> metricsByName(String metricName, int period, TimeUnit unit) {
    Map<NodeId, List<InfluxMetric>> map = Maps.newHashMap();
    List<InfluxMetric> metrics = Lists.newArrayList();
    String queryPrefix = new StringBuilder().append("SELECT m1_rate FROM").append(database)
            .append(METRIC_DELIMITER).append(quote(DEFAULT_POLICY)).append(METRIC_DELIMITER).toString();
    String querySuffix = new StringBuilder().append(" WHERE time > now() - ").append(period)
            .append(unitString(unit)).toString();

    allMetricNames().keySet().forEach(nodeId -> {
        String queryString = new StringBuilder().append(queryPrefix)
                .append(quote(nodeId + METRIC_DELIMITER + metricName)).append(querySuffix).toString();
        Query query = new Query(queryString, database);
        List<QueryResult.Result> results = influxDB.query(query).getResults();

        if (results != null && results.get(0) != null && results.get(0).getSeries() != null) {

            results.get(0).getSeries().get(0).getValues()
                    .forEach(value -> metrics.add(new DefaultInfluxMetric.Builder().time((String) value.get(0))
                            .oneMinRate((Double) value.get(1)).build()));
            map.putIfAbsent(nodeId, metrics);
        }// ww w. jav  a2  s. c  o  m
    });

    return map;
}

From source file:org.onosproject.drivers.odtn.OpenConfigDeviceDiscovery.java

/**
 * Converts Component subtree to PortDescription.
 *
 * @param component subtree to parse// w ww  .  j  a  v  a  2 s .c  o m
 * @return PortDescription or null if component is not an ONOS Port
 */
private PortDescription toPortDescriptionInternal(HierarchicalConfiguration component) {

    // to access other part of <data> tree:
    //log.warn("parent data Node: {}",
    //       ((SubnodeConfiguration) component).getParent().getRootNode().getName());

    Map<String, String> props = new HashMap<>();

    String name = component.getString("name");
    String type = component.getString("state/type");
    checkNotNull(name, "name not found");
    checkNotNull(type, "state/type not found");
    props.put(OdtnDeviceDescriptionDiscovery.OC_NAME, name);
    props.put(OdtnDeviceDescriptionDiscovery.OC_TYPE, type);

    component.configurationsAt("properties/property").forEach(prop -> {
        String pName = prop.getString("name");
        String pValue = prop.getString("config/value");
        props.put(pName, pValue);
    });

    if (!props.containsKey(ONOS_PORT_INDEX)) {
        log.info("DEBUG: Component {} does not include onos-index, skipping", name);
        // ODTN: port must have onos-index property
        return null;
    }

    Builder builder = DefaultPortDescription.builder();
    builder.withPortNumber(PortNumber.portNumber(Long.parseLong(props.get(ONOS_PORT_INDEX)), name));

    switch (type) {
    case "oc-platform-types:PORT":
    case "oc-opt-types:OPTICAL_CHANNEL":
        // TODO assign appropriate port type & annotations at some point
        // for now we just need a Port with annotations
        builder.type(Type.OCH);

        props.putIfAbsent(PORT_TYPE, OdtnPortType.LINE.value());

        // Just a heuristics to deal with simple transponder
        // if the device declare odtn-connection-id, just use them
        // if not assign same value to relevant ports types
        props.putIfAbsent(CONNECTION_ID, "the-only-one");
        break;

    case "oc-platform-types:TRANSCEIVER":
        // TODO assign appropriate port type & annotations at some point
        // for now we just need a Port with annotations
        builder.type(Type.PACKET);

        props.putIfAbsent(PORT_TYPE, OdtnPortType.CLIENT.value());

        // Just a heuristics to deal with simple transponder
        // if the device declare odtn-connection-id, just use them
        // if not assign same value to relevant ports types
        props.putIfAbsent(CONNECTION_ID, "the-only-one");
        break;

    default:
        log.info("DEBUG: Unknown component type {}", type);
        return null;
    }

    builder.annotations(DefaultAnnotations.builder().putAll(props).build());

    return builder.build();

}

From source file:org.wso2.carbon.identity.application.authentication.framework.config.model.graph.JsGraphBuilder.java

/**
 * Filter out options in the step config to retain only the options provided in authentication options
 * @param authenticationOptions Authentication options to keep
 * @param stepConfig The step config to be modified
 *///  w  w w  .ja  va2s  .  co m
protected void filterOptions(Map<String, Map<String, String>> authenticationOptions, StepConfig stepConfig) {

    Map<String, Set<String>> filteredOptions = new HashMap<>();
    authenticationOptions.forEach((id, option) -> {
        String idp = option.get(FrameworkConstants.JSAttributes.IDP);
        String authenticator = option.get(FrameworkConstants.JSAttributes.AUTHENTICATOR);
        if (StringUtils.isNotBlank(authenticator) && StringUtils.isBlank(idp)) {
            // If Idp is not set, but authenticator is set, idp is assumed as local
            idp = FrameworkConstants.LOCAL_IDP_NAME;
        }
        if (StringUtils.isNotBlank(idp)) {
            filteredOptions.putIfAbsent(idp, new HashSet<>());
            if (StringUtils.isNotBlank(authenticator)) {
                filteredOptions.get(idp).add(authenticator);
            }
        }
    });
    if (log.isDebugEnabled()) {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, Set<String>> entry : filteredOptions.entrySet()) {
            sb.append('\n').append(entry.getKey()).append(" : ");
            sb.append(StringUtils.join(entry.getValue(), ","));
        }
        log.debug("Authenticator options: " + sb.toString());
    }
    Set<AuthenticatorConfig> authenticatorsToRemove = new HashSet<>();
    Map<String, AuthenticatorConfig> idpsToRemove = new HashMap<>();
    stepConfig.getAuthenticatorList()
            .forEach(authenticatorConfig -> authenticatorConfig.getIdps().forEach((idpName, idp) -> {
                Set<String> authenticators = filteredOptions.get(idpName);
                boolean removeOption = false;
                if (authenticators == null) {
                    if (log.isDebugEnabled()) {
                        log.debug(String
                                .format("Authentication options didn't include idp: %s. Hence excluding from "
                                        + "options list", idpName));
                    }
                    removeOption = true;
                } else if (!authenticators.isEmpty()) {
                    // Both idp and authenticator present, but authenticator is given by display name due to the fact
                    // that it is the one available at UI. Should translate the display name to actual name, and
                    // keep/remove option
                    removeOption = true;

                    if (FrameworkConstants.LOCAL_IDP_NAME.equals(idpName)) {
                        List<LocalAuthenticatorConfig> localAuthenticators = ApplicationAuthenticatorService
                                .getInstance().getLocalAuthenticators();
                        for (LocalAuthenticatorConfig localAuthenticatorConfig : localAuthenticators) {
                            if (authenticatorConfig.getName().equals(localAuthenticatorConfig.getName())
                                    && authenticators.contains(localAuthenticatorConfig.getDisplayName())) {
                                removeOption = false;
                                break;
                            }
                        }
                        if (log.isDebugEnabled()) {
                            if (removeOption) {
                                log.debug(String.format(
                                        "Authenticator options don't match any entry for local"
                                                + "authenticator: %s. Hence removing the option",
                                        authenticatorConfig.getName()));
                            } else {
                                log.debug(String.format(
                                        "Authenticator options contained a match for local "
                                                + "authenticator: %s. Hence keeping the option",
                                        authenticatorConfig.getName()));
                            }
                        }
                    } else {
                        for (FederatedAuthenticatorConfig federatedAuthConfig : idp
                                .getFederatedAuthenticatorConfigs()) {
                            if (authenticatorConfig.getName().equals(federatedAuthConfig.getName())
                                    && authenticators.contains(federatedAuthConfig.getDisplayName())) {
                                removeOption = false;
                                break;
                            }
                        }
                        if (log.isDebugEnabled()) {
                            if (removeOption) {
                                log.debug(String.format(
                                        "Authenticator options don't match any entry for idp: %s, "
                                                + "authenticator: %s. Hence removing the option",
                                        idpName, authenticatorConfig.getName()));
                            } else {
                                log.debug(String.format(
                                        "Authenticator options contained a match for idp: %s, "
                                                + "authenticator: %s. Hence keeping the option",
                                        idpName, authenticatorConfig.getName()));
                            }
                        }
                    }
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug(String.format(
                                "No authenticator filters for idp %s, hence keeping it as an option", idpName));
                    }
                }
                if (removeOption) {
                    if (authenticatorConfig.getIdps().size() > 1) {
                        idpsToRemove.put(idpName, authenticatorConfig);
                    } else {
                        authenticatorsToRemove.add(authenticatorConfig);
                    }
                }
            }));
    if (stepConfig.getAuthenticatorList().size() > authenticatorsToRemove.size()) {
        idpsToRemove.forEach((idp, authenticatorConfig) -> {
            int index = stepConfig.getAuthenticatorList().indexOf(authenticatorConfig);
            stepConfig.getAuthenticatorList().get(index).getIdps().remove(idp);
            stepConfig.getAuthenticatorList().get(index).getIdpNames().remove(idp);
            if (log.isDebugEnabled()) {
                log.debug("Removed " + idp + " option from " + authenticatorConfig.getName() + " as it "
                        + "doesn't match the provided authenticator options");
            }
        });
        // If all idps are removed from the authenticator the authenticator should be removed.
        stepConfig.getAuthenticatorList().forEach(authenticatorConfig -> {
            if (authenticatorConfig.getIdps().isEmpty()) {
                authenticatorsToRemove.add(authenticatorConfig);
            }
        });
        stepConfig.getAuthenticatorList().removeAll(authenticatorsToRemove);
        if (log.isDebugEnabled()) {
            log.debug("Removed " + authenticatorsToRemove.size() + " options which doesn't match the "
                    + "provided authenticator options");
        }
    } else {
        log.warn("The filtered authenticator list is empty, hence proceeding without filtering");
    }
}

From source file:org.codice.ddf.registry.schemabindings.RegistryPackageWebConverter.java

private static void putRegistryOrganization(OrganizationType organization,
        Map<String, Object> registryObjectListMap) {
    if (organization == null) {
        return;//from w ww  .j a  v a 2s  .  c o  m
    }
    Map<String, Object> organizationMap = new HashMap<>();

    putGeneralInfo(organization, organizationMap);

    if (organization.isSetAddress()) {
        putAddress(organization.getAddress(), organizationMap);
    }

    if (organization.isSetEmailAddress()) {
        putEmailAddress(organization.getEmailAddress(), organizationMap);
    }

    if (organization.isSetParent()) {
        organizationMap.put(PARENT_KEY, organization.getParent());
    }

    if (organization.isSetPrimaryContact()) {
        organizationMap.put(PRIMARY_CONTACT, organization.getPrimaryContact());
    }

    if (organization.isSetTelephoneNumber()) {
        putTelephoneNumber(organization.getTelephoneNumber(), organizationMap);
    }

    if (!organizationMap.isEmpty()) {
        registryObjectListMap.putIfAbsent(ORGANIZATION_KEY, new ArrayList<Map<String, Object>>());
        ((List) registryObjectListMap.get(ORGANIZATION_KEY)).add(organizationMap);
    }
}

From source file:com.michellemay.mappings.MappingsFactory.java

private Mapping createCustomMapping(MappingConfig mappingConfig) {
    if (StringUtils.isBlank(mappingConfig.name)) {
        throw new IllegalArgumentException("Blank mapping name!");
    }/* w  w  w  .  j  a v a 2 s .  c o  m*/

    Map<String, Locale> curMap = new TreeMap<String, Locale>(
            mappingConfig.casesensitive ? null : String.CASE_INSENSITIVE_ORDER);

    // Inherit all mappings from bases
    if (mappingConfig.extend != null) {
        for (String baseMappingName : mappingConfig.extend) {
            if (StringUtils.isBlank(baseMappingName) || !mappings.containsKey(baseMappingName)) {
                throw new IllegalStateException("Base mapping name '" + baseMappingName + "' does not exists!");
            }
            Mapping baseMapping = mappings.get(baseMappingName);
            baseMapping.getMapping().forEach(curMap::putIfAbsent);
        }
    }

    // Filter out unwanted languages
    if (StringUtils.isNotBlank(mappingConfig.filter)) {
        List<Locale.LanguageRange> priorityList = Locale.LanguageRange.parse(mappingConfig.filter);
        List<Locale> toKeep = Locale.filter(priorityList, curMap.values());
        curMap.entrySet().removeIf(e -> !toKeep.contains(e.getValue()));
    }

    // Add new values
    if (mappingConfig.add != null) {
        mappingConfig.add.forEach((lang, values) -> {
            Locale langLocale = LocaleUtils.toLocale(lang);
            String[] displayValues = values.split(",");
            for (String value : displayValues) {
                String cleanedValue = value.trim();
                if (!cleanedValue.isEmpty()) {
                    curMap.putIfAbsent(cleanedValue, langLocale);
                }
            }
        });
    }

    // Override values
    if (mappingConfig.override != null) {
        mappingConfig.override.forEach((lang, values) -> {
            Locale langLocale = LocaleUtils.toLocale(lang);

            // Remove all existing mappings
            String langTag = langLocale.toLanguageTag();
            curMap.entrySet().removeIf(e -> e.getValue().toLanguageTag().equals(langTag));

            // Add new mappings.
            String[] displayValues = values.split(",");
            for (String value : displayValues) {
                String cleanedValue = value.trim();
                if (!cleanedValue.isEmpty()) {
                    curMap.put(cleanedValue, langLocale);
                }
            }
        });
    }

    return new CustomMapping(mappingConfig.name.trim()).withCaseSensitive(mappingConfig.casesensitive)
            .withMapping(curMap);
}

From source file:org.codice.ddf.registry.schemabindings.RegistryPackageWebConverter.java

private static void putExtrinsicObject(ExtrinsicObjectType extrinsicObject,
        Map<String, Object> registryObjectListMap) {
    if (extrinsicObject == null) {
        return;//from w w  w .  j ava  2 s  .c  o  m
    }

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

    putGeneralInfo(extrinsicObject, extrinsicObjectMap);

    if (extrinsicObject.isSetContentVersionInfo()) {
        extrinsicObjectMap.put(EXTRINSIC_OBJECT_CONTENT_VERSION,
                extrinsicObject.getContentVersionInfo().getVersionName());
    }

    if (extrinsicObject.isSetIsOpaque()) {
        extrinsicObjectMap.put(EXTRINSIC_OBJECT_OPAQUE, extrinsicObject.isIsOpaque());
    }

    if (extrinsicObject.isSetMimeType()) {
        extrinsicObjectMap.put(EXTRINSIC_OBJECT_MIME_TYPE, extrinsicObject.getMimeType());
    }

    if (extrinsicObject.isSetExternalIdentifier()) {
        putExternalIdentifier(extrinsicObject.getExternalIdentifier(), extrinsicObjectMap);
    }

    if (!extrinsicObjectMap.isEmpty()) {
        registryObjectListMap.putIfAbsent(EXTRINSIC_OBJECT_KEY, new ArrayList<Map<String, Object>>());
        ((List) registryObjectListMap.get(EXTRINSIC_OBJECT_KEY)).add(extrinsicObjectMap);
    }
}

From source file:org.apache.samza.storage.ContainerStorageManager.java

/**
 * Add all side inputs to a map of maps, indexed first by taskName, then by sideInput store name.
 *
 * @param containerModel the containerModel to use
 * @param sideInputSystemStreams the map of store to side input system stream
 * @return taskSideInputSSPs map//from w  w  w  .java  2  s  .c om
 */
private Map<TaskName, Map<String, Set<SystemStreamPartition>>> getTaskSideInputSSPs(
        ContainerModel containerModel, Map<String, Set<SystemStream>> sideInputSystemStreams) {
    Map<TaskName, Map<String, Set<SystemStreamPartition>>> taskSideInputSSPs = new HashMap<>();

    containerModel.getTasks().forEach((taskName, taskModel) -> {
        sideInputSystemStreams.keySet().forEach(storeName -> {
            Set<SystemStreamPartition> taskSideInputs = taskModel.getSystemStreamPartitions().stream()
                    .filter(ssp -> sideInputSystemStreams.get(storeName).contains(ssp.getSystemStream()))
                    .collect(Collectors.toSet());
            taskSideInputSSPs.putIfAbsent(taskName, new HashMap<>());
            taskSideInputSSPs.get(taskName).put(storeName, taskSideInputs);
        });
    });
    return taskSideInputSSPs;
}

From source file:org.opennms.features.topology.plugins.topo.linkd.internal.EnhancedLinkdTopologyProvider.java

private void getLldpLinks(Map<Integer, OnmsNode> nodemap, Map<Integer, List<OnmsSnmpInterface>> nodesnmpmap,
        Map<Integer, OnmsIpInterface> ipprimarymap) {
    // Index the nodes by sysName
    final Map<String, OnmsNode> nodesbysysname = new HashMap<>();
    for (OnmsNode node : nodemap.values()) {
        if (node.getSysName() != null) {
            nodesbysysname.putIfAbsent(node.getSysName(), node);
        }/*from  ww  w .j a v  a  2  s.  c  o  m*/
    }

    // Index the LLDP elements by node id
    Map<Integer, LldpElement> lldpelementmap = new HashMap<Integer, LldpElement>();
    for (LldpElement lldpelement : m_lldpElementDao.findAll()) {
        lldpelementmap.put(lldpelement.getNode().getId(), lldpelement);
    }

    // Pull all of the LLDP links and index them by remote chassis id
    List<LldpLink> allLinks = m_lldpLinkDao.findAll();
    Map<String, List<LldpLink>> linksByRemoteChassisId = new HashMap<>();
    for (LldpLink link : allLinks) {
        final String remoteChassisId = link.getLldpRemChassisId();
        List<LldpLink> linksWithRemoteChassisId = linksByRemoteChassisId.get(remoteChassisId);
        if (linksWithRemoteChassisId == null) {
            linksWithRemoteChassisId = new ArrayList<>();
            linksByRemoteChassisId.put(remoteChassisId, linksWithRemoteChassisId);
        }
        linksWithRemoteChassisId.add(link);
    }

    Set<LldpLinkDetail> combinedLinkDetails = new HashSet<LldpLinkDetail>();
    Set<Integer> parsed = new HashSet<Integer>();
    for (LldpLink sourceLink : allLinks) {
        if (parsed.contains(sourceLink.getId())) {
            continue;
        }
        LOG.debug("loadtopology: lldp link with id '{}' link '{}' ", sourceLink.getId(), sourceLink);
        LldpElement sourceLldpElement = lldpelementmap.get(sourceLink.getNode().getId());
        LldpLink targetLink = null;

        // Limit the candidate links by only choosing those have a remote chassis id matching the chassis id of the source link
        for (LldpLink link : linksByRemoteChassisId.getOrDefault(sourceLldpElement.getLldpChassisId(),
                Collections.emptyList())) {
            if (parsed.contains(link.getId())) {
                continue;
            }

            if (sourceLink.getId().intValue() == link.getId().intValue()) {
                continue;
            }
            LOG.debug("loadtopology: checking lldp link with id '{}' link '{}' ", link.getId(), link);
            LldpElement element = lldpelementmap.get(link.getNode().getId());
            // Compare the chassis id on the other end of the link
            if (!sourceLink.getLldpRemChassisId().equals(element.getLldpChassisId())) {
                continue;
            }
            boolean bool1 = sourceLink.getLldpRemPortId().equals(link.getLldpPortId())
                    && link.getLldpRemPortId().equals(sourceLink.getLldpPortId());
            boolean bool3 = sourceLink.getLldpRemPortIdSubType() == link.getLldpPortIdSubType()
                    && link.getLldpRemPortIdSubType() == sourceLink.getLldpPortIdSubType();

            if (bool1 && bool3) {
                targetLink = link;
                LOG.info("loadtopology: found lldp mutual link: '{}' and '{}' ", sourceLink, targetLink);
                break;
            }
        }

        if (targetLink == null && sourceLink.getLldpRemSysname() != null) {
            final OnmsNode node = nodesbysysname.get(sourceLink.getLldpRemSysname());
            if (node != null) {
                targetLink = reverseLldpLink(node, sourceLldpElement, sourceLink);
                LOG.info("loadtopology: found lldp link using lldp rem sysname: '{}' and '{}'", sourceLink,
                        targetLink);
            }
        }

        if (targetLink == null) {
            LOG.info("loadtopology: cannot found target node for link: '{}'", sourceLink);
            continue;
        }

        parsed.add(sourceLink.getId());
        parsed.add(targetLink.getId());
        Vertex source = getOrCreateVertex(nodemap.get(sourceLink.getNode().getId()),
                ipprimarymap.get(sourceLink.getNode().getId()));
        Vertex target = getOrCreateVertex(nodemap.get(targetLink.getNode().getId()),
                ipprimarymap.get(targetLink.getNode().getId()));
        combinedLinkDetails.add(new LldpLinkDetail(
                Math.min(sourceLink.getId(), targetLink.getId()) + "|"
                        + Math.max(sourceLink.getId(), targetLink.getId()),
                source, sourceLink, target, targetLink));

    }

    for (LldpLinkDetail linkDetail : combinedLinkDetails) {
        LinkdEdge edge = connectVertices(linkDetail, LLDP_EDGE_NAMESPACE);
        edge.setTooltipText(getEdgeTooltipText(linkDetail, nodesnmpmap));
    }
}

From source file:org.lightjason.examples.pokemon.CConfiguration.java

/**
 * creates the moving agent based on the configuration
 *
 * @param p_agentconfiguration subsection for agent configuration
 * @param p_elements element list/*from w  w  w .j  a  v  a 2 s.co m*/
 * @param p_agentprint disables / enables agent printing
 * @throws IOException thrown on ASL reading error
 */
@SuppressWarnings("unchecked")
private void createAgent(final Map<String, Object> p_agentconfiguration, final List<IAgent> p_elements,
        final boolean p_agentprint) throws IOException {
    final Map<String, IAgentGenerator<IAgent>> l_agentgenerator = new HashMap<>();
    final Set<IAction> l_action = Collections
            .unmodifiableSet(Stream
                    .concat(p_agentprint ? Stream.of() : Stream.of(new CEmptyPrint()),
                            Stream.concat(org.lightjason.agentspeak.common.CCommon.actionsFromPackage(),
                                    org.lightjason.agentspeak.common.CCommon
                                            .actionsFromAgentClass(CPokemon.class)))
                    .collect(Collectors.toSet()));

    p_agentconfiguration.entrySet().forEach(i -> {
        final Map<String, Object> l_parameter = (Map<String, Object>) i.getValue();

        // read ASL item from configuration and get the path relative to configuration
        final String l_asl = m_configurationpath + ((String) l_parameter.getOrDefault("asl", "")).trim();

        try (
                // open filestream of ASL content
                final InputStream l_stream = new URL(l_asl).openStream();) {
            // get existing agent generator or create a new one based on the ASL
            // and push it back if generator does not exists
            final IAgentGenerator<IAgent> l_generator = l_agentgenerator.getOrDefault(l_asl,
                    new CPokemonGenerator(m_environment, l_stream, l_action, IAggregation.EMPTY));
            l_agentgenerator.putIfAbsent(l_asl, l_generator);

            // generate agents and put it to the list
            l_generator.generatemultiple((int) l_parameter.getOrDefault("number", 0),

                    //EForceFactory.valueOf( ( (String) l_parameter.getOrDefault( "force", "" ) ).trim().toUpperCase() ).get(),

                    (String) l_parameter.getOrDefault("pokemon", "")

            ).sequential().forEach(p_elements::add);
        } catch (final Exception l_exception) {
            System.err.println(MessageFormat.format("error on agent generation: {0}", l_exception));
        }

    });
}