Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.Note Class Reference

Classes

enum  Tone
 

Public Member Functions

 Note (int note)
 
 Note (int octave, Tone tone, boolean sharped)
 
Note sharped ()
 
Note flattened ()
 
byte getId ()
 
int getOctave ()
 
Tone getTone ()
 
boolean isSharped ()
 
int hashCode ()
 
boolean equals (Object obj)
 
String toString ()
 

Static Public Member Functions

static Note flat (int octave, Tone tone)
 
static Note sharp (int octave, Tone tone)
 
static Note natural (int octave, Tone tone)
 

Detailed Description

A note class to store a specific note.

Definition at line 12 of file Note.java.

Constructor & Destructor Documentation

org.bukkit.Note.Note ( int  note)

Creates a new note.

Parameters
noteInternal note id. getId() always return this value. The value has to be in the interval [0; 24].

Definition at line 128 of file Note.java.

Referenced by org.bukkit.Note.flat(), org.bukkit.Note.flattened(), org.bukkit.Note.natural(), org.bukkit.Note.sharp(), and org.bukkit.Note.sharped().

128  {
129  Validate.isTrue(note >= 0 && note <= 24, "The note value has to be between 0 and 24.");
130 
131  this.note = (byte) note;
132  }
org.bukkit.Note.Note ( int  octave,
Tone  tone,
boolean  sharped 
)

Creates a new note.

Parameters
octaveThe octave where the note is in. Has to be 0 - 2.
toneThe tone within the octave. If the octave is 2 the note has to be F#.
sharpedSet if the tone is sharped (e.g. for F#).

Definition at line 142 of file Note.java.

References org.bukkit.Note.Tone.getId(), org.bukkit.Note.Tone.isSharpable(), and org.bukkit.Note.Tone.TONES_COUNT.

142  {
143  if (sharped && !tone.isSharpable()) {
144  tone = Tone.values()[tone.ordinal() + 1];
145  sharped = false;
146  }
147  if (octave < 0 || octave > 2 || (octave == 2 && !(tone == Tone.F && sharped))) {
148  throw new IllegalArgumentException("Tone and octave have to be between F#0 and F#2");
149  }
150 
151  this.note = (byte) (octave * Tone.TONES_COUNT + tone.getId(sharped));
152  }
Note sharped()
Definition: Note.java:194

Member Function Documentation

static Note org.bukkit.Note.flat ( int  octave,
Tone  tone 
)
static

Creates a new note for a flat tone, such as A-flat.

Parameters
octaveThe octave where the note is in. Has to be 0 - 1.
toneThe tone within the octave.
Returns
The new note.

Definition at line 161 of file Note.java.

References org.bukkit.Note.Tone.isSharpable(), and org.bukkit.Note.Note().

161  {
162  Validate.isTrue(octave != 2, "Octave cannot be 2 for flats");
163  tone = tone == Tone.G ? Tone.F : Tone.values()[tone.ordinal() - 1];
164  return new Note(octave, tone, tone.isSharpable());
165  }
Note(int note)
Definition: Note.java:128
Note org.bukkit.Note.flattened ( )
Returns
The note a semitone below this one.

Definition at line 202 of file Note.java.

References org.bukkit.Note.Note().

202  {
203  Validate.isTrue(note > 0, "This note cannot be flattened because it is the lowest known note!");
204  return new Note(note - 1);
205  }
Note(int note)
Definition: Note.java:128
byte org.bukkit.Note.getId ( )

Returns the internal id of this note.

Returns
the internal id of this note.
Deprecated:
Magic value

Definition at line 214 of file Note.java.

Referenced by org.bukkit.Note.Tone.getId(), and org.bukkit.Note.Tone.isSharped().

214  {
215  return note;
216  }
int org.bukkit.Note.getOctave ( )

Returns the octave of this note.

Returns
the octave of this note.

Definition at line 223 of file Note.java.

References org.bukkit.Note.Tone.TONES_COUNT.

223  {
224  return note / Tone.TONES_COUNT;
225  }
Tone org.bukkit.Note.getTone ( )

Returns the tone of this note.

Returns
the tone of this note.

Definition at line 236 of file Note.java.

References org.bukkit.Note.Tone.getById().

236  {
237  return Tone.getById(getToneByte());
238  }
boolean org.bukkit.Note.isSharped ( )

Returns if this note is sharped.

Returns
if this note is sharped.

Definition at line 245 of file Note.java.

References org.bukkit.Note.Tone.getById(), and org.bukkit.Note.Tone.isSharped().

245  {
246  byte note = getToneByte();
247  return Tone.getById(note).isSharped(note);
248  }
static Note org.bukkit.Note.natural ( int  octave,
Tone  tone 
)
static

Creates a new note for a natural tone, such as A-natural.

Parameters
octaveThe octave where the note is in. Has to be 0 - 1.
toneThe tone within the octave.
Returns
The new note.

Definition at line 186 of file Note.java.

References org.bukkit.Note.Note().

186  {
187  Validate.isTrue(octave != 2, "Octave cannot be 2 for naturals");
188  return new Note(octave, tone, false);
189  }
Note(int note)
Definition: Note.java:128
static Note org.bukkit.Note.sharp ( int  octave,
Tone  tone 
)
static

Creates a new note for a sharp tone, such as A-sharp.

Parameters
octaveThe octave where the note is in. Has to be 0 - 2.
toneThe tone within the octave. If the octave is 2 the note has to be F#.
Returns
The new note.

Definition at line 175 of file Note.java.

References org.bukkit.Note.Note().

175  {
176  return new Note(octave, tone, true);
177  }
Note(int note)
Definition: Note.java:128
Note org.bukkit.Note.sharped ( )
Returns
The note a semitone above this one.

Definition at line 194 of file Note.java.

References org.bukkit.Note.Note().

194  {
195  Validate.isTrue(note < 24, "This note cannot be sharped because it is the highest known note!");
196  return new Note(note + 1);
197  }
Note(int note)
Definition: Note.java:128

The documentation for this class was generated from the following file: