Skip to content

feat(#528): Add SDIService #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

feat(#528): Add SDIService #529

wants to merge 1 commit into from

Conversation

gleizesDor
Copy link
Contributor

Add SDIService

close #528

Signed-off-by: gleizesDor <[email protected]>
@gleizesDor gleizesDor requested a review from massifben July 10, 2025 15:21
@gleizesDor gleizesDor self-assigned this Jul 10, 2025
@gleizesDor gleizesDor linked an issue Jul 10, 2025 that may be closed by this pull request
Comment on lines +16 to +29
public Stream<TSDI> getSdis(TDOI tdoi) {
return tdoi.getSDIOrDAI()
.stream()
.filter(dai -> dai.getClass().equals(TSDI.class))
.map(TSDI.class::cast);
}

public Stream<TSDI> getFilteredSdis(TDOI tdoi, Predicate<TSDI> tdaiPredicate) {
return getSdis(tdoi).filter(tdaiPredicate);
}

public Optional<TSDI> findSdi(TDOI tdoi, Predicate<TSDI> tdaiPredicate) {
return getFilteredSdis(tdoi, tdaiPredicate).findFirst();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can have SDI under SDI. Maybe we could also add these methods :

Stream<TSDI> getSdis(TSDI tsdi)

Stream<TSDI> getFilteredSdis(TSDI tsdi, Predicate<TSDI> tsdiPredicate)

Optional<TSDI> findSdi(TSDI tsdi, Predicate<TSDI> tsdiPredicate)

return getSdis(tdoi).filter(tdaiPredicate);
}

public Optional<TSDI> findSdi(TDOI tdoi, Predicate<TSDI> tdaiPredicate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

tsdiPredicate instead of tdaiPredicate

.map(TSDI.class::cast);
}

public Stream<TSDI> getFilteredSdis(TDOI tdoi, Predicate<TSDI> tdaiPredicate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

tsdiPredicate instead of tdaiPredicate

public Stream<TDAI> getDais(TSDI tsdi) {
return tsdi.getSDIOrDAI()
.stream()
.filter(dai -> dai.getClass().equals(TDAI.class))
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
.filter(dai -> dai.getClass().equals(TDAI.class))
.filter(TDAI.class::isInstance)

public Stream<TSDI> getSdis(TDOI tdoi) {
return tdoi.getSDIOrDAI()
.stream()
.filter(dai -> dai.getClass().equals(TSDI.class))
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
.filter(dai -> dai.getClass().equals(TSDI.class))
.filter(TSDI.class::isInstance)

@github-project-automation github-project-automation bot moved this from To do to In progress in CoMPAS SCT Board Jul 11, 2025
import java.util.function.Predicate;
import java.util.stream.Stream;

public class SdiService {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some tests ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

Add SDIService
2 participants