Opus+ Version 1.0 Java API

opusplus.core.constants
Enum DrumKitId

java.lang.Object
  extended by java.lang.Enum<DrumKitId>
      extended by opusplus.core.constants.DrumKitId
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DrumKitId>

public enum DrumKitId
extends java.lang.Enum<DrumKitId>

    

This enum uniquely identifies commonly used drum kits.

Author:
Adrian Marriott

Enum Constant Summary
CYMBALS_DRUMKIT
           
FULL_DRUMKIT
           
METRONOME_CLICK_DRUMKIT
           
METRONOME_HIHAT_DRUMKIT
           
SNARE_BASS_HI_HAT_DRUMKIT
           
 
Method Summary
static boolean contains(DrumKitId[] arr, DrumKitId id)
          Returns true if the passed drum group array contains the drum group, otherwise false.
 int getValue()
          Returns the value associated of this enum
static DrumKitId ordinalToEnum(int ordinal)
          Factory method that allows for the simple creation of enums from integers based on their declared position.
 DrumKitId perturb(IntegerStream is, int distancePercentage, int probabilityPercentage)
          Returns a 'randomly perturbed' enum based on the current value of 'this'.
static int pos(DrumKitId[] arr, DrumKitId id)
          Returns the (zero based) index of the first occurrence of the passed DrumKitId within the passed array, or -1 if not found.
static DrumKitId selectRandom(IntegerStream is)
          Returns one of these enums selected at random with equal probability as determined by the passed integer stream.
static DrumKitId selectRandom(IntegerStream is, int[] weights)
          Returns one of these enums selected at random and biased according to the passed weights.
 DrumKitId selectRandomNeighbour(IntegerStream is)
          Returns a neighbouring enum at random based on the current value of 'this'.
static int size()
          Returns the number of enum values of this type
static DrumKitId valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static DrumKitId[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
static DrumKitId valueToEnum(int value)
          Factory method that allows for the simple creation of enums from integers based on their actual value.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SNARE_BASS_HI_HAT_DRUMKIT

public static final DrumKitId SNARE_BASS_HI_HAT_DRUMKIT

CYMBALS_DRUMKIT

public static final DrumKitId CYMBALS_DRUMKIT

FULL_DRUMKIT

public static final DrumKitId FULL_DRUMKIT

METRONOME_CLICK_DRUMKIT

public static final DrumKitId METRONOME_CLICK_DRUMKIT

METRONOME_HIHAT_DRUMKIT

public static final DrumKitId METRONOME_HIHAT_DRUMKIT
Method Detail

values

public static DrumKitId[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DrumKitId c : DrumKitId.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DrumKitId valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getValue

public final int getValue()
Returns the value associated of this enum


valueToEnum

public static DrumKitId valueToEnum(int value)
Factory method that allows for the simple creation of enums from integers based on their actual value. If the passed argument is out of range null is returned.


ordinalToEnum

public static DrumKitId ordinalToEnum(int ordinal)
Factory method that allows for the simple creation of enums from integers based on their declared position. If the passed argument is out of range null is returned.


size

public static int size()
Returns the number of enum values of this type


contains

public static boolean contains(DrumKitId[] arr,
                               DrumKitId id)
Returns true if the passed drum group array contains the drum group, otherwise false.


pos

public static int pos(DrumKitId[] arr,
                      DrumKitId id)
Returns the (zero based) index of the first occurrence of the passed DrumKitId within the passed array, or -1 if not found.


selectRandom

public static final DrumKitId selectRandom(IntegerStream is)
Returns one of these enums selected at random with equal probability as determined by the passed integer stream.


selectRandom

public static final DrumKitId selectRandom(IntegerStream is,
                                           int[] weights)
Returns one of these enums selected at random and biased according to the passed weights. The weights array must contains one element for each possible enum value.


selectRandomNeighbour

public final DrumKitId selectRandomNeighbour(IntegerStream is)
Returns a neighbouring enum at random based on the current value of 'this'.


perturb

public final DrumKitId perturb(IntegerStream is,
                               int distancePercentage,
                               int probabilityPercentage)
Returns a 'randomly perturbed' enum based on the current value of 'this'. The algorithm first of all uses the probability percentage to decide if any perturbation should occur; if not then the method is effectively a NOP and the enum returned is unchanged. If the enum is to be changed it uses the existing ordinal value, along with the number of potential possible values for this enum type in the mathematical function to calculate which enum is returned. Thus the perturbation is up to a certain distance away, and with a certain probability. Note, the distance between two enum values depends on their ordinal value (i.e. their declaration order) rather than their actual value.


Opus+ Version 1.0 Java API

Copyright © 2005-2010 Adrian Marriott.
All Rights Reserved.