コード例 #1
0
 /// <summary>
 /// Finds all nodes of a certain type containing one or more components matching the specified type and a given search predicate within a tree of nodes.
 /// </summary>
 /// <typeparam name="TNode">The type of the nodes to search in.</typeparam>
 /// <typeparam name="TComponent">The type of the components to look for.</typeparam>
 /// <param name="root">The root node where to start the search.</param>
 /// <param name="match">The search predicate. Typically specified as a Lambda expression.</param>
 /// <returns>
 /// All nodes of the specified type containing components matching both, type and predicate.
 /// </returns>
 public static IEnumerable <TNode> FindNodesWhereComponent <TNode, TComponent>(this SceneNodeContainer root, Predicate <TComponent> match)
     where TNode : SceneNodeContainer
     where TComponent : SceneComponentContainer
 {
     return(new SceneNodeWhereComponentEnumerable <TNode, TComponent> {
         _match = match, _rootList = SceneVisitorHelpers.SingleRootEnumerator(root)
     });
 }
コード例 #2
0
 /// <summary>
 /// Performs a <see cref="Viserator{TItem,TState}"/> action on the specified tree.
 /// </summary>
 /// <typeparam name="TViserator">The type of the viserator.</typeparam>
 /// <typeparam name="TResult">The type of the elements resulting from the Viserate traversal.</typeparam>
 /// <param name="root">The root where to start the traversal.</param>
 /// <returns>All items yielded from within the traversal (see <see cref="ViseratorBase{TItem}.YieldItem"/>).</returns>
 public static IEnumerable <TResult> Viserate <TViserator, TResult>(this SceneNodeContainer root) where TViserator : ViseratorBase <TResult>, new()
 {
     return(new ViseratorEnumerable <TViserator, TResult> {
         _rootList = SceneVisitorHelpers.SingleRootEnumerator(root)
     });
 }
コード例 #3
0
 /// <summary>
 /// Finds nodes of a certain type and matching the given search predicate within a tree of nodes.
 /// </summary>
 /// <typeparam name="TNode">The type of nodes to find.</typeparam>
 /// <param name="root">The root node where to start the search.</param>
 /// <param name="match">The search predicate. Typically specified as a Lambda expression.</param>
 /// <returns>All nodes of the specified type matching the predicate.</returns>
 public static IEnumerable <TNode> FindNodes <TNode>(this SceneNodeContainer root, Predicate <TNode> match) where TNode : SceneNodeContainer
 {
     return(new SceneNodeEnumerable <TNode> {
         _match = match, _rootList = SceneVisitorHelpers.SingleRootEnumerator(root)
     });
 }
コード例 #4
0
 /// <summary>
 /// Finds all nodes containing one or more components matching a given search predicate within a tree of nodes.
 /// </summary>
 /// <param name="root">The root node where to start the search.</param>
 /// <param name="match">The search predicate. Typically specified as a Lambda expression.</param>
 /// <returns>All nodes containing matching components.</returns>
 public static IEnumerable <SceneNodeContainer> FindNodesWhereComponent(this SceneNodeContainer root, Predicate <SceneComponentContainer> match)
 {
     return(new SceneNodeWhereComponentEnumerable <SceneNodeContainer, SceneComponentContainer> {
         _match = match, _rootList = SceneVisitorHelpers.SingleRootEnumerator(root)
     });
 }