<commit_before>package com.openxc.messages;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import android.os.Parcel;

import static com.google.common.base.Objects.toStringHelper;

import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;

public class Command extends KeyedMessage {
    public static final String COMMAND_KEY = "command";
    public static final String DIAGNOSTIC_REQUEST_KEY = "request";
    public static final String ACTION_KEY = "action";

    public enum CommandType {
        VERSION, DEVICE_ID, DIAGNOSTIC_REQUEST
    };

    public static final String[] sRequiredFieldsValues = new String[] {
            COMMAND_KEY };
    public static final Set<String> sRequiredFields = new HashSet<String>(
            Arrays.asList(sRequiredFieldsValues));

    @SerializedName(COMMAND_KEY)
    private CommandType mCommand;

    @SerializedName(ACTION_KEY)
    private String mAction;

    @SerializedName(DIAGNOSTIC_REQUEST_KEY)
    private DiagnosticRequest mDiagnosticRequest;

    public Command(CommandType command, String action) {
        mCommand = command;
        mAction = action;
    }

    public Command(CommandType command) {
        this(command, null);
    }

    // TODO this seems really odd, that we're combined these two things. it made
    // more sense when I implemented it in Python. I can't remember...why we are
    // wrapping the DiagRequest in a command? I think it was to make parsing
    // easier on the other end, so you didn't have to try and infer what the
    // incoming datatype was. should we require all input data to be wrapped in
    // a command? that would make more sense but would increase a litle overhead
    // for JSON writes. Let's get this working for now and then change the
    // message format so that we don't use implicit types in JSON anymore - if
    // you need maximum performance, use the binary encoding.
    public Command(DiagnosticRequest request, String action) {
        this(CommandType.DIAGNOSTIC_REQUEST, action);
        mDiagnosticRequest = request;<commit_msg>Move a TODO to an existing GH issue:<commit_after>package com.openxc.messages;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import android.os.Parcel;

import static com.google.common.base.Objects.toStringHelper;

import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;

public class Command extends KeyedMessage {
    public static final String COMMAND_KEY = "command";
    public static final String DIAGNOSTIC_REQUEST_KEY = "request";
    public static final String ACTION_KEY = "action";

    public enum CommandType {
        VERSION, DEVICE_ID, DIAGNOSTIC_REQUEST
    };

    public static final String[] sRequiredFieldsValues = new String[] {
            COMMAND_KEY };
    public static final Set<String> sRequiredFields = new HashSet<String>(
            Arrays.asList(sRequiredFieldsValues));

    @SerializedName(COMMAND_KEY)
    private CommandType mCommand;

    @SerializedName(ACTION_KEY)
    private String mAction;

    @SerializedName(DIAGNOSTIC_REQUEST_KEY)
    private DiagnosticRequest mDiagnosticRequest;

    public Command(CommandType command, String action) {
        mCommand = command;
        mAction = action;
    }

    public Command(CommandType command) {
        this(command, null);
    }

    public Command(DiagnosticRequest request, String action) {
        this(CommandType.DIAGNOSTIC_REQUEST, action);
        mDiagnosticRequest = request;
{'fraction_non_alphanumeric': 0.07380688124306327, 'fraction_numerical': 0.0, 'mean_word_length': 3.5345911949685536, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1449065', 'n_tokens_mistral': 998, 'n_tokens_neox': 968, 'n_words': 318}