-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #438 from com-pas/develop
Release 0.2.32
- Loading branch information
Showing
4 changed files
with
168 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ConnectedAPService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-FileCopyrightText: 2023 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TConnectedAP; | ||
import org.lfenergy.compas.scl2007b4.model.TSubNetwork; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class ConnectedAPService { | ||
|
||
public Stream<TConnectedAP> getConnectedAP(TSubNetwork tSubNetwork) { | ||
if (!tSubNetwork.isSetConnectedAP()) { | ||
return Stream.empty(); | ||
} | ||
return tSubNetwork.getConnectedAP().stream(); | ||
} | ||
|
||
public Stream<TConnectedAP> getFilteredConnectedAP(TSubNetwork tSubNetwork, Predicate<TConnectedAP> tConnectedAPPredicate) { | ||
return getConnectedAP(tSubNetwork).filter(tConnectedAPPredicate); | ||
} | ||
|
||
public Optional<TConnectedAP> findConnectedAP(TSubNetwork tSubNetwork, Predicate<TConnectedAP> tConnectedAPPredicate) { | ||
return getFilteredConnectedAP(tSubNetwork, tConnectedAPPredicate).findFirst(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/SubNetworkService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-FileCopyrightText: 2023 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TSubNetwork; | ||
import org.lfenergy.compas.scl2007b4.model.SCL; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class SubNetworkService { | ||
|
||
public Stream<TSubNetwork> getSubNetworks(SCL scl) { | ||
if (!scl.isSetCommunication()) { | ||
return Stream.empty(); | ||
} | ||
if (!scl.getCommunication().isSetSubNetwork()) { | ||
return Stream.empty(); | ||
} | ||
return scl.getCommunication().getSubNetwork().stream(); | ||
} | ||
|
||
public Stream<TSubNetwork> getFilteredSubNetworks(SCL tlNodeType, Predicate<TSubNetwork> tdoPredicate) { | ||
return getSubNetworks(tlNodeType).filter(tdoPredicate); | ||
} | ||
|
||
public Optional<TSubNetwork> findSubNetwork(SCL tlNodeType, Predicate<TSubNetwork> tdoPredicate) { | ||
return getFilteredSubNetworks(tlNodeType, tdoPredicate).findFirst(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters