net.charlesames.music.ensemble
Class EnsembleContour

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

public class EnsembleContour
extends EnsembleEntity

The EnsembleContour class contains information about ScoreContour Each EnsembleContour instance is a child of a EnsembleChoir. Each ScoreContour instance within a Score has A EnsembleContour in an Ensemble describes the properties of a ScoreContour within a Score. The Index property of a EnsembleContour corresponds uniquely to the ID property of a ScoreContour.

Author:
Charles Ames

Nested Class Summary
 
Nested classes/interfaces inherited from class net.charlesames.music.ensemble.EnsembleEntity
EnsembleEntity.AttributeTable
 
Constructor Summary
EnsembleContour(EnsembleEntity container, java.lang.String name, int id, CalculationMode calculationMode)
          Constructor for EnsembleContour instances.
 
Method Summary
 MidiControl addMidiControl(TypeOfMidiControl controlType)
          Create a new MidiControl instance.
 void checkDefaultValue(double value)
          Check if the indicated value is suitable as an EnsembleContour default.
 void checkMaxExpValue(double value)
          Check if the indicated value is suitable as an EnsembleContour MaxExpValue
 void checkMaxValue(double value)
          Check if the indicated value is suitable as an EnsembleContour maximum.
 void checkMinExpValue(double value)
          Check if the indicated value is suitable as an EnsembleContour MinExpValue
 void checkMinValue(double value)
          Check if the indicated is suitable as a EnsembleContour minimum.
 double convertLinearToExponential(double value)
          Convert a linearly-evolving value to an exponentially evolving value.
 boolean convertsLinearToExponential()
          Test if this contour converts linearly-evolving values into exponentially evolving values.
static XmlSpec createXmlSpec()
          Create an XML specification for the EnsembleChoir class.
 boolean equals(EnsembleEntity other)
          Check if this entity has the same class and content as another entity.
static EnsembleContour fromXmlNode(org.w3c.dom.Element element, ContainerOfChoirsAndContours container)
          Create a new EnsembleContour instance and fill it with loaded data.
 CalculationMode getCalculationMode()
          Get the value of the CalculationMode property.
 ContainerOfChoirsAndContours getContainer()
          Getter for the Container property.
 double getDefaultValue()
           
 int getIndex()
          Get the unique contour identifier.
 double getMaxExpValue()
          The MaxExpValue property is meaningful only if the CalculationMode is LINEAR.
 double getMaxValue()
           
 java.util.SortedMap<java.lang.String,MidiControl> getMidiControls()
           
 double getMinExpValue()
          The MinExpValue property is meaningful only if the CalculationMode is LINEAR.
 double getMinValue()
           
 java.lang.String getPath()
          Return a description of this entity and its containers.
 boolean hasMaxExpValue()
          Test if the contour has a viable maximum for converting linear values to exponential values.
 boolean hasMinExpValue()
          Test if the contour has a viable minimum for converting linear values to exponential values.
 boolean isGenerateRamps()
          Get the flag to generate ramps.
 boolean isMaxExclusive()
           
 boolean isMinExclusive()
           
 void setDefaultValue(double defaultValue)
           
 void setGenerateRamps(boolean generateRamps)
          Set the flag to generate ramps.
 boolean setID(int id)
          Setter for the ID property.
 void setIndex(int index)
          Set the unique contour identifier.
 void setMaxExclusive(boolean maxExclusive)
           
 void setMaxExpValue(double maxExpValue)
          The MaxExpValue property is meaningful only if the CalculationMode is LINEAR.
 void setMaxValue(double maxValue)
          Set the maximum above which segment origins and goals may not ascend.
 void setMinExclusive(boolean minExclusive)
           
 void setMinExpValue(double minExpValue)
          The MinExpValue property is meaningful only if the CalculationMode is LINEAR.
 void setMinValue(double minValue)
           
 boolean setName(java.lang.String name)
          Setter for the Name property.
 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, getEnsemble, logError, predecessor
 
Methods inherited from class net.charlesames.utility.entity.WriteableEntity
check, 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
 

Constructor Detail

EnsembleContour

public EnsembleContour(EnsembleEntity container,
                       java.lang.String name,
                       int id,
                       CalculationMode calculationMode)
Constructor for EnsembleContour instances.

Parameters:
container - Must be a EnsembleChoir.
name - The new contour name. Must not be used by any existing EnsembleContour in the current branch of the ensemble component hierarchy.
id - The new contour id. Must not be used by any existing EnsembleContour in the current branch of the ensemble component hierarchy.
calculationMode - This determines how the value of a contour is calculated at any given ordinate using the contour's segment data.
Method Detail

getContainer

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

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

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.

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.

getIndex

public int getIndex()
Get the unique contour identifier. Unlike the contour id, the contour index is globally unique.

Returns:
The assigned unique contour identifier.

setIndex

public void setIndex(int index)
Set the unique contour identifier. Unlike the contour id, the contour index is globally unique.

Parameters:
index - The intended unique contour identifier.

isGenerateRamps

public boolean isGenerateRamps()
Get the flag to generate ramps. This flag is meaningful only when note-list output is enabled with the NoteListFormat.SOUND format option.

Returns:
True if ramps are to be generated; false otherwise.

