net.charlesames.music.ensemble
Class ContainerOfInstrumentLinks

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
All Implemented Interfaces:
EntityContainer
Direct Known Subclasses:
EnsembleInstrument, UnpitchedSound

public abstract class ContainerOfInstrumentLinks
extends EnsembleEntity

The abstract ContainerOfInstrumentLinks class implements functionality shared between ContainerOfInstrumentLinks and UnpitchedSound objects.

Author:
Charles Ames

Nested Class Summary
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Constructor Summary
ContainerOfInstrumentLinks(EnsembleEntity container, int id, java.lang.String name)
          Constructor for {link ContainerOfInstrumentLinks} instances.
 
Method Summary
 NoteListInstrumentLink addInstrumentLink(int id)
          Add a NoteListInstrumentLink with the indicated sequence number.
 boolean check(HtmlBuilder builder)
          Check this component for errors and inconsistencies
 void checkNewInstrumentLinkID(int id)
          Check if the indicated sequence number is suitable for a new NoteListInstrumentLink instance.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
 int getDefaultInstrumentLinkID()
          Get the next unused instrument link id.
abstract  EnsembleInstrument getInstrument()
          Getter for the EnsembleInstrument which either this is or this is contained by.
 java.util.SortedMap<java.lang.Integer,NoteListInstrumentLink> getInstrumentLinks()
          Get the assigned note list instrument.
 boolean isUnpitched()
          Getter for the Unpitched property.
 void removeInstrumentLink(int id)
          Remove the link with the indicated sequence number.
 void resequenceInstrumentLinks()
          Rebuild the sequence of NoteListInstrumentLink id's so that the first id is 1 and the sequence proceeds without gaps.
 void shiftInstrumentLinkDown(int id)
          Move a specified NoteListInstrumentLink down within the collection (i.e.
 void shiftInstrumentLinksDown(int id, int increment)
          Shift NoteListInstrumentLink instances down as a block, beginning with the indicated id.
 void shiftInstrumentLinkUp(int id)
          Move a specified NoteListInstrumentLink up within the collection (i.e.
 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, 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, 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
 

Constructor Detail

ContainerOfInstrumentLinks

public ContainerOfInstrumentLinks(EnsembleEntity container,
                                  int id,
                                  java.lang.String name)
Constructor for {link ContainerOfInstrumentLinks} instances.

Parameters:
container - The EnsembleEntity that will contain this instrument.
name - The instrument name. Must be unique.
id - The instrument identifier. Must be unique.
Method Detail

getInstrument

public abstract EnsembleInstrument getInstrument()
Getter for the EnsembleInstrument which either this is or this is contained by.

Returns:
The EnsembleInstrument which either this is or this is contained by.

getInstrumentLinks

public java.util.SortedMap<java.lang.Integer,NoteListInstrumentLink> getInstrumentLinks()
Get the assigned note list instrument.

Returns:
The assigned note list instrument.

isUnpitched

public boolean isUnpitched()
Getter for the Unpitched property.

Returns:
True if the instrument is unpitched; false otherwise.

addInstrumentLink

public NoteListInstrumentLink addInstrumentLink(int id)
Add a NoteListInstrumentLink with the indicated sequence number.

Parameters:
id - The indicated sequence number, which controls the order in which note statements are generated.
Returns:
The newly created NoteListInstrumentLink instance.

removeInstrumentLink

public void removeInstrumentLink(int id)
Remove the link with the indicated sequence number.

Parameters:
id - The indicated id.

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.

wipe

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

Overrides:
wipe in class Entity

getDefaultInstrumentLinkID

public int getDefaultInstrumentLinkID()
Get the next unused instrument link id.

Returns:
The next unused instrument link id.

checkNewInstrumentLinkID

public void checkNewInstrumentLinkID(int id)
Check if the indicated sequence number is suitable for a new NoteListInstrumentLink instance.

Parameters:
id - The indicated sequence number.

resequenceInstrumentLinks

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


shiftInstrumentLinkUp

public void shiftInstrumentLinkUp(int id)
Move a specified NoteListInstrumentLink up within the collection (i.e. decrement its id).

Parameters:
id - The current chroma id

shiftInstrumentLinkDown

public void shiftInstrumentLinkDown(int id)
Move a specified NoteListInstrumentLink down within the collection (i.e. increment its id).

Parameters:
id - The current chroma id

shiftInstrumentLinksDown

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

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

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.