static Iterable<Substation> filter(Iterable<Substation> substations, final Country country, final String tso, final String... geographicalTags) { if (geographicalTags.length == 0) { return substations; } return Iterables.filter(substations, substation -> { if (country != null && country != substation.getCountry()) { return false; } if (tso != null && !tso.equals(substation.getTso())) { return false; } for (String tag : geographicalTags) { if (!substation.getGeographicalTags().contains(tag)) { return false; } } return true; }); }
@Override protected void writeRootElementAttributes(Substation s, Network n, NetworkXmlWriterContext context) throws XMLStreamException { context.getWriter().writeAttribute("country", context.getAnonymizer().anonymizeCountry(s.getCountry()).toString()); if (s.getTso() != null) { context.getWriter().writeAttribute("tso", context.getAnonymizer().anonymizeString(s.getTso())); } if (!s.getGeographicalTags().isEmpty()) { context.getWriter().writeAttribute("geographicalTags", s.getGeographicalTags().stream() .map(tag -> context.getAnonymizer().anonymizeString(tag)) .collect(Collectors.joining(","))); } }
dl.getTerminal().getVoltageLevel().getSubstation().getGeographicalTags())) { continue; g.getTerminal().getVoltageLevel().getSubstation().getGeographicalTags())) { continue; l.getTerminal().getVoltageLevel().getSubstation().getGeographicalTags())) { continue; sc.getTerminal().getVoltageLevel().getSubstation().getGeographicalTags())) { continue; wt2.getTerminal1().getVoltageLevel().getSubstation().getGeographicalTags()) && Collections.disjoint(regions, wt2.getTerminal2().getVoltageLevel().getSubstation().getGeographicalTags())) { continue; wt3.getLeg1().getTerminal().getVoltageLevel().getSubstation().getGeographicalTags()) && Collections.disjoint(regions, wt3.getLeg2().getTerminal().getVoltageLevel().getSubstation().getGeographicalTags()) && Collections.disjoint(regions, wt3.getLeg3().getTerminal().getVoltageLevel().getSubstation().getGeographicalTags())) { continue; l.getTerminal1().getVoltageLevel().getSubstation().getGeographicalTags())) && (countries == null || countries.contains( l.getTerminal1().getVoltageLevel().getSubstation().getCountry().toString()))) { l.getTerminal2().getVoltageLevel().getSubstation().getGeographicalTags()))