Module hw06

Class Chord

All Implemented Interfaces:
INote, IPhrase

public class Chord extends NoteCollection
A collection of notes that make up a Chord. All of the notes should be played simultaneously. The last note defines the length of all the notes. ---------------------------------------------- A collection of Notes all played at once
  • Field Details

  • Constructor Details

    • Chord

      public Chord(Note... notes)
      Create a Chord out of a collection of notes.
      Parameters:
      notes - vararg list of notes used in the chord.
  • Method Details

    • execute

      public Object execute(IPhraseVisitor algo, Object... params)
      Calls the Chord.ID case of the given algo.
      Parameters:
      algo - The IPhraseVisitor algo to use.
      params - vararg list of input parameters
      Returns:
      the result of running the Chord case of the visitor.
    • toString

      public String toString()
      Returns a string representation of the chord: "(noteA, noteB, ...)"
      Overrides:
      toString in class Object
      Returns:
      string representation of the chord