Module hw06

Class Triplet

All Implemented Interfaces:
INote, IPhrase

public class Triplet extends NoteCollection
A musical triplet. The three notes should be played with 2/3 of their indicated duration. ---------------------------------------------- A set of 3 notes played in sequence in a special manner.
  • Field Details

  • Constructor Details

    • Triplet

      public Triplet(Note n1, Note n2, Note n3)
      Create a new Note out of three notes
      Parameters:
      n1 - the first note in the triplet
      n2 - the second note in the triplet
      n3 - the third note in the triplet
  • Method Details

    • execute

      public Object execute(IPhraseVisitor algo, Object... params)
      Calls the Triplet.ID case of the visitor
      Parameters:
      algo - the visitor being used
      params - vararg list of parameters for use by the visitor
      Returns:
      the result of the "Triplet" case of the visitor.
    • toString

      public String toString()
      Return string representation of the triplet
      Overrides:
      toString in class Object
      Returns:
      "Triplet(n1, n2, n3)"