use of ai.elimu.model.content.LetterSoundCorrespondence in project webapp by elimu-ai.
the class LetterSoundCorrespondenceDaoJpa method read.
@Override
public LetterSoundCorrespondence read(List<Letter> letters, List<Sound> sounds) throws DataAccessException {
// TODO: implement usage of CriteriaQuery/CriteriaQuery
String letterSoundCorrespondenceLetters = letters.stream().map(Letter::getText).collect(Collectors.joining());
String letterSoundCorrespondenceSounds = sounds.stream().map(Sound::getValueIpa).collect(Collectors.joining());
for (LetterSoundCorrespondence letterSoundCorrespondence : readAllOrderedByUsage()) {
String lettersAsString = letterSoundCorrespondence.getLetters().stream().map(Letter::getText).collect(Collectors.joining());
String soundsAsString = letterSoundCorrespondence.getSounds().stream().map(Sound::getValueIpa).collect(Collectors.joining());
if (lettersAsString.equals(letterSoundCorrespondenceLetters) && soundsAsString.equals(letterSoundCorrespondenceSounds)) {
return letterSoundCorrespondence;
}
}
return null;
}
Aggregations