@Test public void validationTest() { Network network = EurostagTutorialExample1Factory.create(); Contingency generatorContingency = new Contingency("GEN contingency", new GeneratorContingency("GEN")); Contingency generatorInvalidContingency = new Contingency("GEN invalid contingency", new GeneratorContingency("GE")); Contingency lineContingency = new Contingency("NHV1_NHV2_1 contingency", new BranchContingency("NHV1_NHV2_1", "VLHV1")); Contingency lineInvalidContingency = new Contingency("NHV1_NHV2_1 invalid contingency", new BranchContingency("NHV1_NHV2_1", "VLHV")); List<Contingency> validContingencies = Contingency.checkValidity(Arrays.asList(generatorContingency, generatorInvalidContingency, lineContingency, lineInvalidContingency), network); assertEquals(Arrays.asList("GEN contingency", "NHV1_NHV2_1 contingency"), validContingencies.stream().map(Contingency::getId).collect(Collectors.toList())); }
public static List<Contingency> checkValidity(List<Contingency> contingencies, Network network) { Objects.requireNonNull(contingencies); Objects.requireNonNull(network); return contingencies.stream() .filter(c -> isValid(c, network)) .collect(Collectors.toList()); }
Contingency extends AbstractExtendable<Contingency> { public static List<Contingency> checkValidity(List<Contingency> contingencies, Network network) { Objects.requireNonNull(contingencies); Objects.requireNonNull(network); return contingencies.stream() .filter(c -> isValid(c, network)) .collect(Collectors.toList()); } }
Contingency extends AbstractExtendable<Contingency> { public static List<Contingency> checkValidity(List<Contingency> contingencies, Network network) { Objects.requireNonNull(contingencies); Objects.requireNonNull(network); return contingencies.stream() .filter(c -> isValid(c, network)) .collect(Collectors.toList()); } Contingency(String id, ContingencyElement... elements);  Contingency(String id, List<ContingencyElement> elements); }
Contingency extends AbstractExtendable<Contingency> { public static List<Contingency> checkValidity(List<Contingency> contingencies, Network network) { Objects.requireNonNull(contingencies); Objects.requireNonNull(network); return contingencies.stream() .filter(c -> isValid(c, network)) .collect(Collectors.toList()); } Contingency(String id, ContingencyElement... elements);  Contingency(String id, List<ContingencyElement> elements); static List<Contingency> checkValidity(List<Contingency> contingencies, Network network); String getId(); void setId(String id); void addElement(ContingencyElement element); void removeElement(ContingencyElement element); Collection<ContingencyElement> getElements(); ModificationTask toTask(); @Override int hashCode(); @Override boolean equals(Object obj); }
Contingency extends AbstractExtendable<Contingency> { public static List<Contingency> checkValidity(List<Contingency> contingencies, Network network) { Objects.requireNonNull(contingencies); Objects.requireNonNull(network); return contingencies.stream() .filter(c -> isValid(c, network)) .collect(Collectors.toList()); } Contingency(String id, ContingencyElement... elements);  Contingency(String id, List<ContingencyElement> elements); static List<Contingency> checkValidity(List<Contingency> contingencies, Network network); String getId(); void setId(String id); void addElement(ContingencyElement element); void removeElement(ContingencyElement element); Collection<ContingencyElement> getElements(); ModificationTask toTask(); @Override int hashCode(); @Override boolean equals(Object obj);  }