ReferenceTree
public class ReferenceTree
Mutable Tree structure.
-
Error thrown when doing bad things to a
See moreReferenceTreeobjects.Declaration
Swift
public enum Error : Swift.Error
-
Parent
MutableTree. The root of a tree has no parent.Declaration
Swift
public weak var parent: ReferenceTree? -
Children
MutableTreeobjects.Declaration
Swift
public var children: [ReferenceTree] -
Declaration
Swift
public var isLeaf: Bool { get }Return Value
trueif there are no children. Otherwise,false. -
All leaves.
Declaration
Swift
public var leaves: [ReferenceTree] { get } -
Declaration
Swift
public var isContainer: Bool { get }Return Value
trueif there is at least one child. Otherwise,false. -
Declaration
Swift
public var isRoot: Bool { get }Return Value
trueif there is no parent. Otherwise,false. -
Declaration
Swift
public var root: ReferenceTree { get }Return Value
trueif there is no parent. Otherwise,false. -
Array of all MutableTree objects between (and including)
selfup toroot.Declaration
Swift
public var pathToRoot: [ReferenceTree] { get } -
Height of node.
Declaration
Swift
public var height: Int { get } -
Height of containing tree.
Declaration
Swift
public var heightOfTree: Int { get } -
Depth of node.
Declaration
Swift
public var depth: Int { get }
-
Create a
ReferenceTree.Declaration
Swift
public init(parent: ReferenceTree? = nil, children: [ReferenceTree] = [])
-
Add the given
nodetochildren.Declaration
Swift
public func addChild(_ node: ReferenceTree) -
Append the given
nodestochildren.Declaration
Swift
public func addChildren(_ nodes: [ReferenceTree]) -
Insert the given
nodeat the givenindexofchildren.Declaration
Swift
public func insertChild(_ node: ReferenceTree, at index: Int) throws -
Remove the given
nodefromchildren.Declaration
Swift
public func removeChild(_ node: ReferenceTree) throws -
Remove the node at the given
index.Declaration
Swift
public func removeChild(at index: Int) throws -
Declaration
Swift
public func hasChild(_ child: ReferenceTree) -> BoolReturn Value
trueif the given node is contained herein. Otherwise,false. -
Declaration
Swift
public func child(at index: Int) -> ReferenceTree?Return Value
Child node at the given
index, if present. Otherwise,nil. -
Declaration
Swift
public func leaf(at index: Int) -> ReferenceTree?Return Value
Returns the leaf node at the given
index, if present. Otherwise,nil. -
Declaration
Swift
public func hasLeaf(_ node: ReferenceTree) -> BoolReturn Value
trueif the given node is a leaf. Otherwise,false. -
Declaration
Swift
public func hasAncestor(_ node: ReferenceTree) -> BoolReturn Value
trueif the given node is an ancestor. Otherwise,false. -
Declaration
Swift
public func ancestor(at distance: Int) -> ReferenceTree?Return Value
Ancestor at the given distance, if present. Otherwise,
nil. -
Declaration
Swift
public func hasDescendent(_ node: ReferenceTree) -> BoolReturn Value
trueif the given node is a descendent. Otherwise,false.
View on GitHub
Install in Dash
ReferenceTree Class Reference