public void AddChild( TreeJoint <T> childJoint ) { if (childJoint is null) { throw new ArgumentNullException(nameof(childJoint)); } _children.Add(childJoint); }
public TreeJoint( TreeJoint <T>?parent, T jointPayload ) { if (jointPayload is null) { throw new ArgumentNullException(nameof(jointPayload)); } Parent = parent; JointPayload = jointPayload; _children = new List <TreeJoint <T> >(); }
public bool TryFindInItsParents( Func <T, bool> predicate, [NotNullWhen(true)] out TreeJoint <T>?foundJoint ) { if (predicate is null) { throw new ArgumentNullException(nameof(predicate)); } if (Parent is null) { foundJoint = null; return(false); } return(Parent.TryFindInThisAndItsParents(predicate, out foundJoint)); }