<commit_before>package com.example.david.kotlinchuck.findJoke

import com.example.david.kotlinchuck.findJoke.event.FindJokeEvent
import com.example.david.kotlinchuck.findJoke.ui.FindJokeView
import com.example.david.kotlinchuck.lib.EventBus
import com.example.david.kotlinchuck.lib.GreenRobotEventBus
import org.greenrobot.eventbus.Subscribe

/**
 * Created by david on 28/6/17.
 */
class FindJokePresenterImpl(view: FindJokeView) : FindJokePresenter {

    var view: FindJokeView? = view
    var eventBus: EventBus = GreenRobotEventBus.INSTANCE
    var repository: FindJokeRepository = FindJokeRepositoryImpl()


    override fun onCreate() {
        if(view != null){
            this.eventBus.register(this);
        }
    }

    override fun onDestroy() {
        this.eventBus.unregister(this);
        view = null
    }

    override fun findJoke(name: String, lastname: String) {
        repository.findJoke(name, lastname)
    }

    @Subscribe
    override fun onEventMainThread(event: FindJokeEvent) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

}<commit_msg>Setted the presenter to guard the params<commit_after>package com.example.david.kotlinchuck.findJoke

import com.example.david.kotlinchuck.findJoke.event.FindJokeEvent
import com.example.david.kotlinchuck.findJoke.ui.FindJokeView
import com.example.david.kotlinchuck.lib.EventBus
import com.example.david.kotlinchuck.lib.GreenRobotEventBus
import org.greenrobot.eventbus.Subscribe

/**
 * Created by david on 28/6/17.
 */
class FindJokePresenterImpl(view: FindJokeView) : FindJokePresenter {

    var view: FindJokeView? = view
    var eventBus: EventBus = GreenRobotEventBus.INSTANCE
    var repository: FindJokeRepository = FindJokeRepositoryImpl()


    override fun onCreate() {
        if(view != null){
            this.eventBus.register(this)
        }
    }

    override fun onDestroy() {
        this.eventBus.unregister(this)
        view = null
    }

    override fun findJoke(name: String, lastname: String) {

        var finalName: String? = null
        var finalLastName: String? = null

        if(!name.isEmpty())
            finalName = name

        if(!lastname.isEmpty())
            finalLastName = lastname

        repository.findJoke(name, lastname)
    }

    @Subscribe
    override fun onEventMainThread(event: FindJokeEvent) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

}
{'fraction_non_alphanumeric': 0.09304174950298211, 'fraction_numerical': 0.003976143141153081, 'mean_word_length': 3.2285714285714286, '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': '6003272', 'n_tokens_mistral': 803, 'n_tokens_neox': 769, 'n_words': 162}