@Test public void validationTestForDL() { Network network = DanglingLineNetworkFactory.create(); Contingency danglingLineContingency = new Contingency("DL contingency", new DanglingLineContingency("DL")); Contingency danglingLineInvalidContingency = new Contingency("DL invalid contingency", new DanglingLineContingency("DL_THAT_DO_NOT_EXIST")); List<Contingency> validContingencies = Contingency.checkValidity(Arrays.asList(danglingLineContingency, danglingLineInvalidContingency), network); assertEquals(Arrays.asList("DL 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);  }