Class MTree.Visitor

java.lang.Object
eu.bandm.music.entities.MTree.Visitor
Enclosing class:
MTree

public abstract class MTree.Visitor extends Object
Central means for evaluating an MTree. Given an MTree m, execute m.new Visitor(){...}.visit(); The code at "..." must override action(MTree).
  • Field Details

    • currentProportion

      Rational currentProportion
      The factor to apply (at the currently visited node) to the printed duration symbols.
    • lowestBracket

      The most recently recognized bracket when descending.
  • Constructor Details

    • Visitor

      public Visitor()
  • Method Details

    • testCloseBrackets

      protected void testCloseBrackets(Rational when)
      Called for each node to close essential n-plet-brackets, iff their end-of-duration is reached. Ignores vanishing brackets, because they are not in effect when their child nodes are. Reads and alters the global register lowestBracket and writes currentProportion. ATTENTION ASSUME that for each bracket holds: "vanishing implies singleton"
    • visit

      public void visit()
      Entry point for applying the visitor to the node it is an inner instance of.
    • do_visit

      protected void do_visit(MTree mt)
      Internal worker method, called recursively depth first. Sets the current (=innermost) bracket, updates the total proportion and calls the overridden payload method action(MTree).
    • descend

      protected void descend(MTree mt)
    • action

      public abstract void action(MTree mt)
      Payload method to be overridden by user. currentProportion and lowestBracket can be used in the code additionally to the argument "mt".