public static LearningAlgorithm GetAlgorithm(string name, GetterParameter par) { switch (par) { case GetterParameter.AlgorithmName: foreach (Type item in typesOfLA) { LearningAlgorithm la = (LearningAlgorithm)Activator.CreateInstance(item); if (String.Compare(la.Name, name) == 0) { return(la); } } throw new Exception("Invalid topology name"); case GetterParameter.TypeOfAlgorithmName: foreach (Type item in typesOfLA) { if (String.Compare(item.Name, name) == 0) { return((LearningAlgorithm)Activator.CreateInstance(item)); } } throw new Exception("Invalid topology type name"); default: throw new Exception("Invalid mode"); } }
public static string GetNameOfTypeOfAlgoritm(string nameLA) { foreach (Type item in typesOfLA) { LearningAlgorithm la = (LearningAlgorithm)Activator.CreateInstance(item); if (String.Compare(la.Name, nameLA) == 0) { return(item.Name); } } throw new Exception("Invalid topology name"); }