HierarchyNode<T> class
final
Hierarchies
A hierarchy node holds data, it can be linked to a parent if it is not a root, as well as to children if it is not a leaf.
- Inheritance
-
- Object
- Iterable<
HierarchyNode< T> > - HierarchyNode
Constructors
- HierarchyNode(T data)
Properties
-
children
↔ List<
HierarchyNode< ?T> > -
An list of child nodes, if any, or null for leaves.
getter/setter pairinherited
- data ↔ T
-
Hierarchical data.
getter/setter pairinherited
- depth ↔ int
-
Zero for the root, increasing by one for each descendant generation.
getter/setter pairinherited
-
first
→ HierarchyNode<
T> -
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ int
-
The greatest distance from any descendant leaf, or zero for leaves.
getter/setter pairinherited
- id ↔ String?
-
getter/setter pairinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
HierarchyNode< T> > -
A new iterator over the node’s descendants in breadth-first order.
no setter
-
last
→ HierarchyNode<
T> -
The last element.
no setterinherited
- length → int
-
The number of elements in this Iterable.
no setterinherited
-
parent
↔ HierarchyNode<
T> ? -
The parent node, or null for the root node.
getter/setter pairinherited
- parentId ↔ String?
-
getter/setter pairinherited
- r ↔ num?
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
single
→ HierarchyNode<
T> -
Checks that this iterable has only one element, and returns that element.
no setterinherited
-
squarify
↔ Squarify<
T> ? -
getter/setter pairinherited
- value ↔ num?
-
The optional summed value of the node and its
descendants
.getter/setter pairinherited - x ↔ num?
-
getter/setter pairinherited
- x0 ↔ num?
-
getter/setter pairinherited
- x1 ↔ num?
-
getter/setter pairinherited
- y ↔ num?
-
getter/setter pairinherited
- y0 ↔ num?
-
getter/setter pairinherited
- y1 ↔ num?
-
getter/setter pairinherited
Methods
-
ancestors(
) → List< HierarchyNode< T> > - Returns the list of ancestors nodes, starting with this node, then followed by each parent up to the root.
-
any(
bool test(HierarchyNode< T> element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.inherited -
copy(
) → HierarchyNode< T> - Return a deep copy of the subtree starting at this node. (The returned deep copy shares the same data, however.)
-
count(
) → void - Computes the number of leaves under this node and assigns it to node.value, and similarly for every descendant of node.
-
descendants(
) → List< HierarchyNode< T> > - Returns the list of descendant nodes, starting with this node, then followed by each child in topological order.
-
each(
void function(HierarchyNode< T> , int, HierarchyNode<T> , [Object?]), [Object? that]) → void -
Invokes the specified
function
for node and each descendant in breadth-first order, such that a given node is only visited if all nodes of lesser depth have already been visited, as well as all preceding nodes of the same depth. -
eachAfter(
void function(HierarchyNode< T> , int, HierarchyNode<T> , [Object?]), [Object? that]) → void -
Invokes the specified
function
for node and each descendant in post-order traversal, such that a given node is only visited after all of its descendants have already been visited. -
eachBefore(
void function(HierarchyNode< T> , int, HierarchyNode<T> , [Object?]), [Object? that]) → void -
Invokes the specified
function
for node and each descendant in pre-order traversal, such that a given node is only visited after all of its ancestors have already been visited. -
elementAt(
int index) → HierarchyNode< T> -
Returns the
index
th element.inherited -
every(
bool test(HierarchyNode< T> element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> toElements(HierarchyNode<T> element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
find(
bool filter(HierarchyNode< T> , int, HierarchyNode<T> , [Object?]), [Object? that]) → HierarchyNode<T> ? -
Returns the first node in the hierarchy from this node for which the
specified
filter
returns a truthy value. Returns null if no such node is found. -
firstWhere(
bool test(HierarchyNode< T> element), {HierarchyNode<T> orElse()?}) → HierarchyNode<T> -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, HierarchyNode< T> element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< HierarchyNode< other) → Iterable<T> >HierarchyNode< T> > -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(HierarchyNode< T> element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(HierarchyNode< T> element), {HierarchyNode<T> orElse()?}) → HierarchyNode<T> -
The last element that satisfies the given predicate
test
.inherited -
leaves(
) → List< HierarchyNode< T> > - Returns the list of leaf nodes in traversal order. A leaf is a node with no children.
-
links(
) → List< Map< String, HierarchyNode< >T> > - Returns an list of links for this node and its descendants, where each link is an map that defines source and target properties. The source of each link is the parent node, and the target is a child node.
-
map<
T> (T toElement(HierarchyNode< T> e)) → Iterable<T> -
The current elements of this iterable modified by
toElement
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
path(
HierarchyNode< T> target) → List<HierarchyNode< T> > - Returns the shortest path through the hierarchy from this node to the specified target node.
-
reduce(
HierarchyNode< T> combine(HierarchyNode<T> value, HierarchyNode<T> element)) → HierarchyNode<T> -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
singleWhere(
bool test(HierarchyNode< T> element), {HierarchyNode<T> orElse()?}) → HierarchyNode<T> -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< HierarchyNode< T> > -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(HierarchyNode< T> value)) → Iterable<HierarchyNode< T> > -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
sort(
int compare(HierarchyNode< T> , HierarchyNode<T> )) → void -
Sorts the children of this node, if any, and each of this node’s
descendants’ children, in
pre-order traversal
using the specified
compare
function. -
sum(
num? value(T)) → void -
Evaluates the specified
value
function for this node and each descendant in post-order traversal. -
take(
int count) → Iterable< HierarchyNode< T> > -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(HierarchyNode< T> value)) → Iterable<HierarchyNode< T> > -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< HierarchyNode< T> > -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< HierarchyNode< T> > -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this
.inherited -
where(
bool test(HierarchyNode< T> element)) → Iterable<HierarchyNode< T> > -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited