/// <summary> /// Returns all IPronoun constructs in the collection that refer to any entity matching the given test entity selector. /// </summary> /// <typeparam name="T">Any Type which implements the IPronoun interface.</typeparam> /// <param name="referencers">The sequence of IPronoun elements to filter.</param> /// <param name="predicate">The function which tests the referenced entity of each IPronoun to determine if the IPronoun should be selected.</param> /// <returns>All IPronoun constructs in the collection that refer to the given entity</returns> public static ParallelQuery <T> Referencing <T>(this ParallelQuery <T> referencers, Func <IEntity, bool> predicate) where T : IReferencer => referencers.Referencing().Where(referencer => predicate(referencer.RefersTo) || referencer.RefersTo.Any(predicate));
/// <summary> /// Returns all IPronouns constructs in the collection that refer to the given entity. /// </summary> /// <typeparam name="T">Any Type which implements the IPronoun interface.</typeparam> /// <param name="referencers">The sequence of IPronoun elements to filter.</param> /// <param name="referenced">The entity whose referencing pronouns will be returned.</param> /// <returns>All Pronouns in the collection that refer to the given entity</returns> public static ParallelQuery <T> Referencing <T>(this ParallelQuery <T> referencers, IEntity referenced) where T : IReferencer => referencers.Referencing().Where(referencer => referencer.RefersTo == referenced || referencer.RefersTo.Any(entity => entity == referenced));