From 8201d3db9120a5b5ef3e11a9d361ba41b30acc18 Mon Sep 17 00:00:00 2001 From: Maximilien LEDOUX Date: Sat, 26 Feb 2022 14:41:35 +0100 Subject: [PATCH] =?UTF-8?q?ProtocolWriter=20:=20mod=C3=A8le=20pour=20r?= =?UTF-8?q?=C3=A8gles=20protocoles=20d'=C3=A9criture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../protocol/ProtocolWriter.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/src/main/java/lightcontainer/protocol/ProtocolWriter.java diff --git a/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java b/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java new file mode 100644 index 0000000..c05e428 --- /dev/null +++ b/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java @@ -0,0 +1,23 @@ +package lightcontainer.protocol; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public abstract class ProtocolWriter { + + private final Pattern rulePattern; + + protected ProtocolWriter(String pattern) { + this.rulePattern = Pattern.compile(pattern); + } + + public String execute(String data) { + Matcher ruleMatcher = this.rulePattern.matcher(data); + + if (ruleMatcher.matches()) { + + } + + return null; + } +}