Dendograms
Term.Dendograms.Dendogram
Term.Dendograms.Dendogram
Term.Dendograms.Dendogram
Term.Dendograms.Leaf
Term.Dendograms.Leaf
Term.Dendograms.adjust_width
Term.Dendograms.link
Term.Dendograms.replace_line_midpoint
Term.Dendograms.Dendogram
— TypeDendogram <: AbstractRenderable
A Dendogram tree renderable.
Term.Dendograms.Dendogram
— MethodDendogram(head, args::Vector; first_arg=nothing, pretitle=nothing)
Construct a single Dendogram
.
Construct a dendogram with one head node (head
) and any number of leaves.
first_arg
is used to create dendograms for Expr
objects and gives special status to an expression's first argument which gets printed with the head. pretitle
is used to create dendograms for Expr
, pretitle is insrted as three Segment
s (a string and an upward arrow) before the head of the dendogram.
Term.Dendograms.Dendogram
— MethodDendogram(e::Expr; pretitle=nothing)
Create a Dendogram representation for an Expr
. For expressions whose arguments are themselves Expr
objects, dendograms are created recursively. In the end all dendograms are linked using link
to create a single dendogram object (possibly nested).
pretitle
is used to create dendograms for Expr
, pretitle is insrted as three Segment
s (a string and an upward arrow) before the head of the dendogram.
Term.Dendograms.Leaf
— TypeLeaf <: AbstractRenderable
The terminal element of a Dendogram
.
Term.Dendograms.Leaf
— MethodLeaf(leaf)
Construct a Leaf
out of any object.
Term.Dendograms.adjust_width
— Methodadjust_width(x, y)::Int
Width correction factor.
When creating a link between dendograms, the width of the spacing between branches of the dendogram line needs to be adjusted depending on the type (Leaf
or Dendogram
) of the line.
Term.Dendograms.link
— Methodlink(dendos...; title="", shifttitle=false, pretitle=nothing)::Dendogram
Link a variable number of Dendogram
and Leaf
objects in a new Dendogram
.
Create a Dendogram
whose leaves are other leaves and dendograms. This is done carefully to ensure that all spacings are correct and text is aligned as much as possible.
Annoyingly, the code is very similar to that of Dendogram
but different enough that it can't be refactored into single functions.
Term.Dendograms.replace_line_midpoint
— Methodreplace_line_midpoint(line::String; widths=nothing)
Replace the mid character of a dendogram tree line with a vertical line for the title.
If the mid character is also the location of a branch (one of the entries in widths
), then use the appropriate double branching character.