A bridge node in a tree structure which connects to another structure.
Exception thrown if a TreeRelation
operation tries to use a node that
is not in the tree to which the relation applies.
Exception thrown if a TreeRelation
operation tries to use a node that
is not in the tree to which the relation applies.
For the time-being, the exception does not indicate which tree is involved because it's not clear how to identify the tree briefly in a short message. The stack trace that accompanies the exception should be sufficient.
A binary relation between values of type T
and values of type U
.
A binary relation between values of type T
and values of type U
.
Constructed from a vector of pairs that constitute the relation's
graph.
Interface for factories that can create relations.
Interface for factories that can create relations. Repr
is the
representation type of the relations that the factory produces.
A template trait for Relation-like types.
A template trait for Relation-like types. T
and U
are the domain
and range types of the relation, respectively. Repr
is the type
constructor for the concrete representation of a particular relation
type.
Relational representations of trees built out of hierarchical Product
instances.
Relational representations of trees built out of hierarchical Product
instances. Typically, the nodes are instances of case classes.
The type T
is the common base type of the tree nodes. The type R
is a
sub-type of T
that is the type of the root node.
The originalRoot
value should be the root of a finite, acyclic structure
that contains only Product
instances of type T
(unless they are skipped,
see below). If the structure reachable from originalRoot
is actually a tree
(i.e., contains no shared nodes) then the field root
will be the same as
originalRoot
.
On the other hand, if the structure contains shared nodes, then root
will
be the root of a new structure which duplicates the original structure but
removes the sharing. In other words, shared nodes will be copied.
The child
relation of a tree is defined to skip certain nodes.
Specifically, if a node of type T
is wrapped in a Some
of an option,
a Left
or Right
of an Either
, a tuple up to size four, or a
TraversableOnce
, then those wrappers are ignored. E.g., if t1
is Some (t2)
where both t1
and t2
are of type T
, then t1
will be t2
's parent, not the Some
value.
Thanks to Len Hamey for the idea to use lazy cloning to restore the tree structure instead of requiring that the input trees contain no sharing.
Factory for binary relations.
Companion object for trees.
A bridge node in a tree structure which connects to another structure. Bridges are not traversed when determining the tree structure.