net.charlesames.music.musicxml
Class NoteInMeasure

java.lang.Object
  extended by net.charlesames.utility.common.Disposable
      extended by net.charlesames.music.musicxml.MusicXmlEntity
          extended by net.charlesames.music.musicxml.TimedEvent
              extended by net.charlesames.music.musicxml.NoteInMeasure

public class NoteInMeasure
extends TimedEvent

The NoteInMeasure class implements the MusicXML <note> element.

Author:
Charles Ames

Method Summary
 void addNotation(Notation notation)
          Add a Notation instance.
 void addOtherNotation(java.lang.String content)
          Add a new OtherNotation instance.
 void addSlurStart()
          Add a new type "start" Slur instance.
 void addSlurStop()
          Add a new type "stop" Slur instance.
 Tuplet addTuplet(int number, StartStop tupletType)
          Create and add a Tuplet instance with the indicated parameters.
 void dispose()
          Release resources engaged by this object, thus rendering it amenable to garbage collection.
 boolean equals(MusicXmlEntity other)
          Test if this MusicXML entity has the same content as another object.
static NoteInMeasure fromXmlNode(org.w3c.dom.Element element, MeasureInPart container)
          Create a new NoteInMeasure instance and fill it with loaded data.
 Beam getBeam()
          Getter for Beam property.
 MeasureInPart getContainer()
          Get the parent object.
 int getDots()
          Getter for Dots property.
static NoteInMeasure getInstance(MeasureInPart container)
          Create a new NoteInMeasure instance.
 java.lang.String getInstrumentID()
          Getter for InstrumentID property.
 java.lang.String getNeume()
          Getter for Neume property.
 java.util.List<Notation> getNotations()
          Get all notations.
 NoteheadShape getNotehead()
          Getter for Notehead property.
 int getStaff()
          Getter for Staff property.
 Stem getStem()
          Getter for Stem property.
 net.charlesames.music.musicxml.StepAndOctave getStepAndOctave()
          Getter for the StepAndOctave property.
 long getTupletActual()
          Getter for TupletRatio property.
 long getTupletNormal()
          Getter for TupletNormal property.
 int getVoice()
          Getter for the Voice property.
 boolean isTieStart()
          Getter for the TieStart property.
 boolean isTieStop()
          Getter for the TieStop property.
 void putXmlData(org.w3c.dom.Element element)
           
 void setBeam(Beam value)
          Setter for Beam property.
 void setDots(int dots)
          Setter for Dots property.
 void setDuration(int duration)
           
 void setInChord(boolean inChord)
           
 void setInstrumentID(java.lang.String instrumentID)
          Setter for InstrumentID property.
 void setNeume(java.lang.String neume)
          Setter for Neume property.
 void setNotehead(NoteheadShape value)
          Setter for Notehead property.
 void setPitch(java.lang.String step, int octave, double alter)
          Set the StepAndOctave property to a new Pitch instance with the indicated parameters.
 void setStaff(int staff)
          Setter for Staff property.
 void setStem(Stem value)
          Setter for Stem property.
 void setTieStart(boolean tieStart)
          Setter for the TieStart property.
 void setTieStop(boolean tieStop)
          Setter for the TieStop property.
 void setTupletRatio(Ratio tupletRatio)
          Setter for TupletRatio property.
 void setUnpitched(java.lang.String step, int octave)
          Set the StepAndOctave property to a new Unpitched instance with the indicated parameters.
 void setVoice(int voice)
          Setter for the Voice property.
 org.w3c.dom.Node toXmlNode(org.w3c.dom.Node parent)
          Serialize the content of a MusicXML entity into an XML element.
 
Methods inherited from class net.charlesames.music.musicxml.TimedEvent
getComment, getDefaultX, getDuration, getTime, isInChord, setComment, setDefaultX, setTime
 
Methods inherited from class net.charlesames.music.musicxml.MusicXmlEntity
makeDirty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dispose

public void dispose()
Description copied from class: Disposable
Release resources engaged by this object, thus rendering it amenable to garbage collection.

Overrides:
dispose in class TimedEvent

getInstance

public static NoteInMeasure getInstance(MeasureInPart container)
Create a new NoteInMeasure instance.

Parameters:
container - The MeasureInPart which will contain the new NoteInMeasure instance.
Returns:
The newly created NoteInMeasure instance.

getContainer

public MeasureInPart getContainer()
Description copied from class: MusicXmlEntity
Get the parent object.

Overrides:
getContainer in class MusicXmlEntity
Returns:
The parent object.

setInChord

public void setInChord(boolean inChord)

getStepAndOctave

public net.charlesames.music.musicxml.StepAndOctave getStepAndOctave()
Getter for the StepAndOctave property.

Returns:
The current StepAndOctave value.

setPitch

public void setPitch(java.lang.String step,
                     int octave,
                     double alter)
Set the StepAndOctave property to a new Pitch instance with the indicated parameters.

Parameters:
step - The indicated step.
octave - The indicated octave.
alter - The indicated alter.
Throws:
java.lang.IllegalArgumentException - when the note already has a pitch.

setUnpitched

public void setUnpitched(java.lang.String step,
                         int octave)
Set the StepAndOctave property to a new Unpitched instance with the indicated parameters.

Parameters:
step - The indicated step.
octave - The indicated octave.
Throws:
java.lang.IllegalArgumentException - when the note already has a pitch.

isTieStop

public boolean isTieStop()
Getter for the TieStop property.

Returns:
The current TieStop value.

setTieStop

public void setTieStop(boolean tieStop)
Setter for the TieStop property.

Parameters:
tieStop - The intended TieStop value.

isTieStart

public boolean isTieStart()
Getter for the TieStart property.

Returns:
The current TieStart value.

setTieStart

public void setTieStart(boolean tieStart)
Setter for the TieStart property.

Parameters:
tieStart - The intended TieStart value.

addSlurStop

public void addSlurStop()
Add a new type "stop" Slur instance.


addSlurStart

public void addSlurStart()
Add a new type "start" Slur instance.


addOtherNotation

public void addOtherNotation(java.lang.String content)
Add a new OtherNotation instance.

Parameters:
content - The notation text content.

setDuration

public void setDuration(int duration)

getVoice

public int getVoice()
Getter for the Voice property.

Returns:
The current Voice value.

setVoice

public void setVoice(int voice)
Setter for the Voice property.

Parameters:
voice - The intended Voice value.

getStaff

public int getStaff()
Getter for Staff property.

Returns:
The current Staff value.

setStaff

public void setStaff(int staff)
Setter for Staff property.

Parameters:
staff - The intended Staff value.

getNeume

public java.lang.String getNeume()
Getter for Neume property.

Returns:
The current Neume value.

setNeume

public void setNeume(java.lang.String neume)
Setter for Neume property.

Parameters:
neume - The intended Neume value.

getInstrumentID

public java.lang.String getInstrumentID()
Getter for InstrumentID property.

Returns:
The current InstrumentID value.

setInstrumentID

public void setInstrumentID(java.lang.String instrumentID)
Setter for InstrumentID property.

Parameters:
instrumentID - The intended InstrumentID value.

getDots

public int getDots()
Getter for Dots property.

Returns:
The current Dots value.

setDots

public void setDots(int dots)
Setter for Dots property.

Parameters:
dots - The intended Dots value.

getTupletActual

public long getTupletActual()
Getter for TupletRatio property.

Returns:
The current TupletRatio value.

getTupletNormal

public long getTupletNormal()
Getter for TupletNormal property.

Returns:
The current TupletNormal value.

setTupletRatio

public void setTupletRatio(Ratio tupletRatio)
Setter for TupletRatio property.

Parameters:
tupletRatio - The intended tuplet ratio.

getStem

public Stem getStem()
Getter for Stem property.

Returns:
The current Stem value.

setStem

public void setStem(Stem value)
Setter for Stem property.

Parameters:
value - The intended Stem value.

getBeam

public Beam getBeam()
Getter for Beam property.

Returns:
The current Beam value.

setBeam

public void setBeam(Beam value)
Setter for Beam property.

Parameters:
value - The intended Beam value.

getNotehead

public NoteheadShape getNotehead()
Getter for Notehead property.

Returns:
The current Notehead value.

setNotehead

public void setNotehead(NoteheadShape value)
Setter for Notehead property.

Parameters:
value - The intended Notehead value.

getNotations

public java.util.List<Notation> getNotations()
Get all notations.

Returns:
An unsorted collection of Notation instances.

addNotation

public void addNotation(Notation notation)
Add a Notation instance.

Parameters:
notation - A Notation instance.

addTuplet

public Tuplet addTuplet(int number,
                        StartStop tupletType)
Create and add a Tuplet instance with the indicated parameters.

Parameters:
number - The number.
tupletType - The tuplet type.
Returns:
The new Tuplet instance with the indicated parameters.

toXmlNode

public org.w3c.dom.Node toXmlNode(org.w3c.dom.Node parent)
Description copied from class: MusicXmlEntity
Serialize the content of a MusicXML entity into an XML element.

Specified by:
toXmlNode in class MusicXmlEntity
Parameters:
parent - The XML element which is to receive the data.
Returns:
The newly created XML element.

putXmlData

public void putXmlData(org.w3c.dom.Element element)
Overrides:
putXmlData in class TimedEvent

fromXmlNode

public static NoteInMeasure fromXmlNode(org.w3c.dom.Element element,
                                        MeasureInPart container)
Create a new NoteInMeasure instance and fill it with loaded data.

Parameters:
element - The XML element that provides the NoteInMeasure data
container - The Measure which will contain the new NoteInMeasure instance.
Returns:
The newly created NoteInMeasure instance.

equals

public boolean equals(MusicXmlEntity other)
Description copied from class: MusicXmlEntity
Test if this MusicXML entity has the same content as another object.

Overrides:
equals in class TimedEvent
Parameters:
other - The other object.
Returns:
True if both objects have the same content; false otherwise.