/** * Returns the not sharped id of this tone. * * @return the not sharped id of this tone. * @deprecated Magic value */ @Deprecated public byte getId() { return getId(false); }
/** * Returns if this tone id is the sharped id of the tone. * * @param id the id of the tone. * @return if the tone id is the sharped id of the tone. * @throws IllegalArgumentException if neither the tone nor the * semitone have the id. * @deprecated Magic value */ @Deprecated public boolean isSharped(byte id) { if (id == getId(false)) { return false; } else if (id == getId(true)) { return true; } else { // The id isn't matching to the tone! throw new IllegalArgumentException("The id isn't matching to the tone."); } }
/** * Creates a new note. * * @param octave The octave where the note is in. Has to be 0 - 2. * @param tone The tone within the octave. If the octave is 2 the note has * to be F#. * @param sharped Set if the tone is sharped (e.g. for F#). */ public Note(int octave, Tone tone, boolean sharped) { if (sharped && !tone.isSharpable()) { tone = Tone.values()[tone.ordinal() + 1]; sharped = false; } if (octave < 0 || octave > 2 || (octave == 2 && !(tone == Tone.F && sharped))) { throw new IllegalArgumentException("Tone and octave have to be between F#0 and F#2"); } this.note = (byte) (octave * Tone.TONES_COUNT + tone.getId(sharped)); }
/** * Creates a new note. * * @param octave The octave where the note is in. Has to be 0 - 2. * @param tone The tone within the octave. If the octave is 2 the note has * to be F#. * @param sharped Set if the tone is sharped (e.g. for F#). */ public Note(int octave, Tone tone, boolean sharped) { if (sharped && !tone.isSharpable()) { tone = Tone.values()[tone.ordinal() + 1]; sharped = false; } if (octave < 0 || octave > 2 || (octave == 2 && !(tone == Tone.F && sharped))) { throw new IllegalArgumentException("Tone and octave have to be between F#0 and F#2"); } this.note = (byte) (octave * Tone.TONES_COUNT + tone.getId(sharped)); }
/** * Returns if this tone id is the sharped id of the tone. * * @param id the id of the tone. * @return if the tone id is the sharped id of the tone. * @throws IllegalArgumentException if neither the tone nor the * semitone have the id. * @deprecated Magic value */ @Deprecated public boolean isSharped(byte id) { if (id == getId(false)) { return false; } else if (id == getId(true)) { return true; } else { // The id isn't matching to the tone! throw new IllegalArgumentException("The id isn't matching to the tone."); } }
/** * Returns the not sharped id of this tone. * * @return the not sharped id of this tone. * @deprecated Magic value */ @Deprecated public byte getId() { return getId(false); }