Skip to content

Commit

Permalink
simplify getDaiModStVal
Browse files Browse the repository at this point in the history
Signed-off-by: massifben <105049157+massifben@users.noreply.github.com>
  • Loading branch information
massifben committed Jan 22, 2025
1 parent 56f286f commit 284505d
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
@Slf4j
public class LnService implements LnEditor {

private static final DoLinkedToDaFilter DAI_FILTER_MOD_STVAL = DoLinkedToDaFilter.from(MOD_DO_NAME, STVAL_DA_NAME);

public Stream<TAnyLN> getAnylns(TLDevice tlDevice) {
return Stream.concat(Stream.of(tlDevice.getLN0()), tlDevice.getLN().stream());
}
Expand Down Expand Up @@ -73,15 +75,7 @@ public Optional<ActiveStatus> getDaiModStValValue(TAnyLN tAnyLN) {
}

public Optional<TDAI> getDaiModStVal(TAnyLN tAnyLN) {
return tAnyLN
.getDOI()
.stream()
.filter(tdoi -> MOD_DO_NAME.equals(tdoi.getName()))
.flatMap(tdoi -> tdoi.getSDIOrDAI().stream())
.filter(TDAI.class::isInstance)
.map(TDAI.class::cast)
.filter(tdai -> STVAL_DA_NAME.equals(tdai.getName()))
.findFirst();
return getDOAndDAInstances(tAnyLN, DAI_FILTER_MOD_STVAL);
}

public Stream<TAnyLN> getActiveLns(TLDevice tlDevice) {
Expand Down

0 comments on commit 284505d

Please sign in to comment.