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

com.farao_community.farao.cse.adapter.app.loader.UserConfigurationLoader Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2022, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.farao_community.farao.cse.adapter.app.loader;

import com.farao_community.farao.cse.adapter.app.FileImporter;
import com.farao_community.farao.cse.adapter.app.model.UserConfiguration;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * @author Joris Mancini {@literal }
 */
public final class UserConfigurationLoader {
    public final List manualForcedPrasIds;
    public final Double initialDichotomyIndex;
    public final Integer maximumDichotomiesNumber;

    public UserConfigurationLoader(FileImporter fileImporter, String url) {
        Optional userConfigOpt = Optional.ofNullable(url).map(fileImporter::importUserConfiguration);
        manualForcedPrasIds = userConfigOpt.map(UserConfiguration::getManualForcedPrasIds).orElse(Collections.emptyList());
        initialDichotomyIndex = userConfigOpt.map(UserConfiguration::getInitialDichotomyIndex).orElse(null);
        maximumDichotomiesNumber = userConfigOpt.map(UserConfiguration::getMaximumDichotomiesNumber).orElse(null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy