Module hw06

Class Header

java.lang.Object
provided.abcMusic.musicFW.Header
All Implemented Interfaces:
IPhrase

public class Header extends Object implements IPhrase
An abc Header. Headers are identified by a one character "id" and can have an arbitrary string value.
Note that this class represents many different *types* of headers, each with its own id value. ---------------------------------------------- A single Header class represents multiple, distinct header hosts.
  • Field Details

    • _id

      private String _id
      The ID of this header. The case corresponding to this ID is called on the visitors.
    • _value

      private String _value
      the text value of this header.
  • Constructor Details

    • Header

      public Header(String id, String value)
      Create a header out of an id and value
      Parameters:
      id - - one character corresponding to the abc header name
      value - - arbitrary string value of the header
  • Method Details

    • execute

      public Object execute(IPhraseVisitor algo, Object... params)
      Calls the header id'th case of the visitor algo.
      Specified by:
      execute in interface IPhrase
      Parameters:
      algo - The visitor that is being used.
      params - vararg list of input parameters that the algo might use.
      Returns:
      the result of running the id'th case of the visitor.
    • getID

      public String getID()
      Accessor for the id.
      Returns:
      the _id
    • getValue

      public String getValue()
      Accessor for the text value of this header.
      Returns:
      the _value
    • toString

      public String toString()
      String representation of this header: "id: text"
      Overrides:
      toString in class Object