From 6604ca733e314b56d71f7961d8c58988e6ab56e0 Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Sat, 2 Feb 2019 09:04:40 +0300 Subject: [PATCH] Release 1.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Удалил ненужный класс --- pom.xml | 2 +- .../sadtech/autoresponder/Autoresponder.java | 2 +- .../sadtech/autoresponder/entity/Unit.java | 7 ++-- .../submodule/insertwords/InsertWords.java | 33 ------------------- 4 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 src/main/java/org/sadtech/autoresponder/submodule/insertwords/InsertWords.java diff --git a/pom.xml b/pom.xml index c686655..dfd0910 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.sadtech.autoresponder autoresponder - 1.3.0-SNAPSHOT + 1.3.0-RELEASE jar diff --git a/src/main/java/org/sadtech/autoresponder/Autoresponder.java b/src/main/java/org/sadtech/autoresponder/Autoresponder.java index cc4d0d4..05d54a2 100644 --- a/src/main/java/org/sadtech/autoresponder/Autoresponder.java +++ b/src/main/java/org/sadtech/autoresponder/Autoresponder.java @@ -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); diff --git a/src/main/java/org/sadtech/autoresponder/entity/Unit.java b/src/main/java/org/sadtech/autoresponder/entity/Unit.java index 42446ac..e4df06c 100644 --- a/src/main/java/org/sadtech/autoresponder/entity/Unit.java +++ b/src/main/java/org/sadtech/autoresponder/entity/Unit.java @@ -16,8 +16,9 @@ public abstract class Unit { matchThreshold = 10; } - public Unit(Set keyWords, Integer matchThreshold, Integer priority, Boolean level, List nextUnits) { + public Unit(Set keyWords, Pattern pattern, Integer matchThreshold, Integer priority, List 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); } - } diff --git a/src/main/java/org/sadtech/autoresponder/submodule/insertwords/InsertWords.java b/src/main/java/org/sadtech/autoresponder/submodule/insertwords/InsertWords.java deleted file mode 100644 index 9e4e0b7..0000000 --- a/src/main/java/org/sadtech/autoresponder/submodule/insertwords/InsertWords.java +++ /dev/null @@ -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 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(); -// } -// -//} -