-
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 #393 from com-pas/develop
Release 0.2.22
- Loading branch information
Showing
31 changed files
with
2,206 additions
and
83 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/BDAService.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,28 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TBDA; | ||
import org.lfenergy.compas.scl2007b4.model.TDAType; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class BDAService { | ||
|
||
public Stream<TBDA> getBDAs(TDAType tdaType) { | ||
return tdaType.getBDA().stream(); | ||
} | ||
|
||
public Stream<TBDA> getFilteredBDAs(TDAType tdaType, Predicate<TBDA> tTBDAPredicate) { | ||
return getBDAs(tdaType).filter(tTBDAPredicate); | ||
} | ||
|
||
public Optional<TBDA> findBDA(TDAType tdaType, Predicate<TBDA> tBDAPredicate) { | ||
return getFilteredBDAs(tdaType, tBDAPredicate).findFirst(); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DaTypeService.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,19 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TDAType; | ||
import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; | ||
|
||
import java.util.Optional; | ||
|
||
public class DaTypeService { | ||
|
||
public Optional<TDAType> findDaType(TDataTypeTemplates tDataTypeTemplates, String daTypeId) { | ||
return tDataTypeTemplates.getDAType().stream() | ||
.filter(tdaType -> tdaType.isSetId() && tdaType.getId().equals(daTypeId)).findFirst(); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DaiService.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,30 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.*; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class DaiService { | ||
|
||
public Stream<TDAI> getDais(TDOI tdoi) { | ||
return tdoi.getSDIOrDAI() | ||
.stream() | ||
.filter(dai -> dai.getClass().equals(TDAI.class)) | ||
.map(TDAI.class::cast); | ||
} | ||
|
||
public Stream<TDAI> getFilteredDais(TDOI tdoi, Predicate<TDAI> tdaiPredicate) { | ||
return getDais(tdoi).filter(tdaiPredicate); | ||
} | ||
|
||
public Optional<TDAI> findDai(TDOI tdoi, Predicate<TDAI> tdaiPredicate) { | ||
return getFilteredDais(tdoi, tdaiPredicate).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
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
28 changes: 28 additions & 0 deletions
28
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DoiService.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,28 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TAnyLN; | ||
import org.lfenergy.compas.scl2007b4.model.TDOI; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class DoiService { | ||
|
||
public Stream<TDOI> getDois(TAnyLN tAnyLN) { | ||
return tAnyLN.getDOI().stream(); | ||
} | ||
|
||
public Stream<TDOI> getFilteredDois(TAnyLN tAnyLN, Predicate<TDOI> tdoiPredicate) { | ||
return getDois(tAnyLN).filter(tdoiPredicate); | ||
} | ||
|
||
public Optional<TDOI> findDoi(TAnyLN tAnyLN, Predicate<TDOI> tdoiPredicate) { | ||
return getFilteredDois(tAnyLN, tdoiPredicate).findFirst(); | ||
} | ||
|
||
} |
Oops, something went wrong.