setGenerateRamps

public void setGenerateRamps(boolean generateRamps)
Set the flag to generate ramps. This flag is meaningful only when note-list output is enabled with the NoteListFormat.SOUND format option.

Parameters:
generateRamps - True if ramps are to be generated; false 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.

getMinValue

public double getMinValue()
Returns:
The minimum below which segment origins and goals may not descend.

checkMinValue

public void checkMinValue(double value)
Check if the indicated is suitable as a EnsembleContour minimum.

Parameters:
value -

setMinValue

public void setMinValue(double minValue)
Parameters:
minValue - The minimum below which segment origins and goals may not descend.

isMinExclusive

public boolean isMinExclusive()
Returns:
False if segment origins and goals are permitted to equal the minimum value; true otherwise.

setMinExclusive

public void setMinExclusive(boolean minExclusive)
Parameters:
minExclusive - False if segment origins and goals are permitted to reach the minimum value; true otherwise.

getMaxValue

public double getMaxValue()
Returns:
The maximum above which segment origins and goals may not ascend.

checkMaxValue

public void checkMaxValue(double value)
Check if the indicated value is suitable as an EnsembleContour maximum.

Parameters:
value -

setMaxValue

public void setMaxValue(double maxValue)
Set the maximum above which segment origins and goals may not ascend.

Parameters:
maxValue - The intended maximum.

isMaxExclusive

public boolean isMaxExclusive()
Returns:
maxExclusive False if segment origins and goals are permitted to reach the maximum value; true otherwise.

setMaxExclusive

public void setMaxExclusive(boolean maxExclusive)
Parameters:
maxExclusive - False if segment origins and goals are permitted to reach the maximum value; true otherwise.

getMinExpValue

public double getMinExpValue()
The MinExpValue property is meaningful only if the CalculationMode is LINEAR.

Returns:
A lower bound in the exponential range that corresponds the MinValue property in the linear range. Must be positive.

setMinExpValue

public void setMinExpValue(double minExpValue)
The MinExpValue property is meaningful only if the CalculationMode is LINEAR.

Parameters:
minExpValue - A lower bound in the exponential range that corresponds the MinValue property in the linear range. Must be positive.

checkMinExpValue

public void checkMinExpValue(double value)
Check if the indicated value is suitable as an EnsembleContour MinExpValue

Parameters:
value - The indicated value.

getMaxExpValue

public double getMaxExpValue()
The MaxExpValue property is meaningful only if the CalculationMode is LINEAR.

Returns:
An upper bound in the exponential range that corresponds the MaxValue property in the linear range. Must be positive.

setMaxExpValue

public void setMaxExpValue(double maxExpValue)
The MaxExpValue property is meaningful only if the CalculationMode is LINEAR.

Parameters:
maxExpValue - An upper bound in the exponential range that corresponds the MaxValue property in the linear range. Must be positive.

checkMaxExpValue

public void checkMaxExpValue(double value)
Check if the indicated value is suitable as an EnsembleContour MaxExpValue

Parameters:
value - The indicated value.

getDefaultValue

public double getDefaultValue()
Returns:
The value of the contour in the circumstance that now segment has been created.

checkDefaultValue

public void checkDefaultValue(double value)
Check if the indicated value is suitable as an EnsembleContour default.

Parameters:
value - The indicated value.

setDefaultValue

public void setDefaultValue(double defaultValue)
Parameters:
defaultValue - The value of the contour in the circumstance that now segment has been created.

getCalculationMode

public CalculationMode getCalculationMode()
Get the value of the CalculationMode property. The CalculationMode property determines how the value of a contour is calculated at any given ordinate using the contour's segment data.

Returns:
The current CalculationMode value.

getMidiControls

public java.util.SortedMap<java.lang.String,MidiControl> getMidiControls()
Returns:
A collection of MidiControl instances that are bound to this EnsembleContour. The collection is indexed by control type name.

addMidiControl

public MidiControl addMidiControl(TypeOfMidiControl controlType)
Create a new MidiControl instance.

Parameters:
controlType - The new control's type. Must not be used by any existing MidiControl in the current branch of the ensemble component hierarchy.
Returns:
The newly created MidiControl instance.

fromXmlNode

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

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

wipe

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

Overrides:
wipe in class Entity

toString

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

convertsLinearToExponential

public boolean convertsLinearToExponential()
Test if this contour converts linearly-evolving values into exponentially evolving values.

Returns:
True of conversion is configured; false otherwise.

convertLinearToExponential

public double convertLinearToExponential(double value)
Convert a linearly-evolving value to an exponentially evolving value.

Parameters:
value - A value ranging linearly from minValue to maxValue.
Returns:
A value ranging linearly from minExpValue to maxExpValue.

hasMaxExpValue

public boolean hasMaxExpValue()
Test if the contour has a viable maximum for converting linear values to exponential values.

Returns:
True if the contour has a viable maximum for converting linear values to exponential values; false otherwise.

hasMinExpValue

public boolean hasMinExpValue()
Test if the contour has a viable minimum for converting linear values to exponential values.

Returns:
True if the contour has a viable minimum for converting linear values to exponential values; false otherwise.

createXmlSpec

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

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