using System; using System.Collections.Generic; using System.Linq; namespace Terminal.Gui { /// /// Abstract implementation of . /// public abstract class TreeBuilder : ITreeBuilder { /// public bool SupportsCanExpand { get; protected set; } = false; /// /// Override this method to return a rapid answer as to whether /// returns results. If you are implementing this method ensure you passed true in base /// constructor or set /// /// /// public virtual bool CanExpand (T toExpand) { return GetChildren (toExpand).Any (); } /// public abstract IEnumerable GetChildren (T forObject); /// /// Constructs base and initializes /// /// Pass true if you intend to /// implement otherwise false public TreeBuilder (bool supportsCanExpand) { SupportsCanExpand = supportsCanExpand; } } }