Skip to content

Commit

Permalink
fmt w j8
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneshiry committed Aug 30, 2021
1 parent 8da25c9 commit c447398
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMeta
*/
private Map<UUID, CsvIndividualTimeSeriesMetaInformation>
buildIndividualTimeSeriesMetaInformation() {
return getIndividualTimeSeriesFilePaths().parallelStream()
return getIndividualTimeSeriesFilePaths()
.parallelStream()
.map(
filePath -> {
/* Extract meta information from file path and enhance it with the file path itself */
Expand All @@ -259,7 +260,8 @@ public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMeta
*/
public Map<ColumnScheme, Set<CsvIndividualTimeSeriesMetaInformation>>
getCsvIndividualTimeSeriesMetaInformation(ColumnScheme... columnSchemes) {
return getIndividualTimeSeriesFilePaths().parallelStream()
return getIndividualTimeSeriesFilePaths()
.parallelStream()
.map(
pathString -> {
String filePathWithoutEnding = removeFileEnding(pathString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
Class<T> timeSeriesClass, Class<E> entryClass, Class<V> valueClass) {
/* Get the mapping from field name to getter method ignoring the getter for returning all entries */
Map<String, FieldSourceToMethod> timeSeriesMapping =
mapFieldNameToGetter(timeSeriesClass, Arrays.asList("entries", "uuid", "type"))
.entrySet()
mapFieldNameToGetter(timeSeriesClass, Arrays.asList("entries", "uuid", "type")).entrySet()
.stream()
.collect(
Collectors.toMap(
Expand Down Expand Up @@ -137,8 +136,7 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
mapFieldNameToGetter(
valueClass,
Arrays.asList("solarIrradiance", "temperature", "wind"))
.entrySet()
.stream()
.entrySet().stream()
.map(
entry ->
new AbstractMap.SimpleEntry<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,10 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap(
Collection<Map<String, String>> allRows = csvRowFieldValueMapping(reader, headline);

return distinctRowsWithLog(
allRows, fieldToValues -> fieldToValues.get("uuid"), entityClass.getSimpleName(), "UUID")
allRows,
fieldToValues -> fieldToValues.get("uuid"),
entityClass.getSimpleName(),
"UUID")
.parallelStream();
} catch (IOException e) {
log.warn(
Expand Down Expand Up @@ -452,7 +455,8 @@ protected Set<Map<String, String>> distinctRowsWithLog(

/* Check for rows with the same key based on the provided key extractor function */
Set<Map<String, String>> distinctIdSet =
allRowsSet.parallelStream()
allRowsSet
.parallelStream()
.filter(ValidationUtils.distinctByKey(keyExtractor))
.collect(Collectors.toSet());
if (distinctIdSet.size() != allRowsSet.size()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap() {
.get(factory.getLatField())
.concat(fieldToValues.get(factory.getLonField()));
return distinctRowsWithLog(
withDistinctCoordinateId, coordinateExtractor, "coordinate id mapping", "coordinate")
withDistinctCoordinateId, coordinateExtractor, "coordinate id mapping", "coordinate")
.parallelStream();
} catch (IOException e) {
log.error("Cannot read the file for coordinate id to coordinate mapping.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap(
.get(weatherFactory.getTimeFieldString())
.concat(fieldToValues.get(weatherFactory.getCoordinateIdFieldString()));
return distinctRowsWithLog(
allRows, timeCoordinateIdExtractor, entityClass.getSimpleName(), "UUID")
allRows, timeCoordinateIdExtractor, entityClass.getSimpleName(), "UUID")
.parallelStream();

} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ public GraphicElements(List<GraphicInput> graphics) {

/* init sets */
this.nodeGraphics =
graphics.parallelStream()
graphics
.parallelStream()
.filter(graphic -> graphic instanceof NodeGraphicInput)
.map(graphic -> (NodeGraphicInput) graphic)
.collect(Collectors.toSet());
this.lineGraphics =
graphics.parallelStream()
graphics
.parallelStream()
.filter(graphic -> graphic instanceof LineGraphicInput)
.map(graphic -> (LineGraphicInput) graphic)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,32 +84,38 @@ public RawGridElements(List<AssetInput> rawGridElements) {

/* init sets */
this.nodes =
rawGridElements.parallelStream()
rawGridElements
.parallelStream()
.filter(gridElement -> gridElement instanceof NodeInput)
.map(nodeInput -> (NodeInput) nodeInput)
.collect(Collectors.toSet());
this.lines =
rawGridElements.parallelStream()
rawGridElements
.parallelStream()
.filter(gridElement -> gridElement instanceof LineInput)
.map(lineInput -> (LineInput) lineInput)
.collect(Collectors.toSet());
this.transformer2Ws =
rawGridElements.parallelStream()
rawGridElements
.parallelStream()
.filter(gridElement -> gridElement instanceof Transformer2WInput)
.map(trafo2wInput -> (Transformer2WInput) trafo2wInput)
.collect(Collectors.toSet());
this.transformer3Ws =
rawGridElements.parallelStream()
rawGridElements
.parallelStream()
.filter(gridElement -> gridElement instanceof Transformer3WInput)
.map(trafo3wInput -> (Transformer3WInput) trafo3wInput)
.collect(Collectors.toSet());
this.switches =
rawGridElements.parallelStream()
rawGridElements
.parallelStream()
.filter(gridElement -> gridElement instanceof SwitchInput)
.map(switchInput -> (SwitchInput) switchInput)
.collect(Collectors.toSet());
this.measurementUnits =
rawGridElements.parallelStream()
rawGridElements
.parallelStream()
.filter(gridElement -> gridElement instanceof MeasurementUnitInput)
.map(measurementUnitInput -> (MeasurementUnitInput) measurementUnitInput)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,52 +106,62 @@ public SystemParticipants(List<SystemParticipantInput> systemParticipants) {

/* init sets */
this.bmPlants =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof BmInput)
.map(bmInput -> (BmInput) bmInput)
.collect(Collectors.toSet());
this.chpPlants =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof ChpInput)
.map(chpInput -> (ChpInput) chpInput)
.collect(Collectors.toSet());
this.evCS =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof EvcsInput)
.map(evcsInput -> (EvcsInput) evcsInput)
.collect(Collectors.toSet());
this.evs =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof EvInput)
.map(evInput -> (EvInput) evInput)
.collect(Collectors.toSet());
this.fixedFeedIns =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof FixedFeedInInput)
.map(fixedFeedInInpu -> (FixedFeedInInput) fixedFeedInInpu)
.collect(Collectors.toSet());
this.heatPumps =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof HpInput)
.map(hpInput -> (HpInput) hpInput)
.collect(Collectors.toSet());
this.loads =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof LoadInput)
.map(loadInput -> (LoadInput) loadInput)
.collect(Collectors.toSet());
this.pvPlants =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof PvInput)
.map(pvInput -> (PvInput) pvInput)
.collect(Collectors.toSet());
this.storages =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof StorageInput)
.map(storageInput -> (StorageInput) storageInput)
.collect(Collectors.toSet());
this.wecPlants =
systemParticipants.parallelStream()
systemParticipants
.parallelStream()
.filter(gridElement -> gridElement instanceof WecInput)
.map(wecInput -> (WecInput) wecInput)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ private ChargingPointTypeUtils() {
Stream.concat(
Stream.of(type.getId().toLowerCase()),
type.getSynonymousIds().stream().map(String::toLowerCase))
.collect(Collectors.toMap(Function.identity(), v -> type))
.entrySet()
.collect(Collectors.toMap(Function.identity(), v -> type)).entrySet()
.stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ private static SystemParticipants updateSystemParticipantsWithNodes(
SystemParticipants systemParticipants, Map<NodeInput, NodeInput> oldToNewNodes) {

List<SystemParticipantInput> sysParts =
systemParticipants.allEntitiesAsList().parallelStream()
systemParticipants
.allEntitiesAsList()
.parallelStream()
.map(
sysPart -> {
if (oldToNewNodes.containsKey(sysPart.getNode())) {
Expand Down

0 comments on commit c447398

Please sign in to comment.