-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: gleizesDor <[email protected]>
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(); | ||
} |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.filter(dai -> dai.getClass().equals(TSDI.class)) | |
.filter(TSDI.class::isInstance) |
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class SdiService { |
There was a problem hiding this comment.
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 ?
Add SDIService
close #528