net.charlesames.music.musicxml
Class ScorePart

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

public class ScorePart
extends MusicXmlEntity

The ScorePart class implements the MusicXML <score-part> element.

Author:
Charles Ames

Method Summary
 java.lang.String createInstrumentID(EnsembleInstrument ensembleInstrument)
          Construct an instrument id from a specified EnsembleInstrument instance.
 MidiInstrument createMidiInstrument(java.lang.String id)
          Create a new MidiInstrument instance and add it to this part.
 ScoreInstrument createScoreInstrument(java.lang.String id, java.lang.String name)
          Create a new ScoreInstrument instance and add it to this part.
 java.lang.String createUnpitchedSoundID(UnpitchedSound unpitchedSound)
          Construct an instrument id from a specified UnpitchedSound instance.
 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 ScorePart fromXmlNode(org.w3c.dom.Element element, ScorePartwise container)
          Create a new ScorePart instance and fill it with loaded data.
 java.lang.String getID()
          Getter for the ID property
 MidiInstrument getMidiInstrument(java.lang.String id)
          Get the MidiInstrument instance with the indicated id.
 java.lang.String getName()
          Getter for the Name property
 ScoreInstrument getScoreInstrument(java.lang.String id)
          Get the ScoreInstrument instance with the indicated id.
 void putXmlData(org.w3c.dom.Element element)
           
 void setID(java.lang.String id)
          Setter for the ID property
 void setName(java.lang.String name)
          Setter for the Name 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.MusicXmlEntity
getContainer, 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.

Specified by:
dispose in class Disposable

getID

public java.lang.String getID()
Getter for the ID property

Returns:
The current ID value.

setID

public void setID(java.lang.String id)
Setter for the ID property

Parameters:
id - The intended ID value.

getName

public java.lang.String getName()
Getter for the Name property

Returns:
The current Name value.

setName

public void setName(java.lang.String name)
Setter for the Name property

Parameters:
name - The intended Name value.

createInstrumentID

public java.lang.String createInstrumentID(EnsembleInstrument ensembleInstrument)
Construct an instrument id from a specified EnsembleInstrument instance.

Parameters:
ensembleInstrument - The specified EnsembleInstrument instance.
Returns:
The constructed instrument id.

createUnpitchedSoundID

public java.lang.String createUnpitchedSoundID(UnpitchedSound unpitchedSound)
Construct an instrument id from a specified UnpitchedSound instance.

Parameters:
unpitchedSound - The specified UnpitchedSound instance.
Returns:
The constructed instrument id.

createScoreInstrument

public ScoreInstrument createScoreInstrument(java.lang.String id,
                                             java.lang.String name)
Create a new ScoreInstrument instance and add it to this part.

Parameters:
id - The score-instrument id. If this id is already used the existing ScoreInstrument will be returned.
name - The score-instrument name.
Returns:
A ScoreInstrument instance.

getScoreInstrument

public ScoreInstrument getScoreInstrument(java.lang.String id)
Get the ScoreInstrument instance with the indicated id.

Parameters:
id - The indicated id.
Returns:
The ScoreInstrument instance with the indicated id.

getMidiInstrument

public MidiInstrument getMidiInstrument(java.lang.String id)
Get the MidiInstrument instance with the indicated id.

Parameters:
id - The indicated id.
Returns:
The MidiInstrument instance with the indicated id.

createMidiInstrument

public MidiInstrument createMidiInstrument(java.lang.String id)
Create a new MidiInstrument instance and add it to this part.

Parameters:
id - The midi-instrument id. If this id is already used the existing ScoreInstrument will be returned.
Returns:
A MidiInstrument instance.

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)

fromXmlNode

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

Parameters:
element - The XML element that provides the ScorePart data
container - The ScorePartwise which will contain the new ScorePart instance.
Returns:
The newly created ScorePart 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 MusicXmlEntity
Parameters:
other - The other object.
Returns:
True if both objects have the same content; false otherwise.