Merge tag 'release-1.3.0' into develop
release-1.3.0
This commit is contained in:
commit
5a8cdef9d9
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>org.sadtech.autoresponder</groupId>
|
<groupId>org.sadtech.autoresponder</groupId>
|
||||||
<artifactId>autoresponder</artifactId>
|
<artifactId>autoresponder</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.3.0-RELEASE</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -69,7 +69,7 @@ public class Autoresponder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!patternUnits.isPresent()) {
|
if (!patternUnits.isPresent()) {
|
||||||
patternUnits = nextUnits.stream().filter(nextUnit -> (nextUnit.getPattern()==null && nextUnit.getKeyWords()==null)).max(unitPriorityComparator);
|
patternUnits = nextUnits.stream().filter(nextUnit -> (nextUnit.getPattern() == null && nextUnit.getKeyWords() == null)).max(unitPriorityComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
return patternUnits.orElse(null);
|
return patternUnits.orElse(null);
|
||||||
|
@ -16,8 +16,9 @@ public abstract class Unit {
|
|||||||
matchThreshold = 10;
|
matchThreshold = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Unit(Set<String> keyWords, Integer matchThreshold, Integer priority, Boolean level, List<Unit> nextUnits) {
|
public Unit(Set<String> keyWords, Pattern pattern, Integer matchThreshold, Integer priority, List<Unit> nextUnits) {
|
||||||
this.keyWords = keyWords;
|
this.keyWords = keyWords;
|
||||||
|
this.pattern = pattern;
|
||||||
this.matchThreshold = matchThreshold;
|
this.matchThreshold = matchThreshold;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
this.nextUnits = nextUnits;
|
this.nextUnits = nextUnits;
|
||||||
@ -83,6 +84,7 @@ public abstract class Unit {
|
|||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
Unit unit = (Unit) o;
|
Unit unit = (Unit) o;
|
||||||
return Objects.equals(keyWords, unit.keyWords) &&
|
return Objects.equals(keyWords, unit.keyWords) &&
|
||||||
|
Objects.equals(pattern, unit.pattern) &&
|
||||||
Objects.equals(matchThreshold, unit.matchThreshold) &&
|
Objects.equals(matchThreshold, unit.matchThreshold) &&
|
||||||
Objects.equals(priority, unit.priority) &&
|
Objects.equals(priority, unit.priority) &&
|
||||||
Objects.equals(nextUnits, unit.nextUnits);
|
Objects.equals(nextUnits, unit.nextUnits);
|
||||||
@ -90,7 +92,6 @@ public abstract class Unit {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(keyWords, matchThreshold, priority, nextUnits);
|
return Objects.hash(keyWords, pattern, matchThreshold, priority, nextUnits);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
//package org.sadtech.autoresponder.submodule.insertwords;
|
|
||||||
//
|
|
||||||
//import lombok.Getter;
|
|
||||||
//import lombok.Setter;
|
|
||||||
//
|
|
||||||
//import java.util.List;
|
|
||||||
//import java.util.regex.Matcher;
|
|
||||||
//import java.util.regex.Pattern;
|
|
||||||
//
|
|
||||||
//public class InsertWords {
|
|
||||||
//
|
|
||||||
// @Setter
|
|
||||||
// private String inText;
|
|
||||||
// @Getter
|
|
||||||
// private String outText;
|
|
||||||
//
|
|
||||||
// public void insert(List<String> words) {
|
|
||||||
// Pattern pattern = Pattern.compile("\\{(\\d+)}"); // Задаем шаблон
|
|
||||||
// Matcher m = pattern.matcher(inText); // Инициализация Matcher
|
|
||||||
// StringBuffer result = new StringBuffer(); // Буфер для конечного значения
|
|
||||||
// while (m.find()) { // Проверка на совпадение
|
|
||||||
// if (Integer.parseInt(m.group(1)) < words.size()) {
|
|
||||||
// m.appendReplacement(result, words.get(Integer.parseInt(m.group(1)))); // Подставляем значение из HashMap
|
|
||||||
// } else {
|
|
||||||
// m.appendReplacement(result, m.group(0));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// m.appendTail(result); // Добавить остаток строки
|
|
||||||
// outText = result.toString();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user