[LIB-9] Separate chesshog-uci module
[chesshog.git] / chesshog-uci / src / main / java / org / hedgecode / chess / uci / command / CommandParams.java
1 /*
2  * Copyright (c) 2018. Developed by Hedgecode.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.hedgecode.chess.uci.command;
18
19 import org.hedgecode.chess.uci.UCIConstants;
20
21 /**
22  * Container class for UCI command with parameters.
23  *
24  * @author Dmitry Samoshin aka gotty
25  */
26 public final class CommandParams {
27
28     private String name;
29     private String params;
30
31     public CommandParams(String command) {
32         String[] arrCommand = command.trim().split(
33                 UCIConstants.COMMAND_SEP_REGEX, 2
34         );
35         name = arrCommand[0];
36         params = arrCommand.length > 1 ? arrCommand[1] : null;
37     }
38
39     public String getName() {
40         return name;
41     }
42
43     public String getParams() {
44         return params;
45     }
46
47 }