net.charlesames.music.ensemble
Class MusicXmlStaff

java.lang.Object
  extended by net.charlesames.utility.common.Disposable
      extended by net.charlesames.utility.entity.Entity
          extended by net.charlesames.utility.entity.WriteableEntity
              extended by net.charlesames.music.ensemble.EnsembleEntity
                  extended by net.charlesames.music.ensemble.MusicXmlStaff
All Implemented Interfaces:
EntityContainer

public class MusicXmlStaff
extends EnsembleEntity

MusicXmlStaff objects together define the fine vertical structure of a MusicXML part.

Author:
Charles Ames

Nested Class Summary
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Method Summary
static XmlSpec createXmlSpec()
          Create an XML specification for the MusicXmlStaff class.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
static MusicXmlStaff fromXmlNode(org.w3c.dom.Element element, MusicXmlPart part)
          Create a new MusicXmlStaff instance and fill it with loaded data.
 MusicXmlPart getContainer()
          Getter for the Container property.
 Clef getDefaultClef()
          Getter for the DefaultClef property.
 Dynamic getDynamic()
          Setter for the Dynamic property.
 java.lang.String getPath()
          Return a description of this entity and its containers.
 void getXmlData(org.w3c.dom.Element element)
          Read data from an XML Element.
 void setDefaultClef(Clef clef)
          Setter for the DefaultClef property.
 void setDynamic(Dynamic dynamic)
          Getter for the Dynamic property.
 boolean setID(int id)
          Setter for the ID property.
 boolean setName(java.lang.String name)
          Setter for the Name property.
 java.lang.String toString()
           
 
Methods inherited from class net.charlesames.music.ensemble.EnsembleEntity
buildDescription, copyToClipboard, createIndentCell, createXmlSpec, describeFeature, getEnsemble, logError, predecessor
 
Methods inherited from class net.charlesames.utility.entity.WriteableEntity
check, clearXmlSpecs, createXmlSpec, getTagName, getXmlSpec, getXmlSpec, initializeXsd, isPersistent, logError, logError, makeDirty, putXmlData, save, setPersistent, setStatus, toXmlNode
 
Methods inherited from class net.charlesames.utility.entity.Entity
decrementReferenceCount, dereferenceHandle, dispose, equals, getHandle, getID, getName, getReferenceCount, getStatus, getText, hasContainer, incrementReferenceCount, isModifiable, methodHasOverride, predecessor, resequenceEntities, setContainer, setModifiable, shiftEntitiesDown, shiftEntityDown, shiftEntityUp, successor, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getContainer

public MusicXmlPart getContainer()
Description copied from class: Entity
Getter for the Container property.

Overrides:
getContainer in class EnsembleEntity
Returns:
The assigned Container value.

getDefaultClef

public Clef getDefaultClef()
Getter for the DefaultClef property. In MusicXML, a "part" can comprise one or more staves (consider a grand staff), and each staff can accommodate one or two voices. To map from an Ensemble to MusicXML, you must therefore fill in five EnsembleVoice properties: MusicXmlPart, MusicXmlStaffID, DefaultClef, MusicXmlVoiceID, and MusicXmlPlacement. Each voice in a MusicXML-capable Ensemble must have a unique combination of part, staff id, and voice id.

Returns:
The current default clef.

setDefaultClef

public void setDefaultClef(Clef clef)
Setter for the DefaultClef property. In MusicXML, a "part" can comprise one or more staves (consider a grand staff), and each staff can accommodate one or two voices. To map from an Ensemble to MusicXML, you must therefore fill in five EnsembleVoice properties: MusicXmlPart, MusicXmlStaffID, DefaultClef, MusicXmlVoiceID, and MusicXmlPlacement. Each voice in a MusicXML-capable Ensemble must have a unique combination of part, staff id, and voice id. Call this method after you have set the MusicXmlPart, since the range of allowable voice id's is determined by the part.

Parameters:
clef - The intended default clef.

getDynamic

public Dynamic getDynamic()
Setter for the Dynamic property. The Dynamic property property non-persistent. It is used by the MusicXML writer to track the most-recently used dynamic. It enables the writer to suppress redundant dynamic indications.

Returns:
The current Dynamic value.

setDynamic

public void setDynamic(Dynamic dynamic)
Getter for the Dynamic property. The Dynamic property property non-persistent. It is used by the MusicXML writer to track the most-recently used dynamic. It enables the writer to suppress redundant dynamic indications.

Parameters:
dynamic - The intended Dynamic value.

setID

public boolean setID(int id)
Description copied from class: Entity
Setter for the ID property.

Overrides:
setID in class WriteableEntity
Parameters:
id - The intended ID value.
Returns:
True if an ID change actually happened; false otherwise.

setName

public boolean setName(java.lang.String name)
Description copied from class: Entity
Setter for the Name property.

Overrides:
setName in class WriteableEntity
Parameters:
name - The intended Name value.
Returns:
True if a Name change actually happened; false otherwise.

getPath

public java.lang.String getPath()
Description copied from class: Entity
Return a description of this entity and its containers.

Specified by:
getPath in interface EntityContainer
Overrides:
getPath in class Entity
Returns:
A description of this entity and its containers.

fromXmlNode

public static MusicXmlStaff fromXmlNode(org.w3c.dom.Element element,
                                        MusicXmlPart part)
Create a new MusicXmlStaff instance and fill it with loaded data.

Parameters:
element - The XML element that provides the MusicXmlStaff data
part - The Ensemble which will contain the new MusicXmlStaff.
Returns:
The newly created MusicXmlStaff instance.

getXmlData

public void getXmlData(org.w3c.dom.Element element)
Description copied from class: WriteableEntity
Read data from an XML Element.

Overrides:
getXmlData in class WriteableEntity
Parameters:
element - The source Element.

toString

public java.lang.String toString()
Overrides:
toString in class EnsembleEntity

createXmlSpec

public static XmlSpec createXmlSpec()
Create an XML specification for the MusicXmlStaff class.

Returns:
The newly created XmlSpec instance.
Throws:
java.lang.RuntimeException - when an XmlSpec instance already exists for the MusicXmlStaff class.

equals

public boolean equals(EnsembleEntity other)
Description copied from class: EnsembleEntity
Check if this entity has the same class and content as another entity.

Overrides:
equals in class EnsembleEntity
Parameters:
other - The other entity.
Returns:
True if the two entities have the same class and content; false otherwise.