Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import org.eclipse.set.core.services.enumtranslation.EnumTranslationService;
import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator;
Expand Down Expand Up @@ -123,8 +125,15 @@ private Table transform(final Iterable<Aussenelementansteuerung> controls,
.keySet().stream().map(this::fieldElementCase)
.toArray(Case[]::new);

fillSwitch(row, getColumn(cols, Betriebl_Bez_Feldelem), control,
fieldElementCases);
fillIterable(row, getColumn(cols, Betriebl_Bez_Feldelem), control,
(final Aussenelementansteuerung element) -> List
.of(fieldElementCases).stream()
.filter(c -> c.condition.apply(element))
.map(c -> c.filling.apply(element))
.flatMap(it -> StreamSupport
.stream(it.spliterator(), false))
.collect(Collectors.toList()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.collect(Collectors.toList()),
.toList(),

From Stream can direct toList() 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TruongQuangSB I changedit

null);

// C: Sskz.Techn_Bez_OC
fill(row, getColumn(cols, Techn_Bez_OC), control, e -> ""); //$NON-NLS-1$
Expand Down Expand Up @@ -178,23 +187,23 @@ private <T extends Ur_Objekt> Case<Aussenelementansteuerung> fieldElementCase(
private List<Aussenelementansteuerung> getControlFromFieldELement(
final Ur_Objekt object) {
final Function<Ur_Objekt, List<Aussenelementansteuerung>> getAussElement = urObject -> switch (urObject) {
case final W_Kr_Gsp_Element gsp -> getControlFromFieldELement(
gsp.getIDStellelement().getValue());
case final Signal signal -> getControlFromFieldELement(
case final W_Kr_Gsp_Element gsp -> getControlFromFieldELement(
gsp.getIDStellelement().getValue());
case final Signal signal -> getControlFromFieldELement(
signal.getSignalReal().getSignalRealAktiv()
.getIDStellelement().getValue());
case final FMA_Komponente fma -> fma
.getFMAKomponenteAchszaehlpunkt().getIDInformation()
.stream()
.map(ID_Aussenelementansteuerung_TypeClass::getValue)
.toList();
case final PZB_Element pzb -> getControlFromFieldELement(
pzb.getIDStellelement().getValue());
case final Schluesselsperre schluessel -> getControlFromFieldELement(
schluessel.getIDStellelement().getValue());
case final Stellelement stellement -> List
.of(stellement.getIDInformation().getValue());
default -> null;
case final PZB_Element pzb -> getControlFromFieldELement(
pzb.getIDStellelement().getValue());
case final Schluesselsperre schluessel -> getControlFromFieldELement(
schluessel.getIDStellelement().getValue());
case final Stellelement stellement -> List
.of(stellement.getIDInformation().getValue());
default -> null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TruongQuangSB No it was not intentional. The autoformatter changed it... I will revert it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TruongQuangSB Puhh that was ahrd to reset 🤣 Damn eclipse autoformatter. But now it is as before

};
return getNullableObject(object, getAussElement::apply)
.orElse(Collections.emptyList());
Expand All @@ -203,35 +212,35 @@ private List<Aussenelementansteuerung> getControlFromFieldELement(
@SuppressWarnings("nls")
private String getFieldElementDesignation(final Ur_Objekt object) {
final Function<Ur_Objekt, String> destignationFunc = urObject -> switch (urObject) {
case final W_Kr_Gsp_Element gsp -> gsp.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final Signal signal -> signal.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final FMA_Komponente fma -> fma.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final PZB_Element pzb -> {
final ENUMPZBArt pzbArt = getNullableObject(pzb,
ele -> ele.getPZBArt().getWert()).orElse(null);
if (pzbArt == null) {
yield "";
}
final List<String> pzbElementBezugspunkt = PZBElementExtensions
.getPZBElementBezugspunkt(pzb).stream()
.map(ele -> switch (ele) {
case final Signal signal -> signal.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final W_Kr_Gsp_Element gsp -> gsp.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final Signal signal -> signal.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final FMA_Komponente fma -> fma.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final PZB_Element pzb -> {
final ENUMPZBArt pzbArt = getNullableObject(pzb,
ele -> ele.getPZBArt().getWert()).orElse(null);
if (pzbArt == null) {
yield "";
}
final List<String> pzbElementBezugspunkt = PZBElementExtensions
.getPZBElementBezugspunkt(pzb).stream()
.map(ele -> switch (ele) {
case final Signal signal -> signal.getBezeichnung()
.getBezeichnungTabelle().getWert();
case final W_Kr_Gsp_Element gsp -> gsp
.getBezeichnung().getBezeichnungTabelle()
.getWert();
default -> "";
default -> "";

}).toList();
yield String.format("%s (%s)", translate(pzbArt),
String.join(",", pzbElementBezugspunkt));
}
}).toList();
yield String.format("%s (%s)", translate(pzbArt),
String.join(",", pzbElementBezugspunkt));
}
case final Schluesselsperre schluessel -> schluessel
.getBezeichnung().getBezeichnungTabelle().getWert();
default -> null;
default -> null;
};
return getNullableObject(object, destignationFunc::apply).orElse("");
}
Expand Down
Loading