net.charlesames.music.ensemble
Class NoteListInstrumentLink

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.NoteListInstrumentLink
All Implemented Interfaces:
EntityContainer

public class NoteListInstrumentLink
extends EnsembleEntity

The NoteListInstrumentLink class defines an external reference from a ContainerOfInstrumentLinks to a NoteListInstrument.

Author:
Charles Ames

Nested Class Summary
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Constructor Summary
NoteListInstrumentLink(ContainerOfInstrumentLinks container, int id)
          Constructor for NoteListInstrumentLink instances.
 
Method Summary
 NoteListParameterLink addParameterLink(NoteListParameter parameter)
          Add a link to the indicated note-list parameter
 boolean check(HtmlBuilder builder)
          Check this component for errors and inconsistencies
static XmlSpec createXmlSpec()
          Create an XML specification for the NoteListInstrumentLink class.
static NoteListInstrumentLink fromXmlNode(org.w3c.dom.Element element, ContainerOfInstrumentLinks container)
          Create a new NoteListInstrumentLink instance and fill it with loaded data.
static NoteListInstrument fromXmlNode(org.w3c.dom.Element element, Ensemble ensemble)
          Create a new NoteListInstrument instance and fill it with loaded data.
 ContainerOfInstrumentLinks getContainer()
          Getter for the Container property.
 EnsembleInstrument getEnsembleInstrument()
          Get the EnsembleInstrument which contains this NoteListInstrumentLink.
 NoteListInstrument getNoteListInstrument()
          Get the NoteListInstrument referenced by this link.
 NoteListParameterLink getParameterLink(int id)
          Get the NoteListParameterLink instance linking this NoteListInstrumentLink to the NoteListParameter with the indicated id.
 NoteListParameterLink getParameterLink(java.lang.String name)
          Get the NoteListParameterLink instance linking this NoteListInstrumentLink to the NoteListParameter with the indicated name.
 java.util.SortedMap<java.lang.Integer,NoteListParameterLink> getParameterLinks()
          Get the collection of NoteListParameterLink instances which detail how to obtain parameter values when this ContainerOfInstrumentLinks generates a note statement using the associated NoteListInstrument.
 java.lang.String getText()
          Return a unique description of this entity.
 void removeParameter(NoteListParameter parameter)
          Remove a link to the indicated note-list parameter
 void setNoteListInstrument(NoteListInstrument noteListInstrument)
          Set the target of this NoteListInstrumentLink to the indicated NoteListInstrument.
 
Methods inherited from class net.charlesames.music.ensemble.EnsembleEntity
buildDescription, copyToClipboard, createIndentCell, createXmlSpec, describeFeature, equals, getEnsemble, 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, getPath, getReferenceCount, getStatus, 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
 

Constructor Detail

NoteListInstrumentLink

public NoteListInstrumentLink(ContainerOfInstrumentLinks container,
                              int id)
Constructor for NoteListInstrumentLink instances.

Parameters:
container - The container.
id - The sequence number.
Method Detail

setNoteListInstrument

public void setNoteListInstrument(NoteListInstrument noteListInstrument)
Set the target of this NoteListInstrumentLink to the indicated NoteListInstrument.

Parameters:
noteListInstrument - The indicated NoteListInstrument.

getContainer

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

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

getEnsembleInstrument

public EnsembleInstrument getEnsembleInstrument()
Get the EnsembleInstrument which contains this NoteListInstrumentLink.

Returns:
The EnsembleInstrument which contains this NoteListInstrumentLink.

getNoteListInstrument

public NoteListInstrument getNoteListInstrument()
Get the NoteListInstrument referenced by this link.

Returns:
The NoteListInstrument referenced by this link.

getParameterLinks

public java.util.SortedMap<java.lang.Integer,NoteListParameterLink> getParameterLinks()
Get the collection of NoteListParameterLink instances which detail how to obtain parameter values when this ContainerOfInstrumentLinks generates a note statement using the associated NoteListInstrument.

Returns:
The collection of NoteListParameterLink instances.

addParameterLink

public NoteListParameterLink addParameterLink(NoteListParameter parameter)
Add a link to the indicated note-list parameter

Parameters:
parameter - The indicated parameter.
Returns:
The newly created NoteListParameterLink instance.
Throws:
java.lang.IllegalArgumentException - when the parameter belongs to the wrong note-list instrument.
ObjectAlreadyExistsException - when a link to the indicated parameter is already present.

getParameterLink

public NoteListParameterLink getParameterLink(int id)
Get the NoteListParameterLink instance linking this NoteListInstrumentLink to the NoteListParameter with the indicated id.

Parameters:
id - The indicated id.
Returns:
The corresponding the indicated NoteListParameter instance.

getParameterLink

public NoteListParameterLink getParameterLink(java.lang.String name)
Get the NoteListParameterLink instance linking this NoteListInstrumentLink to the NoteListParameter with the indicated name.

Parameters:
name - The indicated name.
Returns:
The corresponding the indicated NoteListParameter instance.

removeParameter

public void removeParameter(NoteListParameter parameter)
Remove a link to the indicated note-list parameter

Parameters:
parameter - The indicated parameter.
Throws:
java.lang.IllegalArgumentException - when the parameter belongs to the wrong note-list instrument.
NoSuchObjectException - when no link to the indicated parameter is present.

check

public boolean check(HtmlBuilder builder)
Description copied from class: WriteableEntity
Check this component for errors and inconsistencies

Overrides:
check in class WriteableEntity
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.

fromXmlNode

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

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

fromXmlNode

public static NoteListInstrument fromXmlNode(org.w3c.dom.Element element,
                                             Ensemble ensemble)
Create a new NoteListInstrument instance and fill it with loaded data.

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

createXmlSpec

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

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