Enum Note
- java.lang.Object
-
- java.lang.Enum<Note>
-
- edu.cnm.deepdive.scalescroller.model.entity.Note
-
- All Implemented Interfaces:
Serializable
,Comparable<Note>
public enum Note extends Enum<Note>
Enumerates the different notes available for use in ScaleScroller. Each enumerated type includes a boolean which indicates whether the note can be a tonic or not, and a integer that indicates how many half-steps the note is from C, mod 12.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Map<Integer,Note[]>
getNoteMap()
Returns a map of Integers to notes.int
getNumber()
Returns the note's number of half-steps away from C, mod 12.boolean
isTonic()
Returns true if the note is a possible tonic.static Note[]
tonics()
Returns all of the possible tonic notes.String
toString()
Overrides the toString method for a more user-readable note representation.static Note
valueOf(String name)
Returns the enum constant of this type with the specified name.static Note[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
C_FLAT
public static final Note C_FLAT
-
C
public static final Note C
-
C_SHARP
public static final Note C_SHARP
-
C_DOUBLE_SHARP
public static final Note C_DOUBLE_SHARP
-
D_FLAT
public static final Note D_FLAT
-
D
public static final Note D
-
D_SHARP
public static final Note D_SHARP
-
E_FLAT
public static final Note E_FLAT
-
E
public static final Note E
-
E_SHARP
public static final Note E_SHARP
-
F_FLAT
public static final Note F_FLAT
-
F
public static final Note F
-
F_SHARP
public static final Note F_SHARP
-
F_DOUBLE_SHARP
public static final Note F_DOUBLE_SHARP
-
G_FLAT
public static final Note G_FLAT
-
G
public static final Note G
-
G_SHARP
public static final Note G_SHARP
-
G_DOUBLE_SHARP
public static final Note G_DOUBLE_SHARP
-
A_FLAT
public static final Note A_FLAT
-
A
public static final Note A
-
A_SHARP
public static final Note A_SHARP
-
B_FLAT
public static final Note B_FLAT
-
B
public static final Note B
-
B_SHARP
public static final Note B_SHARP
-
-
Method Detail
-
values
public static Note[] 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 (Note c : Note.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Note valueOf(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
tonics
public static Note[] tonics()
Returns all of the possible tonic notes.- Returns:
- All possible tonics.
-
getNumber
public int getNumber()
Returns the note's number of half-steps away from C, mod 12.- Returns:
- The note's number of half-steps away from C.
-
isTonic
public boolean isTonic()
Returns true if the note is a possible tonic.- Returns:
- A boolean indicating whether the note could be a tonic.
-
getNoteMap
public static Map<Integer,Note[]> getNoteMap()
Returns a map of Integers to notes. Each Integer is associated with an array of notes that have that note number.- Returns:
- A map of Integers to notes.
-
-