<commit_before>//
// Treasure Data Logger for Java.
//
// Copyright (C) 2011 <NAME>
//
//    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 com.treasure_data.model;

import java.util.regex.Pattern;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractClient implements Client {

    private static Logger LOG = LoggerFactory.getLogger(AbstractClient.class);

    private String apiKey;

    private Pattern databasePat;

    private Pattern columnPat;

    protected AbstractClient(final String apiKey) {
        this.apiKey = apiKey;
        databasePat = Pattern.compile("^([a-z0-9_]+)$");
        columnPat = Pattern.compile("^([a-z0-9_]+)$");
    }

    public String getAPIKey() {
        return apiKey;
    }

    protected void setAPIKey(String apiKey) {
        this.apiKey = apiKey;
    }

    public boolean validateDatabaseName(String name) {
        if (name == null || name.equals("")) {
            LOG.info(String.format("Empty name is not allowed: %s",
                    new Object[] { name }));
            return false;
        }

        int len = name.length();
        if (len < 3 || 32 < len) {
            LOG.info(String.format("Name must be 3 to 32 characters, got %d characters.",
                    new Object[] { len }));
            return false;
        }

        if (!databasePat.matcher(name).matches()) {
            LOG.info("Name must consist only of alphabets, numbers, '_'.");
            return false;
        }

        return true;
    }

    public boolean validateTableName(String name) {
        return validateDatabaseName(name);
    }

    public boolean validateColumnName(String name) {
        if (name == null || name.equals("")) {
            LOG.info(String.format("Empty column name is not allowed: %s",
                    new Object[] { name }));
            return false;
        }

        int len = name.length();
        if (32 < len) {
            LOG.info(String.format("Column name must be to 32 characters, got %d characters.",
                    new Object[] { len }));
            return false;
        }

        if (!columnPat.matcher(name).matches()) {
            LOG.info("Column name must consist only of alphabets, numbers, '_'.");
            return false;
        }

        return true;
    }
}
<commit_msg>changed modifiers of validate{Database,Table}Name methods: public -> public static<commit_after>//
// Treasure Data Logger for Java.
//
// Copyright (C) 2011 <NAME>
//
//    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 com.treasure_data.model;

import java.util.regex.Pattern;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractClient implements Client {

    private static Logger LOG = LoggerFactory.getLogger(AbstractClient.class);

    private String apiKey;

    private static Pattern databasePat;

    private Pattern columnPat;

    protected AbstractClient(final String apiKey) {
        this.apiKey = apiKey;
        databasePat = Pattern.compile("^([a-z0-9_]+)$");
        columnPat = Pattern.compile("^([a-z0-9_]+)$");
    }

    public String getAPIKey() {
        return apiKey;
    }

    protected void setAPIKey(String apiKey) {
        this.apiKey = apiKey;
    }

    public static boolean validateDatabaseName(String name) {
        if (name == null || name.equals("")) {
            LOG.info(String.format("Empty name is not allowed: %s",
                    new Object[] { name }));
            return false;
        }

        int len = name.length();
        if (len < 3 || 32 < len) {
            LOG.info(String.format("Name must be 3 to 32 characters, got %d characters.",
                    new Object[] { len }));
            return false;
        }

        if (!databasePat.matcher(name).matches()) {
            LOG.info("Name must consist only of alphabets, numbers, '_'.");
            return false;
        }

        return true;
    }

    public static boolean validateTableName(String name) {
        return validateDatabaseName(name);
    }

    public boolean validateColumnName(String name) {
        if (name == null || name.equals("")) {
            LOG.info(String.format("Empty column name is not allowed: %s",
                    new Object[] { name }));
            return false;
        }

        int len = name.length();
        if (32 < len) {
            LOG.info(String.format("Column name must be to 32 characters, got %d characters.",
                    new Object[] { len }));
            return false;
        }

        if (!columnPat.matcher(name).matches()) {
            LOG.info("Column name must consist only of alphabets, numbers, '_'.");
            return false;
        }

        return true;
    }
}

{'fraction_non_alphanumeric': 0.11214310285517716, 'fraction_numerical': 0.008255933952528379, 'mean_word_length': 2.131394722670975, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2557643', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1527, 'n_words': 516}