Example #1
0
        public static IEnumerable <Type> GetKnownTypes()
        {
            IEnumerable <Type> knownTypes = AlgorithmBase.GetKnownTypes();

            knownTypes.Concat(CompositeAlgorithm.GetKnownTypes());
            return(knownTypes);
        }
Example #2
0
        public override object Clone()
        {
            var rtn = new CompositeAlgorithm();

            rtn.Algorithms.AddRange(this.Algorithms.Select(alg => (IAlgorithm)alg.Clone()));
            rtn.CompositeName = this.CompositeName;

            return(rtn);
        }
Example #3
0
        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);
        }
Example #4
0
        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());
        }