Release 1.3.0

* Удалил ненужный класс
This commit is contained in:
Mark Struchkov 2019-02-02 09:04:40 +03:00
parent 33253b5000
commit 6604ca733e
4 changed files with 6 additions and 38 deletions

View File

@ -6,7 +6,7 @@
<groupId>org.sadtech.autoresponder</groupId>
<artifactId>autoresponder</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.0-RELEASE</version>
<packaging>jar</packaging>
<build>
<plugins>

View File

@ -69,7 +69,7 @@ public class Autoresponder {
}
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);

View File

@ -16,8 +16,9 @@ public abstract class Unit {
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.pattern = pattern;
this.matchThreshold = matchThreshold;
this.priority = priority;
this.nextUnits = nextUnits;
@ -83,6 +84,7 @@ public abstract class Unit {
if (o == null || getClass() != o.getClass()) return false;
Unit unit = (Unit) o;
return Objects.equals(keyWords, unit.keyWords) &&
Objects.equals(pattern, unit.pattern) &&
Objects.equals(matchThreshold, unit.matchThreshold) &&
Objects.equals(priority, unit.priority) &&
Objects.equals(nextUnits, unit.nextUnits);
@ -90,7 +92,6 @@ public abstract class Unit {
@Override
public int hashCode() {
return Objects.hash(keyWords, matchThreshold, priority, nextUnits);
return Objects.hash(keyWords, pattern, matchThreshold, priority, nextUnits);
}
}

View File

@ -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();
// }
//
//}