TreeList
public struct TreeList<Value>
extension TreeList: ExpressibleByArrayLiteral
extension TreeList: MutableCollection, BidirectionalCollection
extension TreeList: Equatable where Value: Equatable
extension TreeList: Hashable where Value: Hashable
extension TreeList: CustomStringConvertible where Value: CustomStringConvertible
Undocumented
-
Undocumented
Declaration
Swift
public var nodes: [TreeNode<Value>] -
Undocumented
Declaration
Swift
public init(_ nodes: [TreeNode<Value>]) -
Declaration
Swift
public init(arrayLiteral elements: TreeNode<Value>...) -
Declaration
Swift
public typealias Element = TreeNode<Value> -
Declaration
Swift
public typealias Index = TreeIndex -
Declaration
Swift
public var startIndex: TreeIndex { get } -
Declaration
Swift
public var endIndex: TreeIndex { get } -
Declaration
Swift
public var count: Int { get } -
Declaration
Swift
public var underestimatedCount: Int { get } -
Undocumented
Declaration
Swift
public init() -
Undocumented
Declaration
Swift
public mutating func removeSubrange(_ bounds: Range<TreeIndex>) -
Undocumented
Declaration
Swift
public func depth(of i: TreeIndex) -> Int -
Undocumented
Declaration
Swift
public func childIndex(of i: TreeIndex) -> Int -
Undocumented
Declaration
Swift
public func canInsert(at i: TreeIndex) -> Bool -
Undocumented
Declaration
Swift
public func mapValues<NewValue>(_ transform: (Value) -> NewValue) -> TreeList<NewValue> -
Undocumented
Declaration
Swift
public func mapValuesWithNode<NewValue>(_ transform: (TreeNode<Value>) -> NewValue) -> TreeList<NewValue> -
Undocumented
Declaration
Swift
public func mapValuesWithParents<NewValue>(_ transform: ([Value], Value) -> NewValue) -> TreeList<NewValue> -
Undocumented
Declaration
Swift
public func mapChildrenWithParent<NewValue>(_ transform: (Value?, [Value]) -> NewValue) -> [NewValue] -
Undocumented
Declaration
Swift
public func mapChildrenWithParents<NewValue>( _ transform: (_ parents: [Value], _ children: [Value]) -> NewValue ) -> [NewValue]
-
Undocumented
Declaration
Swift
public func compactMapValues<NewValue>(_ transform: (Value) -> NewValue?) -> TreeList<NewValue>
-
Undocumented
Declaration
Swift
public func filterValues(_ isIncluded: (Value) -> Bool) -> TreeList<Value>
-
Undocumented
Declaration
Swift
public mutating func removeAll(where shouldBeRemoved: (TreeNode<Value>) -> Bool)
-
Declaration
Swift
public var description: String { get }
-
Moves the TreeNodes at the given
sourceIndicestoinsertIndex. ThesourceIndicesandinsertIndexare both specified in the before state of the tree. If elements are removed before theinsertIndex, theinsertIndexwill be adjusted.The move operation will fail and return nil, if the
insertIndexis a child of one of the moved TreeNodes.Declaration
Parameters
sourceIndicesthe indices of the elements that should be moved
insertIndexthe insertion index to move the elements to
Return Value
A new Tree with the specified changes or nil if the the move was not possible
-
Undocumented
Declaration
Swift
public func difference(from old: `Self`) -> TreeDifference<Value> -
Undocumented
Declaration
Swift
public func applying(_ diff: TreeDifference<Value>) -> `Self`?
TreeList Structure Reference