net.charlesames.music.musicxml
Class Attributes

java.lang.Object
  extended by net.charlesames.utility.common.Disposable
      extended by net.charlesames.music.musicxml.MusicXmlEntity
          extended by net.charlesames.music.musicxml.TimedEvent
              extended by net.charlesames.music.musicxml.Attributes

public class Attributes
extends TimedEvent

The Attributes class implements the MusicXML <attributes> element.

Author:
Charles Ames

Method Summary
 Clef addClef(int number, Clef.ClefSign sign, int line, int octave)
          Add a new instance to the Clef collection.
 void dispose()
          Release resources engaged by this object, thus rendering it amenable to garbage collection.
 boolean equals(MusicXmlEntity other)
          Test if this MusicXML entity has the same content as another object.
static Attributes fromXmlNode(org.w3c.dom.Element element, Measure container)
          Create a new Attributes instance and fill it with loaded data.
 java.util.SortedMap<java.lang.Integer,Clef> getClefList()
          Get the list of clefs.
 int getDivisions()
          Getter for the Divisions property.
static Attributes getInstance(MusicXmlEntity container)
          Create a new Attributes instance.
 KeySignature getKeySignature()
          Getter for the KeySignature property.
 int getStaves()
          Getter for the Staves property.
 TimeSignature getTimeSignature()
          Getter for the TimeSignature property.
 void putXmlData(org.w3c.dom.Element element)
           
 void setDivisions(int divisions)
          Setter for the Divisions property
 void setKeySignature(KeySignature keySignature)
          Setter for the KeySignature property.
 void setStaves(int staves)
          Setter for the Staves property
 void setTimeSignature(TimeSignature timeSignature)
          Setter for the TimeSignature property.
 org.w3c.dom.Node toXmlNode(org.w3c.dom.Node parent)
          Serialize the content of a MusicXML entity into an XML element.
 
Methods inherited from class net.charlesames.music.musicxml.TimedEvent
getComment, getDefaultX, getDuration, getTime, isInChord, setComment, setDefaultX, setTime
 
Methods inherited from class net.charlesames.music.musicxml.MusicXmlEntity
getContainer, makeDirty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dispose

public void dispose()
Description copied from class: Disposable
Release resources engaged by this object, thus rendering it amenable to garbage collection.

Overrides:
dispose in class TimedEvent

getInstance

public static Attributes getInstance(MusicXmlEntity container)
Create a new Attributes instance.

Parameters:
container - The MusicXmlEntity which will contain the new Attributes instance.
Returns:
The newly created Attributes instance.

getDivisions

public int getDivisions()
Getter for the Divisions property.

Returns:
The current Divisions value;

setDivisions

public void setDivisions(int divisions)
Setter for the Divisions property

Parameters:
divisions - The intended Divisions value.

getStaves

public int getStaves()
Getter for the Staves property.

Returns:
The current Staves value.

setStaves

public void setStaves(int staves)
Setter for the Staves property

Parameters:
staves - The intended Staves value.

getKeySignature

public KeySignature getKeySignature()
Getter for the KeySignature property.

Returns:
The current KeySignature value.

setKeySignature

public void setKeySignature(KeySignature keySignature)
Setter for the KeySignature property.

Parameters:
keySignature - The intended KeySignature value.

getTimeSignature

public TimeSignature getTimeSignature()
Getter for the TimeSignature property.

Returns:
The current TimeSignature value.

setTimeSignature

public void setTimeSignature(TimeSignature timeSignature)
Setter for the TimeSignature property.

Parameters:
timeSignature - The intended TimeSignature value.

getClefList

public java.util.SortedMap<java.lang.Integer,Clef> getClefList()
Get the list of clefs.

Returns:
A collection of Clef instances, indexed by staff number.

addClef

public Clef addClef(int number,
                    Clef.ClefSign sign,
                    int line,
                    int octave)
Add a new instance to the Clef collection.

Parameters:
number - The staff number.
sign - The sign: G, F, C, percussion, TAB, none
line - The position of the clef on the staff.
octave - The octave displacement.
Returns:
The newly created Clef instance.

fromXmlNode

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

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

toXmlNode

public org.w3c.dom.Node toXmlNode(org.w3c.dom.Node parent)
Description copied from class: MusicXmlEntity
Serialize the content of a MusicXML entity into an XML element.

Specified by:
toXmlNode in class MusicXmlEntity
Parameters:
parent - The XML element which is to receive the data.
Returns:
The newly created XML element.

putXmlData

public void putXmlData(org.w3c.dom.Element element)
Overrides:
putXmlData in class TimedEvent

equals

public boolean equals(MusicXmlEntity other)
Description copied from class: MusicXmlEntity
Test if this MusicXML entity has the same content as another object.

Overrides:
equals in class TimedEvent
Parameters:
other - The other object.
Returns:
True if both objects have the same content; false otherwise.