/// <summary> /// Finds all outputs of computations of from the specified source type to the specified target type that match the given filter /// </summary> /// <param name="trace">The trace component that is used as basis</param> /// <typeparam name="TOut">The output type of the transformation rule</typeparam> /// <param name="filter">The filter that should be applied to the transformation outputs</param> /// <param name="inputTypes">The input types for the transformation rule</param> /// <returns>A collection with all suitable outputs</returns> public static IEnumerable <TOut> FindWhere <TOut>(this ITransformationTrace trace, Type[] inputTypes, Predicate <TOut> filter) where TOut : class { if (trace == null) { throw new ArgumentNullException("trace"); } return(trace.TraceAll(inputTypes, typeof(TOut)).Select(c => c.Output as TOut).Where(o => filter == null || filter(o))); }
public static IEnumerable <TOut> FindAll <TIn, TOut>(this ITransformationTrace trace) where TOut : class where TIn : class { if (trace == null) { throw new ArgumentNullException("trace"); } return(trace.TraceAll(new Type[] { typeof(TIn) }, typeof(TOut)).Select(c => c.Output as TOut)); }
/// <summary> /// Trace the output of the computation that transformed any input that matches the filter with the given transformation type /// </summary> /// <param name="trace">The trace component that is used as basis</param> /// <typeparam name="TOut">The output that is returned by the transformation rule</typeparam> /// <returns>All outputs of computations</returns> /// <param name="inputTypes">The input types of the trace request</param> public static IEnumerable <TOut> FindAll <TOut>(this ITransformationTrace trace, Type[] inputTypes) where TOut : class { if (trace == null) { throw new ArgumentNullException("trace"); } return(from Computation c in trace.TraceAll(inputTypes, typeof(TOut)) select c.Output as TOut); }
public static IEnumerable <TOut> ResolveWhere <TOut>(this ITransformationTrace trace, Type[] inputTypes, Predicate <object[]> filter) where TOut : class { if (trace == null) { throw new ArgumentNullException("trace"); } return(from ITraceEntry c in trace.TraceAll(inputTypes, typeof(TOut)) where filter == null || filter(c.CreateInputArray()) select c.Output as TOut); }
public static IEnumerable <TOut> ResolveWhere <TIn, TOut>(this ITransformationTrace trace, Predicate <TIn> filter) where TIn : class where TOut : class { if (trace == null) { throw new ArgumentNullException("trace"); } return(from ITraceEntry c in trace.TraceAll(new Type[] { typeof(TIn) }, typeof(TOut)) where filter == null || filter(c.GetInput(0) as TIn) select c.Output as TOut); }
/// <summary> /// Trace the output of the computation that transformed any input that matches the filter with the given transformation type /// </summary> /// <param name="trace">The trace component that is used as basis</param> /// <param name="filter">The filter that should filter the inputs</param> /// <returns>All outputs of computations with suitable input arguments or null, if there are none</returns> public static IEnumerable <TOut> ResolveWhere <TIn1, TIn2, TOut>(this ITransformationTrace trace, Func <TIn1, TIn2, bool> filter) where TIn1 : class where TIn2 : class where TOut : class { if (trace == null) { throw new ArgumentNullException("trace"); } Type[] types = { typeof(TIn1), typeof(TIn2) }; return(from Computation c in trace.TraceAll(types, typeof(TOut)) where (filter == null || filter(c.GetInput(0) as TIn1, c.GetInput(1) as TIn2)) select c.Output as TOut); }