All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.wizard.comm.SoundPortStatus Maven / Gradle / Ivy

There is a newer version: 2.0.0-M1
Show newest version
package org.bidib.wizard.comm;

import org.bidib.jbidibc.core.enumeration.SoundPortEnum;
import org.bidib.wizard.locale.Resources;

public enum SoundPortStatus implements BidibStatus {
    // @formatter:off
    PLAY(SoundPortEnum.PLAY, "play"), PAUSE(SoundPortEnum.PAUSE, "pause"), STOP(SoundPortEnum.STOP, "stop"), ;
    // @formatter:on

    private final SoundPortEnum type;

    private final String key;

    private final String label;

    SoundPortStatus(SoundPortEnum type, String key) {
        this.type = type;
        this.key = key;
        this.label = Resources.getString(SoundPortStatus.class, key);
    }

    public SoundPortEnum getType() {
        return type;
    }

    public String getKey() {
        return key;
    }

    public String toString() {
        return label;
    }

    public static SoundPortStatus valueOf(SoundPortEnum type) {
        SoundPortStatus result = null;

        for (SoundPortStatus e : values()) {
            if (e.type == type) {
                result = e;
                break;
            }
        }
        if (result == null) {
            throw new IllegalArgumentException("cannot map " + type + " to a sound port status");
        }
        return result;
    }

    @Override
    public BidibStatus[] getValues() {
        return new BidibStatus[] { PLAY, PAUSE, STOP };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy