<commit_before>
/**
 * Copyright (c) 2021, 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.powsybl.iidm.network.impl.extensions;

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.extensions.AbstractExtensionAdder;
import com.powsybl.iidm.network.Identifiable;
import com.powsybl.iidm.network.extensions.IdentifiableShortCircuit;
import com.powsybl.iidm.network.extensions.IdentifiableShortCircuitAdder;

/**
 *
 * @author <NAME> <<EMAIL>>
 */
public class IdentifiableShortCircuitAdderImpl<I extends Identifiable<I>> extends AbstractExtensionAdder<I, IdentifiableShortCircuit<I>>
        implements IdentifiableShortCircuitAdder<I> {

    double ipMin = Double.NaN;
    double ipMax = Double.NaN;

    protected IdentifiableShortCircuitAdderImpl(I extendable) {
        super(extendable);
    }

    @Override
    protected IdentifiableShortCircuitImpl<I> createExtension(I extendable) {
        return new IdentifiableShortCircuitImpl<>(extendable, ipMin, ipMax);
    }

    @Override
    public IdentifiableShortCircuitAdder withIpMin(double ipMin) {
        this.ipMin = ipMin;
        return this;
    }

    @Override
    public IdentifiableShortCircuitAdder withIpMax(double ipMax) {
        this.ipMax = ipMax;
        return this;
    }

    @Override
    public I add() {
        if (Double.isNaN(ipMax)) {
            throw new PowsyblException("Undefined ipMax");
        }
        return super.add();
    }
}<commit_msg>Fix IdentifiableShortCircuitAdderImpl implementation (generics) (#2138)<commit_after>
/**
 * Copyright (c) 2021, 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.powsybl.iidm.network.impl.extensions;

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.extensions.AbstractExtensionAdder;
import com.powsybl.iidm.network.Identifiable;
import com.powsybl.iidm.network.extensions.IdentifiableShortCircuit;
import com.powsybl.iidm.network.extensions.IdentifiableShortCircuitAdder;

/**
 *
 * @author <NAME> <<EMAIL>>
 */
public class IdentifiableShortCircuitAdderImpl<I extends Identifiable<I>> extends AbstractExtensionAdder<I, IdentifiableShortCircuit<I>>
        implements IdentifiableShortCircuitAdder<I> {

    double ipMin = Double.NaN;
    double ipMax = Double.NaN;

    protected IdentifiableShortCircuitAdderImpl(I extendable) {
        super(extendable);
    }

    @Override
    protected IdentifiableShortCircuitImpl<I> createExtension(I extendable) {
        return new IdentifiableShortCircuitImpl<>(extendable, ipMin, ipMax);
    }

    @Override
    public IdentifiableShortCircuitAdder<I> withIpMin(double ipMin) {
        this.ipMin = ipMin;
        return this;
    }

    @Override
    public IdentifiableShortCircuitAdder<I> withIpMax(double ipMax) {
        this.ipMax = ipMax;
        return this;
    }

    @Override
    public I add() {
        if (Double.isNaN(ipMax)) {
            throw new PowsyblException("Undefined ipMax");
        }
        return super.add();
    }
}
{'fraction_non_alphanumeric': 0.09857904085257549, 'fraction_numerical': 0.005920663114268798, 'mean_word_length': 3.5848032564450474, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6005574', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1047, 'n_words': 234}