public static ImplicitCombiner CombinerFromXElement(ImplicitXmlChain chain, XElement xElement) { var combinerTypeString = (xElement.Attribute("combiner_type") != null ? xElement.Attribute("combiner_type").Value : String.Empty); ImplicitCombiner combiner; switch (combinerTypeString.ToLower()) { case "add": combiner = new ImplicitCombiner(CombinerType.Add); break; case "average": combiner = new ImplicitCombiner(CombinerType.Average); break; case "max": combiner = new ImplicitCombiner(CombinerType.Max); break; case "min": combiner = new ImplicitCombiner(CombinerType.Min); break; case "multiply": combiner = new ImplicitCombiner(CombinerType.Multiply); break; default: throw new InvalidOperationException("Invalid combiner_type."); } foreach (var source in xElement.Elements("source")) { combiner.AddSource(chain.Modules[source.Value]); } return(combiner); }
public static ImplicitCombiner CombinerFromXElement(ImplicitXmlChain chain, XElement xElement) { var combinerTypeString = (xElement.Attribute("combiner_type") != null ? xElement.Attribute("combiner_type").Value : String.Empty); ImplicitCombiner combiner; switch (combinerTypeString.ToLower()) { case "add": combiner = new ImplicitCombiner(CombinerType.Add); break; case "average": combiner = new ImplicitCombiner(CombinerType.Average); break; case "max": combiner = new ImplicitCombiner(CombinerType.Max); break; case "min": combiner = new ImplicitCombiner(CombinerType.Min); break; case "multiply": combiner = new ImplicitCombiner(CombinerType.Multiply); break; default: throw new InvalidOperationException("Invalid combiner_type."); } foreach (var source in xElement.Elements("source")) { combiner.AddSource(chain.Modules[source.Value]); } return combiner; }