net.charlesames.music.ensemble
Class NoteListInstrument

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

public class NoteListInstrument
extends EnsembleEntity

The NoteListInstrument class defines note-list instrument ID's and associates these with EnsembleContour instances.

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
 void checkNewParameterID(int id)
          Check if the indicated id is suitable for a new NoteListParameter instance.
 void checkNewParameterName(java.lang.String name)
          Check if the indicated name is suitable for a new NoteListParameter instance.
 void clear()
          Clear the contents of this thing.
 void conformToFormat(NoteListFormat oldFormat, NoteListFormat newFormat)
           
 NoteListParameter createParameter(int id, java.lang.String name)
          Create a new NoteListParameter.
static XmlSpec createXmlSpec()
          Create an XML specification for the NoteListInstrument class.
 void disableParameterEditing(NoteListFormat noteListFormat)
          Make format-defined parameters unmodifiable.
 void enableParameterEditing(NoteListFormat noteListFormat)
          Make format-defined parameters modifiable.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
static NoteListInstrument fromXmlNode(org.w3c.dom.Element element, Ensemble ensemble)
          Create a new NoteListInstrument instance and fill it with loaded data.
 int getDefaultParameterID()
          Get the next unused identifier for new NoteListParameter instances.
 int getMaxParameterID()
          Get the highest parameter number present in instrument definition.
 java.util.SortedMap<java.lang.Integer,NoteListParameter> getParametersByID()
          Get this instrument's parameter list.
 java.util.SortedMap<java.lang.String,NoteListParameter> getParametersByName()
          Get this instrument's parameter list.
 java.lang.String getPath()
          Return a description of this entity and its containers.
 void removeParameter(int id)
          Removes a parameter with the indicated id.
 void removeParameter(java.lang.String name)
          Removes a parameter with the indicated name.
 void resequenceParameters()
          Rebuild the sequence of NoteListParameter id's so that the first id is 1 and the sequence proceeds without gaps.
 boolean setID(int id)
          Setter for the ID property.
 boolean setName(java.lang.String name)
          Setter for the Name property.
 void shiftParameterDown(int id)
          Move the parameter down in the parameter list (increment the parameter's id).
 void shiftParametersDown(int id, int increment)
          Shift NoteListParameterLink instances down as a block, beginning with the indicated id.
 void shiftParameterUp(int id)
          Move the parameter up in the parameter list (decrement the parameter's id).
 java.lang.String toString()
           
 void wipe()
          Clear all data in this Entity instance.
 
Methods inherited from class net.charlesames.music.ensemble.EnsembleEntity
buildDescription, copyToClipboard, createIndentCell, createXmlSpec, describeFeature, getContainer, getEnsemble, logError, predecessor
 
Methods inherited from class net.charlesames.utility.entity.WriteableEntity
clearXmlSpecs, createXmlSpec, getTagName, getXmlData, 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

wipe

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

Overrides:
wipe in class Entity

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.

toString

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

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.

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.

getParametersByID

public java.util.SortedMap<java.lang.Integer,NoteListParameter> getParametersByID()
Get this instrument's parameter list.

Returns:
A collection of NoteListParameter instances, sorted by id.

getParametersByName

public java.util.SortedMap<java.lang.String,NoteListParameter> getParametersByName()
Get this instrument's parameter list.

Returns:
A collection of NoteListParameter instances, sorted by name.

createParameter

public final NoteListParameter createParameter(int id,
                                               java.lang.String name)
Create a new NoteListParameter.

Parameters:
id - The new parameter id. May not already be used upwards or downwards in the ensemble component hierarchy.
name - The new parameter name. May not already be used upwards or downwards in the ensemble component hierarchy.
Returns:
The newly created NoteListParameter instance.
Throws:
java.lang.IllegalArgumentException - when the parameter ID is already used.

checkNewParameterID

public void checkNewParameterID(int id)
Check if the indicated id is suitable for a new NoteListParameter instance.

Parameters:
id - The indicated id.

checkNewParameterName

public void checkNewParameterName(java.lang.String name)
Check if the indicated name is suitable for a new NoteListParameter instance.

Parameters:
name - The indicated name.

removeParameter

public final void removeParameter(int id)
Removes a parameter with the indicated id.

Parameters:
id - The id of the parameter to be removed.
Throws:
java.lang.IllegalArgumentException - when no parameter has the indicated id.

removeParameter

public final void removeParameter(java.lang.String name)
Removes a parameter with the indicated name.

Parameters:
name - The name of the parameter to be removed.
Throws:
java.lang.IllegalArgumentException - when no parameter has the indicated id.

conformToFormat

public void conformToFormat(NoteListFormat oldFormat,
                            NoteListFormat newFormat)
Parameters:
oldFormat -
newFormat -

resequenceParameters

public void resequenceParameters()
Rebuild the sequence of NoteListParameter id's so that the first id is 1 and the sequence proceeds without gaps.


shiftParameterUp

public void shiftParameterUp(int id)
Move the parameter up in the parameter list (decrement the parameter's id).

Parameters:
id - The present id of the parameter, to be changed.

shiftParameterDown

public void shiftParameterDown(int id)
Move the parameter down in the parameter list (increment the parameter's id).

Parameters:
id - The present id of the parameter, to be changed.

shiftParametersDown

public void shiftParametersDown(int id,
                                int increment)
Shift NoteListParameterLink instances down as a block, beginning with the indicated id.

Parameters:
id - The indicated id.
increment - The number of positions to shift.

clear

public void clear()
Clear the contents of this thing.


getDefaultParameterID

public int getDefaultParameterID()
Get the next unused identifier for new NoteListParameter instances.

Returns:
The next unused identifier for new NoteListParameter instances.

getMaxParameterID

public int getMaxParameterID()
Get the highest parameter number present in instrument definition.

Returns:
The highest parameter number present in instrument definition.

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 NoteListInstrument class.

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

enableParameterEditing

public void enableParameterEditing(NoteListFormat noteListFormat)
Make format-defined parameters modifiable.

Parameters:
noteListFormat - The NoteListFormat instance which defines parameters.

disableParameterEditing

public void disableParameterEditing(NoteListFormat noteListFormat)
Make format-defined parameters unmodifiable.

Parameters:
noteListFormat - The NoteListFormat instance which defines parameters.