Исправлен поиск в прошлом и сборка фронтенда

This commit is contained in:
sshkurov
2021-12-05 13:34:57 +03:00
parent 1219670d51
commit 7cf7233c4b
3 changed files with 8 additions and 11 deletions

View File

@@ -1,6 +1,5 @@
package ru.serega6531.packmate.service;
import com.google.common.collect.Iterables;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,9 +63,8 @@ public class PatternService {
return new PatternMatcher(bytes, list).findMatches();
}
public Optional<FoundPattern> tryMatch(byte[] bytes, Pattern pattern) {
Set<FoundPattern> matches = new PatternMatcher(bytes, List.of(pattern)).findMatches();
return Optional.ofNullable(Iterables.getOnlyElement(matches, null));
public Set<FoundPattern> matchOne(byte[] bytes, Pattern pattern) {
return new PatternMatcher(bytes, List.of(pattern)).findMatches();
}
public void enable(int id, boolean enabled) {