Printing Protocol

The protocol for delegating how a graphtage.TreeNode or graphtage.Edit is printed in graphtage.GraphtageFormatter.print() is as follows:

  1. Determine the actual object to be printed:
    • If node_or_edit is an graphtage.Edit:
    • If node_or_edit is a graphtage.TreeNode:
      • If with_edits and the node is edited and has a non-zero cost,

        then choose node_or_edit.edit:

        node_or_edit.edit is not None and node_or_edit.edit.bounds().lower_bound > 0
        
      • Otherwise choose node_or_edit

  2. If the chosen object is an edit:
  3. If the chosen object is a node, or if we failed to find a printer for the edit:

This is implemented in graphtage.GraphtageFormatter.print(). See the Formatting Protocol for how formatters are chosen.