Here are the examples of the csharp api class Code.FinancialDesignPatterns.IConsumer.Match(Code.FinancialDesignPatterns.Matchable) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Example
0
1. Example
View licensepublic MatchResult<TFact, TConsumption> Match2<TFact, TConsumption>( IEnumerable<TFact> input, IEnumerable<IConsumer<TFact, TConsumption>> consumers, ConsumptionAdder<TConsumption> consumptionAdder) { var scaffolding = input.Select(x => new Matchable<TFact, TConsumption>(x, consumptionAdder)).ToList(); var result = new MatchResult<TFact,TConsumption>(); var toProcess = scaffolding; foreach (var consumer in consumers) { if (!toProcess.Any()) { result.Consumers[ConsumerStatus.Active].Add(consumer); continue; } bool consumerCompleted = toProcess .Select(element => consumer.Match(element)) .Any(status => status == ConsumerStatus.Complete); if (consumerCompleted) result.Consumers[ConsumerStatus.Complete].Add(consumer); toProcess = toProcess.Where(x => !x.IsFullyConsumed).ToList(); } // return all elements result.Matches = scaffolding; //result.ConsumerInfo = scaffolding. // TODO return result; }