<commit_before>package com.azcltd.fluffycommons.utils;

import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

/**
 * Thread safe date formatter. Each thread will have it's own instance of {@link SimpleDateFormat} formatter.<br/>
 * This class provides basic methods to parse / format dates: {@link #parse(String)}, {@link #format(java.util.Date)},
 * {@link #format(long)}.
 */
public class ThreadSafeDateFormatter {

    public static final TimeZone GMT = TimeZone.getTimeZone("GMT");

    private final String mPattern;
    private final TimeZone mTz;
    private final DateFormatSymbols mSymbols;

    private ThreadLocal<SimpleDateFormat> mFormatter = new ThreadLocal<SimpleDateFormat>() {
        protected SimpleDateFormat initialValue() {
            SimpleDateFormat formatter = new SimpleDateFormat(mPattern, Locale.getDefault());
            if (mTz != null) formatter.setTimeZone(mTz);
            if (mSymbols != null) formatter.setDateFormatSymbols(mSymbols);
            return formatter;
        }
    };

    public ThreadSafeDateFormatter(String pattern) {
        this(pattern, null, null);
    }

    public ThreadSafeDateFormatter(String pattern, TimeZone tz) {
        this(pattern, tz, null);
    }

    public ThreadSafeDateFormatter(String pattern, DateFormatSymbols symbols) {
        this(pattern, null, symbols);
    }

    public ThreadSafeDateFormatter(String pattern, TimeZone tz, DateFormatSymbols symbols) {
        mPattern = pattern;
        mTz = tz;
        mSymbols = symbols;
    }

    public Date parse(String str) throws ParseException {
        return mFormatter.get().parse(str);
    }

    public String format(Date date) {
        return mFormatter.get().format(date);
    }

    public String format(long date) {
        return format(new Date(date));
    }

}<commit_msg>Added locale parameter to ThreadSafeDateFormatter<commit_after>package com.azcltd.fluffycommons.utils;

import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

/**
 * Thread safe date formatter. Each thread will have it's own instance of {@link SimpleDateFormat} formatter.<br/>
 * This class provides basic methods to parse / format dates: {@link #parse(String)}, {@link #format(java.util.Date)},
 * {@link #format(long)}.
 */
public class ThreadSafeDateFormatter {

    public static final TimeZone GMT = TimeZone.getTimeZone("GMT");

    private final String mPattern;
    private final Locale mLocale;
    private final TimeZone mTz;
    private final DateFormatSymbols mSymbols;

    private ThreadLocal<SimpleDateFormat> mFormatter = new ThreadLocal<SimpleDateFormat>() {
        protected SimpleDateFormat initialValue() {
            Locale locale = mLocale == null ? Locale.getDefault() : mLocale;
            SimpleDateFormat formatter = new SimpleDateFormat(mPattern, locale);
            if (mTz != null) formatter.setTimeZone(mTz);
            if (mSymbols != null) formatter.setDateFormatSymbols(mSymbols);
            return formatter;
        }
    };

    public ThreadSafeDateFormatter(String pattern) {
        this(pattern, null, null, null);
    }

    public ThreadSafeDateFormatter(String pattern, Locale locale) {
        this(pattern, locale, null, null);
    }

    public ThreadSafeDateFormatter(String pattern, TimeZone tz) {
        this(pattern, null, tz, null);
    }

    public ThreadSafeDateFormatter(String pattern, DateFormatSymbols symbols) {
        this(pattern, null, null, symbols);
    }

    public ThreadSafeDateFormatter(String pattern, Locale locale, TimeZone tz) {
        this(pattern, locale, tz, null);
    }

    public ThreadSafeDateFormatter(String pattern, Locale locale, TimeZone tz, DateFormatSymbols symbols) {
        mPattern = pattern;
        mLocale = locale;
        mTz = tz;
        mSymbols = symbols;
    }

    public Date parse(String str) throws ParseException {
        return mFormatter.get().parse(str);
    }

    public String format(Date date) {
        return mFormatter.get().format(date);
    }

    public String format(long date) {
        return format(new Date(date));
    }

}
{'fraction_non_alphanumeric': 0.09611829944547134, 'fraction_numerical': 0.0, 'mean_word_length': 3.3595166163141994, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3230234', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1178, 'n_words': 329}