<commit_before>package org.firezenk.kartographer.library.dsl

import org.firezenk.kartographer.annotations.RouteAnimation
import org.firezenk.kartographer.library.core.Core.Companion.ROOT_NODE
import org.firezenk.kartographer.library.types.ContextRoute
import org.firezenk.kartographer.library.types.ExternalRoute
import org.firezenk.kartographer.library.types.Path
import org.firezenk.kartographer.library.types.ViewRoute
import org.firezenk.kartographer.processor.interfaces.Routable

/**
 * Project: Kartographer
 *
 * Created by <NAME>, aka firezenk on 01/12/17.
 * Copyright © <NAME> 2017
 */
@KartographerDsl
class RouteDsl {

    class RouteBuilder {

        var target: Any? = null
        var params: Map<String, Any>? = mapOf<String, Any>()
        var path: Path? = null
        var anchor: Any? = null
        var animation: RouteAnimation? = null
        var forResult: Int = -1

        private val calculatedPath: Path by lazy {
            if (target is Routable) {
                val castedTarget = target as Routable
                if (castedTarget.path() != "") {
                    Path(castedTarget.path())
                } else ROOT_NODE
            } else ROOT_NODE
        }

        fun build(): ViewRoute = ViewRoute(target!!, params!!, path ?: calculatedPath, anchor!!, animation, forResult)
    }

    class RouteActivityBuilder<B> {

        var target: Any? = null
        var params: B? = null
        var path: Path? = null
        var forResult: Int = -1

        private val calculatedPath: Path by lazy {
            if (target is Routable) {
                val castedTarget = target as Routable
                if (castedTarget.path() != "") {
                    Path(castedTarget.path())
                } else ROOT_NODE
            } else ROOT_NODE
        }

        fun build(): ContextRoute<B> = ContextRoute<B>(target!!, params!!, path ?: calculatedPath, forResult)
    }<commit_msg>Make view route params optional<commit_after>package org.firezenk.kartographer.library.dsl

import org.firezenk.kartographer.annotations.RouteAnimation
import org.firezenk.kartographer.library.core.Core.Companion.ROOT_NODE
import org.firezenk.kartographer.library.types.ContextRoute
import org.firezenk.kartographer.library.types.ExternalRoute
import org.firezenk.kartographer.library.types.Path
import org.firezenk.kartographer.library.types.ViewRoute
import org.firezenk.kartographer.processor.interfaces.Routable

/**
 * Project: Kartographer
 *
 * Created by <NAME>, aka firezenk on 01/12/17.
 * Copyright © <NAME> 2017
 */
@KartographerDsl
class RouteDsl {

    class RouteBuilder {

        var target: Any? = null
        var params: Map<String, Any>? = mapOf<String, Any>()
        var path: Path? = null
        var anchor: Any? = null
        var animation: RouteAnimation? = null
        var forResult: Int = -1

        private val calculatedPath: Path by lazy {
            if (target is Routable) {
                val castedTarget = target as Routable
                if (castedTarget.path() != "") {
                    Path(castedTarget.path())
                } else ROOT_NODE
            } else ROOT_NODE
        }

        fun build(): ViewRoute = ViewRoute(target!!, params ?: mapOf(), path ?: calculatedPath, anchor!!,
                animation, forResult)
    }

    class RouteActivityBuilder<B> {

        var target: Any? = null
        var params: B? = null
        var path: Path? = null
        var forResult: Int = -1

        private val calculatedPath: Path by lazy {
            if (target is Routable) {
                val castedTarget = target as Routable
                if (castedTarget.path() != "") {
                    Path(castedTarget.path())
                } else ROOT_NODE
            } else ROOT_NODE
        }

        fun build(): ContextRoute<B> = ContextRoute<B>(target!!, params!!, path ?: calculatedPath, forResult)
    }
{'fraction_non_alphanumeric': 0.09982083439979524, 'fraction_numerical': 0.006142820578448937, 'mean_word_length': 2.3259574468085105, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '2406044', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1094, 'n_words': 285}