public static IEnumerable <Type> GetKnownTypes() { IEnumerable <Type> knownTypes = AlgorithmBase.GetKnownTypes(); knownTypes.Concat(CompositeAlgorithm.GetKnownTypes()); return(knownTypes); }
public override object Clone() { var rtn = new CompositeAlgorithm(); rtn.Algorithms.AddRange(this.Algorithms.Select(alg => (IAlgorithm)alg.Clone())); rtn.CompositeName = this.CompositeName; return(rtn); }
public override IAlgorithm CreateInstance() { CompositeAlgorithm alg = AlgorithmPluginEnumerator.GetAlgorithm(Type.ConvertToType(true)) as CompositeAlgorithm; if (alg == null) { throw new Exception("Failed to create composite algorithm from composite algorithm info"); } alg.Algorithms = new AlgorithmList(); alg.Algorithms.AddRange(this.Algorithms.Select(info => info.ToInstance())); alg.CompositeName = this.CompositeName; return(alg); }
public static AlgorithmInfo ToInfo(this IAlgorithm alg) { CompositeAlgorithm composite = alg as CompositeAlgorithm; if (composite != null) { return(composite.ToInfo()); } AlgorithmBase algBase = alg as AlgorithmBase; if (algBase == null) { throw new Exception("Failed to derive Base implementation for IAlgorithm"); } return(algBase.ToInfo()); }