<commit_before>package instep.dao.sql

@Suppress("UNCHECKED_CAST")
abstract class Column<T : Column<T>>(val name: String, val table: Table) {
    val qualifiedName = "${table.tableName}.${name}"

    var primary = false
    var nullable = true
    var unique = false
    var default = ""
    var comment = ""

    fun primary(): T {
        primary = true
        return this as T
    }

    fun notnull(): T {
        this.nullable = false
        return this as T
    }

    fun unique(): T {
        this.unique = true
        return this as T
    }

    fun defaultValue(exp: String): T {
        default = exp
        return this as T
    }

    fun comment(txt: String): T {
        comment = txt
        return this as T
    }
}

abstract class NumberColumn<T : Column<T>>(name: String, table: Table) : Column<T>(name, table)

open class IntegerColumn(name: String, table: Table, val type: IntegerColumnType) : NumberColumn<IntegerColumn>(name, table) {
    var autoIncrement = false

    fun autoIncrement(): IntegerColumn {
        autoIncrement = true
        return this
    }
}

open class BooleanColumn(name: String, table: Table) : Column<BooleanColumn>(name, table)
open class StringColumn(name: String, table: Table, val type: StringColumnType, val length: Int = 256) : Column<StringColumn>(name, table)
open class FloatingColumn(name: String, table: Table, val type: FloatingColumnType, val precision: Int = 0, val scale: Int = 0) :
    NumberColumn<FloatingColumn>(name, table)
<commit_msg>open default methods of abstract Column class.<commit_after>package instep.dao.sql

@Suppress("UNCHECKED_CAST")
abstract class Column<T : Column<T>>(val name: String, val table: Table) {
    val qualifiedName = "${table.tableName}.${name}"

    var primary = false
    var nullable = true
    var unique = false
    var default = ""
    var comment = ""

    open fun primary(): T {
        primary = true
        return this as T
    }

    open fun notnull(): T {
        this.nullable = false
        return this as T
    }

    open fun unique(): T {
        this.unique = true
        return this as T
    }

    open fun defaultValue(exp: String): T {
        default = exp
        return this as T
    }

    open fun comment(txt: String): T {
        comment = txt
        return this as T
    }
}

abstract class NumberColumn<T : Column<T>>(name: String, table: Table) : Column<T>(name, table)

open class IntegerColumn(name: String, table: Table, val type: IntegerColumnType) : NumberColumn<IntegerColumn>(name, table) {
    var autoIncrement = false

    open fun autoIncrement(): IntegerColumn {
        autoIncrement = true
        return this
    }
}

open class BooleanColumn(name: String, table: Table) : Column<BooleanColumn>(name, table)
open class StringColumn(name: String, table: Table, val type: StringColumnType, val length: Int = 256) : Column<StringColumn>(name, table)
open class FloatingColumn(name: String, table: Table, val type: FloatingColumnType, val precision: Int = 0, val scale: Int = 0) :
    NumberColumn<FloatingColumn>(name, table)

{'fraction_non_alphanumeric': 0.10425462812601494, 'fraction_numerical': 0.003247807729782397, 'mean_word_length': 2.9690721649484537, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '4253986', 'n_tokens_mistral': 899, 'n_tokens_neox': 880, 'n_words': 306}