<commit_before>package com.github.codeql

import java.io.PrintWriter
import java.io.StringWriter

interface Label<T>

class IntLabel<T>(val name: Int): Label<T> {
    override fun toString(): String = "#$name"
}

class StringLabel<T>(val name: String): Label<T> {
    override fun toString(): String = "#$name"
}

class StarLabel<T>: Label<T> {
    override fun toString(): String = "*"
}

fun <T> fakeLabel(): Label<T> {
    if (false) {
        println("Fake label")
    } else {
        val sw = StringWriter()
        Exception().printStackTrace(PrintWriter(sw))
        println("Fake label from:\n$sw")
    }
    return IntLabel(0)
}<commit_msg>Kotlin: Comments and tweaks in Label<commit_after>package com.github.codeql

import java.io.PrintWriter
import java.io.StringWriter

/**
 * This represents a label (`#...`) in a TRAP file.
 */
interface Label<T>

/**
 * The label `#i`, e.g. `#123`. Most labels we generate are of this
 * form.
 */
class IntLabel<T>(val i: Int): Label<T> {
    override fun toString(): String = "#$i"
}

/**
 * The label `#name`, e.g. `#compilation`. This is used when labels are
 * shared between different components (e.g. when both the interceptor
 * and the extractor need to refer to the same label).
 */
class StringLabel<T>(val name: String): Label<T> {
    override fun toString(): String = "#$name"
}

/**
 * This is not really a label, but just a `*`. Used in the rare cases
 * when we only need to refer to something once, to save adding
 * unnecessary labels.
 */
class StarLabel<T>: Label<T> {
    override fun toString(): String = "*"
}

// TODO: Remove this and all of its uses
fun <T> fakeLabel(): Label<T> {
    if (false) {
        println("Fake label")
    } else {
        val sw = StringWriter()
        Exception().printStackTrace(PrintWriter(sw))
        println("Fake label from:\n$sw")
    }
    return IntLabel(0)
}
{'fraction_non_alphanumeric': 0.1456776947705443, 'fraction_numerical': 0.0026680896478121665, 'mean_word_length': 3.280821917808219, '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': '3392301', 'n_tokens_mistral': 590, 'n_tokens_neox': 587, 'n_words': 198}