Class Chord


  • public class Chord
    extends java.lang.Object
    A class that defines a Chord object. A chord is either given by a set of notes that it contains, or a name. In the latter case, the notes contained by the chord can be retrieved by a local library, currently defined in MusicSpecs.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (ilgea)
    • Constructor Summary

      Constructors 
      Constructor Description
      Chord()
      Construct an empty Chord with no chord tones.
      Chord​(java.lang.String name, double duration)
      Construct a chord with a name and a duration.
      Chord​(java.util.Set<Note> chordTones)
      Construct a chord by a set of note objects.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addNote​(Note n)
      Add a note to this chord.
      double getDuration()
      Get the duration of this Chord.
      java.lang.String getName()
      Get name of this Chord.
      java.util.Set<Note> getNotes()
      Get notes contained by this Chord.
      void setChordTones()
      Set the notes contained by this chord by a dictionary lookup.
      void setChordTones​(java.lang.String chord)
      Set the notes contained by this chord, by name reference.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Chord

        public Chord​(java.lang.String name,
                     double duration)
        Construct a chord with a name and a duration.
        Parameters:
        name - Chord name
        duration - Chord duration
      • Chord

        public Chord​(java.util.Set<Note> chordTones)
        Construct a chord by a set of note objects.
        Parameters:
        chordTones - a Set of notes that are a part of the specified Chord.
      • Chord

        public Chord()
        Construct an empty Chord with no chord tones.
    • Method Detail

      • addNote

        public void addNote​(Note n)
        Add a note to this chord.
        Parameters:
        n - Note to be added
      • getNotes

        public java.util.Set<Note> getNotes()
        Get notes contained by this Chord.
        Returns:
        the Set of chord tones contained by this chord
      • getDuration

        public double getDuration()
        Get the duration of this Chord.
        Returns:
        duration of chord
      • getName

        public java.lang.String getName()
        Get name of this Chord.
        Returns:
        Chord name
      • setChordTones

        public void setChordTones​(java.lang.String chord)
        Set the notes contained by this chord, by name reference.
        Parameters:
        chord - The chord name