2 * Copyright (c) 2019-2020. Developed by Hedgecode.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.hedgecode.chess.scanner;
19 import static org.hedgecode.chess.scanner.ScannerConstants.*;
24 * @author Dmitry Samoshin aka gotty
26 public enum ScannerType {
28 CHESSGAMES ( TYPE_CHESSGAMES, DOMAIN_CHESSGAMES ),
29 LICHESS ( TYPE_LICHESS, DOMAIN_LICHESS ),
30 CHESSBOMB ( TYPE_CHESSBOMB, DOMAIN_CHESSBOMB ),
31 CHESS24 ( TYPE_CHESS24, DOMAIN_CHESS24 ),
32 CHESSCOM ( TYPE_CHESSCOM, DOMAIN_CHESSCOM ),
33 CHESS2700 ( TYPE_2700CHESS, DOMAIN_2700CHESS );
36 private String domain;
38 ScannerType(String type, String domain) {
43 public String type() {
47 public String domain() {
51 public static ScannerType byType(String type) {
52 for (ScannerType scannerType : ScannerType.values()) {
53 if (scannerType.type.equals(type))
59 public static ScannerType byHost(String host) {
61 for (ScannerType scannerType : ScannerType.values()) {
62 if (StringUtils.belongDomain(scannerType.domain, host)) {