net.charlesames.music.ensemble
Class TuningMapDiatonic

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

public class TuningMapDiatonic
extends TuningMap

In a TuningMapDiatonic the cents value associated with any degree is the sum of a cents value associated with the letter name and the cents value associated with the accidental.

Author:
Charles Ames

Nested Class Summary
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.TuningMap
TuningMap.Type
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Constructor Summary
TuningMapDiatonic(Ensemble ensemble)
          Constructor for TuningMapDiatonic instances.
 
Method Summary
 TuningElementAccidental createTuningElement(Accidental accidental)
          Create a TuningElementAccidental instance mapping the indicated accidental to a cents displacement from the unison.
 TuningElementInflection createTuningElement(Inflection inflection)
          Create a TuningElementInflection instance mapping the indicated inflection to a cents displacement from the unison.
 TuningElementLetter createTuningElement(LetterName letterName)
          Create a TuningElementLetter instance mapping the indicated letter name to a cents displacement from C.
static XmlSpec createXmlSpec()
          Create an XML specification for the TuningMapDiatonic class.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
static TuningMapDiatonic fromXmlNode(org.w3c.dom.Element element, Ensemble container)
          Create a new TuningMapDiatonic instance from information in an XML element.
 java.util.SortedMap<java.lang.String,TuningElementAccidental> getAccidentals()
          Get the collection of TuningElementAccidental instances.
 int getCents(Degree degree)
          Get the cents displacement from C natural for the indicated degree.
 java.util.SortedMap<java.lang.String,TuningElementInflection> getInflections()
          Get the collection of TuningElementInflection instances.
 java.util.SortedMap<java.lang.String,TuningElementLetter> getLetterNames()
          Get the collection of TuningElementLetter instances.
 TuningMap.Type getType()
          Get the tuning map configuration.
 void initialize()
          Fill in a minimal set of tuning elements, assuming 12 equal divisions of the octave.
 void mapAccidentalToCents(Accidental accidental, int cents)
          Map the indicated accidental to the indicated cents value.
 void mapInflectionToCents(Inflection inflection, int cents)
          Map the indicated inflection to the indicated cents value.
 void mapLetterNameToCents(LetterName letterName, int cents)
          Map the indicated letter name to the indicated cents value.
 void wipe()
          Clear all data in this Entity instance.
 
Methods inherited from class net.charlesames.music.ensemble.TuningMap
getCentsFromMiddleC
 
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
check, 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

TuningMapDiatonic

public TuningMapDiatonic(Ensemble ensemble)
Constructor for TuningMapDiatonic instances.

Parameters:
ensemble - The Ensemble that contains this tuning map.
Method Detail

wipe

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

Overrides:
wipe in class Entity

getType

public TuningMap.Type getType()
Description copied from class: TuningMap
Get the tuning map configuration.

Specified by:
getType in class TuningMap
Returns:
The tuning map configuration.

mapLetterNameToCents

public void mapLetterNameToCents(LetterName letterName,
                                 int cents)
Map the indicated letter name to the indicated cents value.

Parameters:
letterName - The indicated letter name.
cents - The cents displacement from C natural.

getLetterNames

public java.util.SortedMap<java.lang.String,TuningElementLetter> getLetterNames()
Get the collection of TuningElementLetter instances.

Returns:
The collection of TuningElementLetter instances.

getAccidentals

public java.util.SortedMap<java.lang.String,TuningElementAccidental> getAccidentals()
Get the collection of TuningElementAccidental instances.

Returns:
The collection of TuningElementAccidental instances.

mapAccidentalToCents

public void mapAccidentalToCents(Accidental accidental,
                                 int cents)
Map the indicated accidental to the indicated cents value.

Parameters:
accidental - The indicated accidental.
cents - The cents displacement from the unison.

getInflections

public java.util.SortedMap<java.lang.String,TuningElementInflection> getInflections()
Get the collection of TuningElementInflection instances.

Returns:
The collection of TuningElementInflection instances.

mapInflectionToCents

public void mapInflectionToCents(Inflection inflection,
                                 int cents)
Map the indicated inflection to the indicated cents value.

Parameters:
inflection - The indicated inflection.
cents - The cents displacement from the unison.

createTuningElement

public TuningElementLetter createTuningElement(LetterName letterName)
Create a TuningElementLetter instance mapping the indicated letter name to a cents displacement from C. The default tuning is equal temperament.

Parameters:
letterName - The indicated letter name.
Returns:
The newly created TuningElementLetter instance.

createTuningElement

public TuningElementAccidental createTuningElement(Accidental accidental)
Create a TuningElementAccidental instance mapping the indicated accidental to a cents displacement from the unison. The default tuning uses 100-cent increments.

Parameters:
accidental - The indicated accidental.
Returns:
The newly created TuningElementAccidental instance.

createTuningElement

public TuningElementInflection createTuningElement(Inflection inflection)
Create a TuningElementInflection instance mapping the indicated inflection to a cents displacement from the unison. The default tuning uses 50-cent increments.

Parameters:
inflection - The indicated inflection.
Returns:
The newly created TuningElementInflection instance.

initialize

public void initialize()
Description copied from class: TuningMap
Fill in a minimal set of tuning elements, assuming 12 equal divisions of the octave.

Specified by:
initialize in class TuningMap

getCents

public int getCents(Degree degree)
Description copied from class: TuningMap
Get the cents displacement from C natural for the indicated degree.

Specified by:
getCents in class TuningMap
Parameters:
degree - The indicated degree.
Returns:
The cents displacement from C natural.

fromXmlNode

public static TuningMapDiatonic fromXmlNode(org.w3c.dom.Element element,
                                            Ensemble container)
Create a new TuningMapDiatonic instance from information in an XML element.

Parameters:
container - The Ensemble which will contain this TuningMapDiatonic instance.
element - An XML element describing a TuningMapDiatonic instance.
Returns:
The new TuningMapDiatonic instance.

createXmlSpec

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

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