<commit_before>package com.github.dreamhead.moco.util;

import com.google.common.base.Strings;

import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;

import static com.github.dreamhead.moco.util.Preconditions.checkNotNullOrEmpty;

public final class URLs {
    private static final String SEPARATOR = "/";

    public static String resourceRoot(final String name) {
        if (name.startsWith(SEPARATOR)) {
            return name;
        }

        return SEPARATOR + name;
    }

    public static String toBase(final String baseUri) {
        if (baseUri.endsWith(SEPARATOR)) {
            return baseUri;
        }

        return baseUri + SEPARATOR;
    }

    public static String join(final String base, final String... paths) {
        String target = base;
        for (String path : paths) {
            target = doJoin(target, path);
        }

        return target;
    }

    public static String doJoin(final String base, final String path) {
        String joinPath = toJoinPath(path);
        if (base.endsWith(SEPARATOR)) {
            return base + joinPath;
        }

        if (joinPath.isEmpty()) {
            return base;<commit_msg>made do join in urls private<commit_after>package com.github.dreamhead.moco.util;

import com.google.common.base.Strings;

import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;

import static com.github.dreamhead.moco.util.Preconditions.checkNotNullOrEmpty;

public final class URLs {
    private static final String SEPARATOR = "/";

    public static String resourceRoot(final String name) {
        if (name.startsWith(SEPARATOR)) {
            return name;
        }

        return SEPARATOR + name;
    }

    public static String toBase(final String baseUri) {
        if (baseUri.endsWith(SEPARATOR)) {
            return baseUri;
        }

        return baseUri + SEPARATOR;
    }

    public static String join(final String base, final String... paths) {
        String target = base;
        for (String path : paths) {
            target = doJoin(target, path);
        }

        return target;
    }

    private static String doJoin(final String base, final String path) {
        String joinPath = toJoinPath(path);
        if (base.endsWith(SEPARATOR)) {
            return base + joinPath;
        }

        if (joinPath.isEmpty()) {
            return base;
{'fraction_non_alphanumeric': 0.08963367108339829, 'fraction_numerical': 0.0, 'mean_word_length': 2.4595687331536387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1372192', 'n_tokens_mistral': 737, 'n_tokens_neox': 715, 'n_words': 192}