Skip to content

Commit

Permalink
ModelConfigs::getModelInfos returns Collection instead of Set
Browse files Browse the repository at this point in the history
ModelConfigs::getModelsName returns unmodifiableSet

Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed Jul 17, 2024
1 parent 5f82bf2 commit b27c5b5
Show file tree
Hide file tree
Showing 28 changed files with 59 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynamicsimulation.DynamicModel;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;
import java.util.function.Supplier;

/**
Expand All @@ -26,9 +26,9 @@ public interface ModelBuilderConstructor {

private final String category;
private final ModelBuilderConstructor builderConstructor;
private final Supplier<Set<ModelInfo>> modelInfosSupplier;
private final Supplier<Collection<ModelInfo>> modelInfosSupplier;

public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier<Set<ModelInfo>> modelInfosSupplier) {
public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier<Collection<ModelInfo>> modelInfosSupplier) {
this.category = category;
this.builderConstructor = builderConstructor;
this.modelInfosSupplier = modelInfosSupplier;
Expand All @@ -42,7 +42,7 @@ public ModelBuilderConstructor getBuilderConstructor() {
return builderConstructor;
}

public Set<ModelInfo> getModelInfos() {
public Collection<ModelInfo> getModelInfos() {
return modelInfosSupplier.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -43,12 +41,12 @@ public ModelConfig getModelConfig(String modelName) {
return modelConfigMap.get(modelName);
}

public Set<ModelInfo> getModelInfos() {
return Set.copyOf(modelConfigMap.values());
public Collection<ModelInfo> getModelInfos() {
return Collections.unmodifiableCollection(modelConfigMap.values());
}

Set<String> getModelsName() {
return Set.copyOf(modelConfigMap.keySet());
return Collections.unmodifiableSet(modelConfigMap.keySet());
}

void addModelConfigs(ModelConfigs modelConfigsToMerge) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.powsybl.iidm.network.Load;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -48,7 +48,7 @@ public static TapChangerAutomationSystemBuilder of(Network network, String model
return new TapChangerAutomationSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static TapChangerBlockingAutomationSystemBuilder of(Network network, Stri
return new TapChangerBlockingAutomationSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -46,7 +46,7 @@ public static UnderVoltageAutomationSystemBuilder of(Network network, String mod
return new UnderVoltageAutomationSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TwoSides;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -43,7 +43,7 @@ public static DynamicOverloadManagementSystemBuilder of(Network network, String
return new DynamicOverloadManagementSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TwoSides;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -47,7 +47,7 @@ public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network
return new DynamicTwoLevelsOverloadManagementSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.powsybl.dynawaltz.models.automationsystems.AbstractAutomationSystemModelBuilder;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -43,7 +43,7 @@ public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, S
return new PhaseShifterBlockingIAutomationSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static PhaseShifterIAutomationSystemBuilder of(Network network, String mo
return new PhaseShifterIAutomationSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static PhaseShifterPAutomationSystemBuilder of(Network network, String mo
return new PhaseShifterPAutomationSystemBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static InfiniteBusBuilder of(Network network, String modelName, ReportNod
return new InfiniteBusBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static StandardBusBuilder of(Network network, String modelName, ReportNod
return new StandardBusBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static GeneratorFictitiousBuilder of(Network network, String modelName, R
return new GeneratorFictitiousBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static GridFormingConverterBuilder of(Network network, String modelName,
return new GridFormingConverterBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static SynchronizedGeneratorBuilder of(Network network, String modelName,
return new SynchronizedGeneratorBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -43,7 +43,7 @@ public static SynchronousGeneratorBuilder of(Network network, String modelName,
return new SynchronousGeneratorBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static WeccBuilder of(Network network, String modelName, ReportNode repor
return new WeccBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -44,7 +44,7 @@ public static HvdcPBuilder of(Network network, String modelName, ReportNode repo
return new HvdcPBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.*;

import java.util.Set;
import java.util.Collection;
import java.util.function.Predicate;

/**
Expand Down Expand Up @@ -44,7 +44,7 @@ public static HvdcVscBuilder of(Network network, String modelName, ReportNode re
return new HvdcVscBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.iidm.network.Line;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -44,7 +44,7 @@ public static LineBuilder of(Network network, String modelName, ReportNode repor
return new LineBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dynawaltz.builders.*;
import com.powsybl.iidm.network.Network;

import java.util.Set;
import java.util.Collection;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
Expand Down Expand Up @@ -42,7 +42,7 @@ public static BaseLoadBuilder of(Network network, String modelName, ReportNode r
return new BaseLoadBuilder(network, modelConfig, reportNode);
}

public static Set<ModelInfo> getSupportedModelInfos() {
public static Collection<ModelInfo> getSupportedModelInfos() {
return MODEL_CONFIGS.getModelInfos();
}

Expand Down
Loading

0 comments on commit b27c5b5

Please sign in to comment.