<commit_before>/**
 * Copyright (c) 2017, 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;

/**
 *
 * @author <NAME> <geoffroy.jamgotchian at rte-france.com>
 */
public abstract class AbstractTerminalTopologyVisitor extends DefaultTopologyVisitor {

    public abstract void visitTerminal(Terminal t);

    private void visitBranch(Branch branch, Branch.Side side) {
        switch (side) {
            case ONE:
                visitTerminal(branch.getTerminal1());
                break;
            case TWO:
                visitTerminal(branch.getTerminal2());
                break;
            default:
                throw new AssertionError();
        }
    }

    @Override
    public void visitLine(Line line, Branch.Side side) {
        visitBranch(line, side);
    }

    @Override
    public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, Branch.Side side) {
        visitBranch(transformer, side);
    }

    @Override
    public void visitThreeWindingsTransformer(ThreeWindingsTransformer transformer, ThreeWindingsTransformer.Side side) {<commit_msg>Fix bug: AbstractTerminalTopologyVisitor now also visits connected terminals of BusbarSections (#1512)<commit_after>/**
 * Copyright (c) 2017, 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;

/**
 *
 * @author <NAME> <geoffroy.jamgotchian at rte-france.com>
 */
public abstract class AbstractTerminalTopologyVisitor extends DefaultTopologyVisitor {

    public abstract void visitTerminal(Terminal t);

    private void visitBranch(Branch branch, Branch.Side side) {
        switch (side) {
            case ONE:
                visitTerminal(branch.getTerminal1());
                break;
            case TWO:
                visitTerminal(branch.getTerminal2());
                break;
            default:
                throw new AssertionError();
        }
    }

    @Override
    public void visitBusbarSection(BusbarSection busbarSection) {
        visitInjection(busbarSection);
    }

    @Override
    public void visitLine(Line line, Branch.Side side) {
        visitBranch(line, side);
    }

    @Override
    public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, Branch.Side side) {
        visitBranch(transformer, side);
    }

    @Override
    public void visitThreeWindingsTransformer(ThreeWindingsTransformer transformer, ThreeWindingsTransformer.Side side) {
{'fraction_non_alphanumeric': 0.08729320661738825, 'fraction_numerical': 0.008447729672650475, 'mean_word_length': 2.7493403693931397, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6039033', 'n_tokens_mistral': 830, 'n_tokens_neox': 779, 'n_words': 222}