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

com.powsybl.metrix.mapping.log.ScalingDownChangeToVariable Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
/*
 * 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/.
 * SPDX-License-Identifier: MPL-2.0
 */
package com.powsybl.metrix.mapping.log;

/**
 * @author Valentin Berthault {@literal }
 */
public class ScalingDownChangeToVariable implements LogDescriptionBuilder {

    private String toVariable;
    private String type = "";
    private boolean disabled = false;
    private boolean synthesis = false;
    private String changedVariable;
    private String timeSeriesName;
    private String timeSeriesValue = "at least one value";
    private String sum = "";

    public ScalingDownChangeToVariable changedVariable(String changedVariable) {
        this.changedVariable = changedVariable;
        return this;
    }

    public ScalingDownChangeToVariable timeSeriesName(String timeSeriesName) {
        this.timeSeriesName = timeSeriesName;
        return this;
    }

    public ScalingDownChangeToVariable timeSeriesValue(double timeSeriesValue) {
        this.timeSeriesValue = formatDouble(timeSeriesValue);
        return this;
    }

    public ScalingDownChangeToVariable sum(double sum) {
        this.sum = " " + formatDouble(sum);
        return this;
    }

    public ScalingDownChangeToVariable toVariable(String toVariable) {
        this.toVariable = toVariable;
        return this;
    }

    public ScalingDownChangeToVariable mapped() {
        this.type = "mapped ";
        return this;
    }

    public ScalingDownChangeToVariable basecase() {
        this.type = "base case ";
        return this;
    }

    public ScalingDownChangeToVariable disabled(boolean disabled) {
        this.disabled = disabled;
        return this;
    }

    public ScalingDownChangeToVariable synthesis(boolean synthesis) {
        this.synthesis = synthesis;
        return this;
    }

    public LogContent build() {
        LogContent log = new LogContent();
        log.label = String.format("%sat least one %s changed to %s%s%s%s", SCALING_DOWN_PROBLEM, changedVariable,
                type, toVariable, disabled ? IGNORE_LIMITS_DISABLED : "", synthesis ? TS_SYNTHESIS : "");
        log.message = String.format("Impossible to scale down %s of ts %s%s%s%s has been applied", timeSeriesValue, timeSeriesName,
                synthesis ? ", modified " : ", ", changedVariable, sum);
        return log;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy