<commit_before>package com.openxc.measurements;

import com.openxc.units.State;

public class TransmissionGearPosition
        extends Measurement<State<TransmissionGearPosition.GearPosition>>
        implements VehicleMeasurement {
    public final static String ID = "transmission_gear_position";

    public enum GearPosition {
        // TODO this could also be done using the ordinal values of the enum,
        // but that is less explicit and requires that these be in the same
        // order as defined in the specification. it would allow us to delete
        // all of this code though...
        FIRST,
        SECOND,
        THIRD,
        FOURTH,
        FIFTH,
        SIXTH,
        SEVENTH,
        EIGHTH,
        NEUTRAL,
        REVERSE;

        // TODO can we contain all of this in a HashedEnum parent class?
        private final int mHashCode;

        private GearPosition() {
            mHashCode = toString().hashCode();
        }

        public int getHashCode() {
            return mHashCode;
        }

        public static GearPosition fromHashCode(int hashCode) {
            for(GearPosition position : GearPosition.values()) {
                if(hashCode == position.getHashCode()) {
                    return position;
                }
            }
            throw new IllegalArgumentException(
                    "No valid gear position for hash code " + hashCode);
        }
    }

    public TransmissionGearPosition() {}

    public TransmissionGearPosition(State<GearPosition> value) {
        super(value);
    }

    public TransmissionGearPosition(GearPosition value) {<commit_msg>Dash hopes of an abstract enum.<commit_after>package com.openxc.measurements;

import com.openxc.units.State;

public class TransmissionGearPosition
        extends Measurement<State<TransmissionGearPosition.GearPosition>>
        implements VehicleMeasurement {
    public final static String ID = "transmission_gear_position";

    public enum GearPosition {
        FIRST,
        SECOND,
        THIRD,
        FOURTH,
        FIFTH,
        SIXTH,
        SEVENTH,
        EIGHTH,
        NEUTRAL,
        REVERSE;

        private final int mHashCode;

        private GearPosition() {
            mHashCode = toString().hashCode();
        }

        public int getHashCode() {
            return mHashCode;
        }

        public static GearPosition fromHashCode(int hashCode) {
            for(GearPosition position : GearPosition.values()) {
                if(hashCode == position.getHashCode()) {
                    return position;
                }
            }
            throw new IllegalArgumentException(
                    "No valid gear position for hash code " + hashCode);
        }
    }

    public TransmissionGearPosition() {}

    public TransmissionGearPosition(State<GearPosition> value) {
        super(value);
    }

    public TransmissionGearPosition(GearPosition value) {
{'fraction_non_alphanumeric': 0.0688368938623262, 'fraction_numerical': 0.0, 'mean_word_length': 1.9707955689828802, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3318221', 'n_tokens_mistral': 785, 'n_tokens_neox': 732, 'n_words': 210}