<commit_before>package com.bustiblelemons.cthulhator.character.history.logic;

import android.content.Context;
import android.support.annotation.NonNull;

import com.bustiblelemons.cthulhator.R;
import com.bustiblelemons.cthulhator.character.characterslist.model.SavedCharacter;
import com.bustiblelemons.cthulhator.character.history.model.HistoryEvent;
import com.bustiblelemons.cthulhator.settings.Settings;
import com.bustiblelemons.cthulhator.settings.character.CharacterSettings;
import com.bustiblelemons.cthulhator.system.brp.statistics.BRPStatistic;
import com.bustiblelemons.randomuserdotme.model.Location;

import org.joda.time.DateTime;

import java.util.Random;

/**
 * Created by hiv on 13.11.14.
 */
public class HistoryEventFactory {

    private static HistoryEventFactory INSTANCE;
    private        Context             mContext;
    private        SavedCharacter      mSavedCharacter;

    public HistoryEventFactory(Context context) {
        mContext = context;
    }

    public static HistoryEventFactory from(@NonNull Context context) {
        if (INSTANCE == null) {
            INSTANCE = new HistoryEventFactory(context);
        } else if (INSTANCE != null) {
            if (INSTANCE.mContext != null && !INSTANCE.mContext.equals(context)) {
                return INSTANCE = new HistoryEventFactory(context);
            }
        }
        return INSTANCE;
    }

    public HistoryEventFactory withCharacter(SavedCharacter mSavedCharacter) {
        this.mSavedCharacter = mSavedCharacter;
        return this;
    }

    public HistoryEvent buildBirthEvent() {
        DateTime dateTime = getBirthDateTime();
        HistoryEvent birthEvent = new HistoryEvent();
        birthEvent.setDate(dateTime.getMillis());
        if (mSavedCharacter != null && mSavedCharacter.getDescription() != null) {
            Location birthLocation = mSavedCharacter.getDescription().getLocation();
            if (birthLocation != null) {
                birthEvent.setLocation(birthLocation);
                String name = mContext.getResources().getString(R.string.born);
                String description = birthLocation.toString();
                birthEvent.setName(name);
                birthEvent.setDescription(description);
            }<commit_msg>add default localized title for borndate<commit_after>package com.bustiblelemons.cthulhator.character.history.logic;

import android.content.Context;
import android.support.annotation.NonNull;

import com.bustiblelemons.cthulhator.R;
import com.bustiblelemons.cthulhator.character.characterslist.model.SavedCharacter;
import com.bustiblelemons.cthulhator.character.history.model.HistoryEvent;
import com.bustiblelemons.cthulhator.settings.Settings;
import com.bustiblelemons.cthulhator.settings.character.CharacterSettings;
import com.bustiblelemons.cthulhator.system.brp.statistics.BRPStatistic;
import com.bustiblelemons.randomuserdotme.model.Location;

import org.joda.time.DateTime;

import java.util.Random;

/**
 * Created by hiv on 13.11.14.
 */
public class HistoryEventFactory {

    private static HistoryEventFactory INSTANCE;
    private        Context             mContext;
    private        SavedCharacter      mSavedCharacter;

    public HistoryEventFactory(Context context) {
        mContext = context;
    }

    public static HistoryEventFactory from(@NonNull Context context) {
        if (INSTANCE == null) {
            INSTANCE = new HistoryEventFactory(context);
        } else if (INSTANCE != null) {
            if (INSTANCE.mContext != null && !INSTANCE.mContext.equals(context)) {
                return INSTANCE = new HistoryEventFactory(context);
            }
        }
        return INSTANCE;
    }

    public HistoryEventFactory withCharacter(SavedCharacter mSavedCharacter) {
        this.mSavedCharacter = mSavedCharacter;
        return this;
    }

    public HistoryEvent buildBirthEvent() {
        DateTime dateTime = getBirthDateTime();
        HistoryEvent birthEvent = new HistoryEvent();
        birthEvent.setDate(dateTime.getMillis());
        String name = mContext.getResources().getString(R.string.born);
        birthEvent.setName(name);
        if (mSavedCharacter != null && mSavedCharacter.getDescription() != null) {
            Location birthLocation = mSavedCharacter.getDescription().getLocation();
            if (birthLocation != null) {
                birthEvent.setLocation(birthLocation);
                String description = birthLocation.toString();
                birthEvent.setDescription(description);
            }
{'fraction_non_alphanumeric': 0.08849945235487404, 'fraction_numerical': 0.002628696604600219, 'mean_word_length': 3.128390596745027, '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': '7493264', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1237, 'n_words': 229}