package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.KeylessEntryCode;
import com.openxc.units.State;

public class KeylessEntryProgrammingCommand extends BaseMeasurement<
        State<KeylessEntryProgrammingCommand.Command>> {
    public final static String ID = "keyless_entry_command";

    public enum Command {
        ADD,
        ERASE,
        AUTHENTICATE
    }

    public KeylessEntryProgrammingCommand(State<Command> command,
            KeylessEntryCode code) {
        super(command, code);
    }

    public KeylessEntryProgrammingCommand(Command command,
            String code) {
        super(new State<Command>(command), new KeylessEntryCode(code));
    }

    public KeylessEntryProgrammingCommand(Command command) {
        super(new State<Command>(command));
    }

    public KeylessEntryProgrammingCommand(String command, String code) {
        this(Command.valueOf(command.toUpperCase(Locale.US)), code);
    }

    public KeylessEntryProgrammingCommand(String command) {
        this(Command.valueOf(command.toUpperCase(Locale.US)));
    }

    @Override
    public String getSerializedValue() {
        return getValue().enumValue().toString().toLowerCase();
    }

    @Override
    public KeylessEntryCode getEvent() {
        return (KeylessEntryCode) super.getEvent();
    }

    @Override
    public String getSerializedEvent() {
        return getEvent() != null ? getEvent().getSerializedValue() : null;
    }

    @Override
    public KeylessEntryCode getEvent() {
        return (KeylessEntryCode) super.getEvent();
    }

    @Override
    public String getSerializedEvent() {
        return getEvent() == null ? null : getEvent().getSerializedValue();
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

@@ -1475,260 +1475,8 @@
  %7D%0A%0A
-    @Override%0A    public KeylessEntryCode getEvent() %7B%0A        return (KeylessEntryCode) super.getEvent();%0A    %7D%0A%0A    @Override%0A    public String getSerializedEvent() %7B%0A        return getEvent() == null ? null : getEvent().getSerializedValue();%0A    %7D%0A%0A
     

Remove duplicate methods (bad merge).