[LIB-9] Separate chesshog-uci module
[chesshog.git] / chesshog-uci / src / main / java / org / hedgecode / chess / uci / command / InfoParams.java
diff --git a/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java
new file mode 100644 (file)
index 0000000..da3c5d8
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.chess.uci.command;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Container class for values of UCI command "info".
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+public final class InfoParams {
+
+
+    private static final Pattern INFO_PATTERN =
+            Pattern.compile(
+                    String.format("^\\s*%s(.*)%s\\s+(%s)(.*)$" /*, ... */ )
+            );
+
+    private InfoParams() {
+
+    }
+
+/*
+
+    depth|seldepth|time|nodes|pv|multipv|score...|currmove|currmovenumber|hashfull|nps
+    tbhits|sbhits|cpuload|string|refutation|currline
+
+*/
+
+
+    public static final class Factory {
+
+        public static InfoParams parse(String option) {
+            Matcher matcher = INFO_PATTERN.matcher(option);
+            if (matcher.find()) {
+/*
+                return new InfoParams(
+                        matcher.group(1).trim(),
+                        matcher.group(2).trim(),
+                        matcher.group(3).trim()
+                );
+*/
+            }
+            return null;
+        }
+
+    }
+
+
+}