package com.openxc.measurements;

import com.openxc.units.State;

public class TurnSignalStatus extends
        BaseMeasurement<State<TurnSignalStatus.TurnSignalPosition>> {
    public final static String ID = "turn_signal_status";

    public enum TurnSignalPosition {
        OFF,
        LEFT,
        RIGHT;

        private final int mHashCode;

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

        public int getHashCode() {
            return mHashCode;
        }

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

    public TurnSignalStatus(State<TurnSignalPosition> value) {
        super(value);
    }

    public TurnSignalStatus(TurnSignalPosition value) {
        this(new State<TurnSignalPosition>(value));
    }

    public TurnSignalStatus(Double value) {
        this(TurnSignalPosition.fromHashCode(value.intValue()));
    }
}

@@ -307,632 +307,8 @@
 IGHT
-;%0A%0A        private final int mHashCode;%0A%0A        private TurnSignalPosition() %7B%0A            mHashCode = toString().hashCode();%0A        %7D%0A%0A        public int getHashCode() %7B%0A            return mHashCode;%0A        %7D%0A%0A        public static TurnSignalPosition fromHashCode(int hashCode) %7B%0A            for(TurnSignalPosition position : TurnSignalPosition.values()) %7B%0A                if(hashCode == position.getHashCode()) %7B%0A                    return position;%0A                %7D%0A            %7D%0A            throw new IllegalArgumentException(%0A                    %22No valid turn signal position for hash code %22 + hashCode);%0A        %7D
 %0A   
@@ -550,14 +550,14 @@
 tus(
-Double
+String
  val
@@ -598,37 +598,21 @@
 ion.
-fromHashCode(value.intV
+valueOf(v
 alue
-()
 ));%0A

Remove old-style state hashing functionality for TurnSignalStatus.