net.charlesames.music.ensemble
Class NoteListParameterLink

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

public class NoteListParameterLink
extends EnsembleEntity

NoteListParameterLink instances details how to obtain parameter values when the EnsembleInstrument associated with the containing NoteListInstrumentLink generates a note statement using the associated NoteListInstrument.

Author:
Charles Ames

Nested Class Summary
static class NoteListParameterLink.Moment
          The NoteListParameterLink.Moment class identifies at what time during a note a Contour link should acquire a parameter value.
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Constructor Summary
NoteListParameterLink(NoteListInstrumentLink instrumentLink, NoteListParameter parameter)
          Constructor for NoteListParameterLink instances.
 
Method Summary
 boolean check(HtmlBuilder builder)
          Check this component for errors and inconsistencies
static XmlSpec createXmlSpec()
          Create an XML specification for the NoteListParameterLink class.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
 java.lang.String formatValue(double value)
          Format the indicated value as a text string.
static NoteListParameterLink fromXmlNode(org.w3c.dom.Element element, NoteListInstrumentLink instrumentLink)
          Create a new NoteListParameterLink instance and fill it with loaded data.
 NoteListInstrumentLink getContainer()
          Getter for the NoteListInstrumentLink within which this parameter link operates.
 TypeOfParameterLink getLinkType()
          Getter for the LinkType property; The LinkType indicates whether the parameter should draw its value from a constant, from a note attribute, or from a contour.
 NoteListParameterLink.Moment getMoment()
          Get the NoteListParameterLink.Moment property.
 NoteAttribute getNoteAttribute()
          Get the NoteAttribute instance corresponding to the attribute name.
 NoteListParameter getParameter()
          Get the referenced NoteListParameter.
 java.lang.String getReference()
          Getter for the Reference property.
 java.lang.String getText()
          Return a unique description of this entity.
 double getValue()
          Get the parameter value.
 double getValue(ScoreNote note)
          Get the parameter value
 void linkToAttribute(NoteAttribute attribute)
          Configure this NoteListParameterLink instance to draw from the indicated note attribute.
 void linkToConstant(double value)
          Configure this NoteListParameterLink instance to employ a fixed double-precision value.
 void linkToContour(EnsembleContour ensembleContour, NoteListParameterLink.Moment moment)
          Configure this NoteListParameterLink instance to draw from the indicated contour as of the indicated moment.
 void linkToContour(java.lang.String contourName, NoteListParameterLink.Moment moment)
          Configure this NoteListParameterLink instance to draw from the contour with the indicated name as of the indicated moment.
 void resolve()
          Do nothing, since contour links are now loosely bound.
 boolean setID(int id)
          Setter for the ID property.
 void setLinkType(TypeOfParameterLink linkType)
          Setter for the LinkType property;
 void setMoment(NoteListParameterLink.Moment moment)
          Set the NoteListParameterLink.Moment property.
 void setReference(java.lang.String reference)
          Setter for the Reference property.
 
Methods inherited from class net.charlesames.music.ensemble.EnsembleEntity
buildDescription, copyToClipboard, createIndentCell, createXmlSpec, describeFeature, 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, 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

NoteListParameterLink

public NoteListParameterLink(NoteListInstrumentLink instrumentLink,
                             NoteListParameter parameter)
Constructor for NoteListParameterLink instances.

Parameters:
instrumentLink - The container.
parameter - The referenced parameter.
Method Detail

getParameter

public NoteListParameter getParameter()
Get the referenced NoteListParameter.

Returns:
The referenced NoteListParameter.

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.

resolve

public void resolve()
Do nothing, since contour links are now loosely bound.


check

public boolean check(HtmlBuilder builder)
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.

linkToConstant

public void linkToConstant(double value)
Configure this NoteListParameterLink instance to employ a fixed double-precision value.

Parameters:
value - The intended value.

linkToAttribute

public void linkToAttribute(NoteAttribute attribute)
Configure this NoteListParameterLink instance to draw from the indicated note attribute.

Parameters:
attribute - The indicated attribute.

linkToContour

public void linkToContour(EnsembleContour ensembleContour,
                          NoteListParameterLink.Moment moment)
Configure this NoteListParameterLink instance to draw from the indicated contour as of the indicated moment.

Parameters:
ensembleContour - The indicated contour.
moment - The indicated moment.

linkToContour

public void linkToContour(java.lang.String contourName,
                          NoteListParameterLink.Moment moment)
Configure this NoteListParameterLink instance to draw from the contour with the indicated name as of the indicated moment.

Parameters:
contourName - The indicated contour name.
moment - The indicated moment.

getValue

public double getValue()
Get the parameter value. This method only works when the link type is CONSTANT.

Returns:
The parameter value.

getValue

public double getValue(ScoreNote note)
Get the parameter value

Parameters:
note - A note
Returns:
The parameter value.

getContainer

public NoteListInstrumentLink getContainer()
Getter for the NoteListInstrumentLink within which this parameter link operates.

Overrides:
getContainer in class EnsembleEntity
Returns:
The NoteListInstrumentLink within which this parameter link operates.

getReference

public final java.lang.String getReference()
Getter for the Reference property. For TypeOfParameterLink.CONSTANT links, the reference is not used. For TypeOfParameterLink.ATTRIBUTE links, the Reference names the note attribute from which NoteListParameter values will be drawn. For TypeOfParameterLink.CONTOUR links, the Reference names the contour from which NoteListParameter values will be drawn.

Returns:
The current reference.

setReference

public final void setReference(java.lang.String reference)
Setter for the Reference property. For TypeOfParameterLink.CONSTANT links, the reference formats the value as a string. For TypeOfParameterLink.ATTRIBUTE links, the Reference names the note attribute from which NoteListParameter values will be drawn. For TypeOfParameterLink.CONTOUR links, the Reference names the contour from which NoteListParameter values will be drawn.

Parameters:
reference - The intended reference.

getMoment

public NoteListParameterLink.Moment getMoment()
Get the NoteListParameterLink.Moment property.

Returns:
The assigned NoteListParameterLink.Moment property.
Throws:
java.lang.UnsupportedOperationException - when the link type is not TypeOfParameterLink.CONTOUR.

setMoment

public void setMoment(NoteListParameterLink.Moment moment)
Set the NoteListParameterLink.Moment property.

Parameters:
moment - The intended NoteListParameterLink.Moment property.
Throws:
java.lang.UnsupportedOperationException - when the link type is not TypeOfParameterLink.CONTOUR.

getLinkType

public TypeOfParameterLink getLinkType()
Getter for the LinkType property; The LinkType indicates whether the parameter should draw its value from a constant, from a note attribute, or from a contour.

Returns:
The assigned link type.

setLinkType

public void setLinkType(TypeOfParameterLink linkType)
Setter for the LinkType property;

Parameters:
linkType - The intended link type.

formatValue

public java.lang.String formatValue(double value)
Format the indicated value as a text string.

Parameters:
value - The indicated value.
Returns:
The indicated value formatted as a text string.

getNoteAttribute

public NoteAttribute getNoteAttribute()
Get the NoteAttribute instance corresponding to the attribute name.

Returns:
The NoteAttribute instance corresponding to the attribute name.
Throws:
java.lang.UnsupportedOperationException - when the link type is not TypeOfParameterLink.ATTRIBUTE.

fromXmlNode

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

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

createXmlSpec

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

Returns:
The newly created XmlSpec instance.
Throws:
java.lang.RuntimeException - when an XmlSpec instance already exists for the NoteListParameterLink 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.