TreeNode<T extends TreeNode<T>> class

通用的树节点抽象表示

Available extensions

Constructors

TreeNode(T? parent, {int maxDeep = -1, int deep = 0, num value = 0})

Properties

childCount int
no setter
childIndex int
自身在父节点中的索引 如果为-1表示没有父节点
no setter
children List<T>
no setter
childrenReverse List<T>
no setter
count int
返回后代节点数 调用该方法前必须先调用 computeCount,否则永远返回0
no setter
deep int
no setter
expand bool
getter/setter pair
firstChild → T
no setter
hasChild bool
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
no setter
isLeaf bool
no setter
lastChild → T
no setter
maxDeep int
整颗树最大的深度
getter/setter pair
notChild bool
no setter
parent ↔ T?
getter/setter pair
position Offset
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
select bool
getter/setter pair
size Size
保存节点大小和位置
getter/setter pair
value double
getter/setter pair
x num
getter/setter pair
y num
getter/setter pair

Methods

add(T node) → void
ancestors() List<T>
返回从当前节点开始的祖先节点
bottom2Top() → void
childAt(int index) → T
clear() → void
computeCount() int
计算当前节点的后代节点数
computeDeep(T node, [int initDeep = 0]) → void
computeHeight(T node, [int initHeight = 0]) → void
计算树的高度
copy(T build(T?, T), [int deep = 0]) → T
从复制当前节点及其后代 复制后的节点没有parent
depthNode(int depth, [bool only = true]) List<T>
从当前节点开始查找深度等于给定深度的节点 广度优先遍历 only==true 只返回对应层次的,否则返回<=
descendants() List<T>
返回其所有后代节点
each(TreeFun<T> callback) → T
eachAfter(TreeFun<T> callback) → T
后序遍历
eachBefore(TreeFun<T> callback) → T
先序遍历
find(TreeFun<T> callback) → T?
在子节点中查找对应节点
findMaxDeep() int
getBoundBox() Rect
iterator() List<T>
返回其后代所有节点(按照拓扑结构)
leafLeft() → T
返回当前节点下最左边的叶子节点
leafRight() → T
leaves() List<T>
返回其所有的叶子结点
返回当前节点的后续的所有Link
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
path(T target) List<T>
返回从当前节点到指定节点的最短路径
remove(T node) → void
removeAt(int i) → T
removeChild(bool filter(T)) → void
removeFirst() → T
removeLast() → T
removeWhere(bool where(T), [bool iterator = false]) → void
resetDeep(int deep, [bool iterator = true]) → void
重新设置深度
right2Left() → void
setExpand(bool e, [bool iterator = true]) → void
sort(int compare(T, T), [bool iterator = true]) → T
sum([num valueCallback(T)?]) → T
计算当前节点值 如果给定了回调,那么将使用给定的回调进行值统计 否则直接使用 _value 统计
toString() String
A string representation of this object.
inherited
translate(num dx, num dy) → void
updateSelectStatus(bool status, {SelectedMode mode = SelectedMode.single}) → void

Available on TreeNode<T>, provided by the TreeNodeExt extension

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

minCommonAncestor<T extends TreeNode<T>>(T a, T b) → T?
返回 节点 a,b的最小公共祖先