net.charlesames.music.ensemble
Class UnpitchedSound

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.ContainerOfInstrumentLinks
                      extended by net.charlesames.music.ensemble.UnpitchedSound
All Implemented Interfaces:
EntityContainer

public class UnpitchedSound
extends ContainerOfInstrumentLinks

An UnpitchedSound object maps a Pitch to details controlling the musical sound. The parent of an UnpitchedSound is always an UnpitchedSound.

Author:
Charles Ames

Nested Class Summary
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Method Summary
 boolean check(HtmlBuilder builder)
          Check this component for errors and inconsistencies
 UnpitchedIndication createUnpitchedIndication(Indication indication)
          Add the specified MusicXML indication to the sound.
static XmlSpec createXmlSpec()
          Create an XML specification for the UnpitchedSound class.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
static UnpitchedSound fromXmlNode(org.w3c.dom.Element element, EnsembleInstrument instrument)
          Create a new UnpitchedSound instance and fill it with loaded data.
 EnsembleInstrument getContainer()
          Getter for the Container property.
 Ensemble getEnsemble()
          Get the Ensemble which sits on top of the current object hierarchy.
 EnsembleInstrument getInstrument()
          Getter for the EnsembleInstrument which either this is or this is contained by.
 int getMidiKey()
          Getter for the {code MidiKey} property.
 NoteheadShape getNotehead()
          Getter for the Notehead property.
 java.lang.String getPath()
          Return a description of this entity and its containers.
 Pitch getPitch()
          Getter for the Pitch property.
 java.lang.String getText()
          Return a unique description of this entity.
 java.util.SortedMap<java.lang.String,UnpitchedIndication> getUnpitchedIndications()
          Get the collection of indications.
 boolean hasIndication(Indication indication)
          Test if the sound possesses the specified indication.
 void removeIndication(Indication indication)
          Remove the specified MusicXML indication from the sound.
 void setGeneralMidiPercussionSound(GeneralMidiPercussionSound sound)
          Set the name and MIDI key from the indicated GeneralMidiPercussionSound option.
 void setMidiKey(int value)
          Setter for the {code MidiKey} property.
 void setNotehead(NoteheadShape value)
          Setter for the Notehead property.
 void wipe()
          Clear all data in this Entity instance.
 
Methods inherited from class net.charlesames.music.ensemble.ContainerOfInstrumentLinks
addInstrumentLink, checkNewInstrumentLinkID, getDefaultInstrumentLinkID, getInstrumentLinks, isUnpitched, removeInstrumentLink, resequenceInstrumentLinks, shiftInstrumentLinkDown, shiftInstrumentLinksDown, shiftInstrumentLinkUp
 
Methods inherited from class net.charlesames.music.ensemble.EnsembleEntity
buildDescription, copyToClipboard, createIndentCell, createXmlSpec, describeFeature, logError, predecessor, toString
 
Methods inherited from class net.charlesames.utility.entity.WriteableEntity
clearXmlSpecs, createXmlSpec, getTagName, getXmlData, getXmlSpec, getXmlSpec, initializeXsd, isPersistent, logError, logError, makeDirty, putXmlData, save, setID, setName, setPersistent, setStatus, toXmlNode
 
Methods inherited from class net.charlesames.utility.entity.Entity
decrementReferenceCount, dereferenceHandle, dispose, equals, getHandle, getID, getName, getReferenceCount, getStatus, hasContainer, incrementReferenceCount, isModifiable, methodHasOverride, predecessor, resequenceEntities, setContainer, setModifiable, shiftEntitiesDown, shiftEntityDown, shiftEntityUp, successor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getContainer

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

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

getInstrument

public EnsembleInstrument getInstrument()
Description copied from class: ContainerOfInstrumentLinks
Getter for the EnsembleInstrument which either this is or this is contained by.

Specified by:
getInstrument in class ContainerOfInstrumentLinks
Returns:
The EnsembleInstrument which either this is or this is contained by.

getPitch

public Pitch getPitch()
Getter for the Pitch property.

Returns:
The Pitch value.

getMidiKey

public int getMidiKey()
Getter for the {code MidiKey} property.

Returns:
The current {code MidiKey} value.

setMidiKey

public void setMidiKey(int value)
Setter for the {code MidiKey} property.

Parameters:
value - The intended {code MidiKey} value.

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.

getEnsemble

public Ensemble getEnsemble()
Description copied from class: EnsembleEntity
Get the Ensemble which sits on top of the current object hierarchy.

Overrides:
getEnsemble in class EnsembleEntity
Returns:
The Ensemble which sits on top of the current object hierarchy.

getNotehead

public NoteheadShape getNotehead()
Getter for the Notehead property.

Returns:
The current Notehead value.

setNotehead

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

Parameters:
value - The intended Notehead value.

setGeneralMidiPercussionSound

public void setGeneralMidiPercussionSound(GeneralMidiPercussionSound sound)
Set the name and MIDI key from the indicated GeneralMidiPercussionSound option.

Parameters:
sound - The indicated GeneralMidiPercussionSound option.

getUnpitchedIndications

public java.util.SortedMap<java.lang.String,UnpitchedIndication> getUnpitchedIndications()
Get the collection of indications.

Returns:
A collection of UnpitchedIndication instances, sorted by indication name.

hasIndication

public boolean hasIndication(Indication indication)
Test if the sound possesses the specified indication.

Parameters:
indication - The specified indication.
Returns:
True if the sound possesses the specified indication; false otherwise

createUnpitchedIndication

public UnpitchedIndication createUnpitchedIndication(Indication indication)
Add the specified MusicXML indication to the sound.

Parameters:
indication - The specified MusicXML indication.
Returns:
An UnpitchedIndication instance wrapping the specified MusicXML indication.
Throws:
ObjectAlreadyExistsException - if the sound already contains the specified indication.

removeIndication

public void removeIndication(Indication indication)
Remove the specified MusicXML indication from the sound.

Parameters:
indication - The specified MusicXML indication.
Throws:
NoSuchObjectException - if the sound does not contain the specified indication.

check

public boolean check(HtmlBuilder builder)
Check this component for errors and inconsistencies

Overrides:
check in class ContainerOfInstrumentLinks
Parameters:
builder - Accumulates an HTML formatted record of each error or inconsistency found.
Returns:
False if any errors or inconsistencies are found; true otherwise.

getText

public java.lang.String getText()
Description copied from class: Entity
Return a unique description of this entity.

Overrides:
getText in class Entity
Returns:
A unique description of this entity.

wipe

public void wipe()
Description copied from class: Entity
Clear all data in this Entity instance.

Overrides:
wipe in class ContainerOfInstrumentLinks

fromXmlNode

public static UnpitchedSound fromXmlNode(org.w3c.dom.Element element,
                                         EnsembleInstrument instrument)
Create a new UnpitchedSound instance and fill it with loaded data.

Parameters:
element - The XML element that provides the {code UnpitchedSound} data
instrument - The {link UnpitchedSound} which will contain the new {code UnpitchedSound}.
Returns:
The newly created {code UnpitchedSound} instance.

createXmlSpec

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

Returns:
The newly created XmlSpec instance.
Throws:
java.lang.RuntimeException - when an XmlSpec instance already exists for the UnpitchedSound 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 ContainerOfInstrumentLinks
Parameters:
other - The other entity.
Returns:
True if the two entities have the same class and content; false otherwise.