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

se.michaelthelin.spotify.enums.Modality Maven / Gradle / Ivy

There is a newer version: 9.0.0-RC1
Show newest version
package se.michaelthelin.spotify.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * An enumeration with the two modality types.
 *
 * @see Wikipedia: Mode (Music)
 */
public enum Modality {

  MAJOR(1),
  MINOR(0);

  private static final Map map = new HashMap<>();

  static {
    for (Modality modality : Modality.values()) {
      map.put(modality.mode, modality);
    }
  }

  public final int mode;

  Modality(final int mode) {
    this.mode = mode;
  }

  public static Modality keyOf(int mode) {
    return map.get(mode);
  }

  /**
   * Get the {@link Modality} type as a string.
   *
   * @return {@link Modality} type as a string.
   */
  public int getType() {
    return this.mode;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy