<commit_before>package com.addonovan.ftcext.config

import android.util.JsonWriter
import com.addonovan.ftcext.*
import org.json.JSONObject
import java.util.*

/**
 * TODO OpModeConfig documentation
 *
 * @author addonovan
 * @since 6/16/16
 */
class OpModeConfig internal constructor() : Jsonable
{

    //
    // Values
    //

    /** The backing field for [OpModeName], this can be updated, but only inside the class. */
    private var _opModeName: String = "Uh-Oh!";

    /** The name of the OpMode for which this is a configuration. */
    val OpModeName: String
        get() = _opModeName;


    /** The backing field for [Variant], this can be updated, but only inside the class. */
    private var _variant: String = "[default]";

    /** The variant of configuration for the OpMode. */
    val Variant: String
        get() = _variant;

    /** The configuration map. Everything is a string and must be converted when read. */
    private val dataMap = HashMap< String, String >();

    //
    // Actions
    //

    /**
     * Clears the configuration so that old values are ignored.
     */
    fun clear() = dataMap.clear();

    //
    // Json Serialization
    //

    // Write to the json file
    // the JSONObject for an OpModeConfig will look like this:
    // "$opModeName": {
    //      "variant": "$variant",
    //      "dataMap": {
    //          "$key" = "$value"
    //      }
    // },
    override fun toJson( writer: JsonWriter )
    {
        writer.name( OpModeName ).beginObject(); // start OpModeConfig

        writer.name( "variant" ).value( Variant );

        // write the data map
        writer.name( "dataMap" ).beginObject();
        for ( ( key, value ) in dataMap )
        {
            writer.name( key ).value( value ); // log the key value pair
        }

        writer.endObject(); // end dataMap
        writer.endObject(); // end OpModeConfig
    }

    override fun fromJson( json: JSONObject )
    {
<commit_msg>Updated model json output<commit_after>package com.addonovan.ftcext.config

import android.util.JsonWriter
import com.addonovan.ftcext.*
import org.json.JSONObject
import java.util.*

/**
 * TODO OpModeConfig documentation
 *
 * @author addonovan
 * @since 6/16/16
 */
class OpModeConfig internal constructor() : Jsonable
{

    //
    // Values
    //

    /** The backing field for [OpModeName], this can be updated, but only inside the class. */
    private var _opModeName: String = "Uh-Oh!";

    /** The name of the OpMode for which this is a configuration. */
    val OpModeName: String
        get() = _opModeName;


    /** The backing field for [Variant], this can be updated, but only inside the class. */
    private var _variant: String = "[default]";

    /** The variant of configuration for the OpMode. */
    val Variant: String
        get() = _variant;

    /** The configuration map. Everything is a string and must be converted when read. */
    private val dataMap = HashMap< String, String >();

    //
    // Actions
    //

    /**
     * Clears the configuration so that old values are ignored.
     */
    fun clear() = dataMap.clear();

    //
    // Json Serialization
    //

    // Write to the json file
    // the JSONObject for an OpModeConfig will look like this:
    // {
    //      "opMode": "$OpModeName",
    //      "variant": "$variant",
    //      "dataMap": {
    //          "$key" = "$value"
    //      }
    // },
    override fun toJson( writer: JsonWriter )
    {
        writer.beginObject(); // start OpModeConfig

        writer.name( "opMode" ).value( OpModeName );
        writer.name( "variant" ).value( Variant );

        // write the data map
        writer.name( "dataMap" ).beginObject();
        for ( ( key, value ) in dataMap )
        {
            writer.name( key ).value( value ); // log the key value pair
        }

        writer.endObject(); // end dataMap
        writer.endObject(); // end OpModeConfig
    }

    override fun fromJson( json: JSONObject )
    {
        
{'fraction_non_alphanumeric': 0.12481315396113603, 'fraction_numerical': 0.002491280518186348, 'mean_word_length': 2.0485952923310555, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, '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': '1463030', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1131, 'n_words': 384}