com.powsybl.openrao.data.flowbaseddomain.DataPreContingency Maven / Gradle / Ivy
/*
* Copyright (c) 2018, 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.openrao.data.flowbaseddomain;
import lombok.Builder;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.beans.ConstructorProperties;
import java.util.Collections;
import java.util.List;
/**
* Business Object of the FlowBased DataPreContingency
*
* @author Mohamed Zelmat {@literal }
*/
@Builder
@Data
public class DataPreContingency {
@NotNull(message = "dataMonitoredBranches.empty")
@Valid
private final List dataMonitoredBranches;
@ConstructorProperties("dataMonitoredBranches")
public DataPreContingency(final List dataMonitoredBranches) {
this.dataMonitoredBranches = Collections.unmodifiableList(dataMonitoredBranches);
}
public DataMonitoredBranch findMonitoredBranchById(String monitoredBranchId) {
return dataMonitoredBranches.stream()
.filter(dataMonitoredBranch -> dataMonitoredBranch.getId().equals(monitoredBranchId))
.findAny()
.orElse(null);
}
}