forked from giacomelli/GeneticSharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCrossoverService.cs
More file actions
52 lines (48 loc) · 1.71 KB
/
CrossoverService.cs
File metadata and controls
52 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
namespace GeneticSharp
{
/// <summary>
/// Crossover service.
/// </summary>
public static class CrossoverService
{
#region Methods
/// <summary>
/// Gets available crossover types.
/// </summary>
/// <returns>All available crossover types.</returns>
public static IList<Type> GetCrossoverTypes()
{
return TypeHelper.GetTypesByInterface<ICrossover>();
}
/// <summary>
/// Gets the available crossover names.
/// </summary>
/// <returns>The crossover names.</returns>
public static IList<string> GetCrossoverNames()
{
return TypeHelper.GetDisplayNamesByInterface<ICrossover>();
}
/// <summary>
/// Creates the ICrossover's implementation with the specified name.
/// </summary>
/// <returns>The crossover implementation instance.</returns>
/// <param name="name">The crossover name.</param>
/// <param name="constructorArgs">Constructor arguments.</param>
public static ICrossover CreateCrossoverByName(string name, params object[] constructorArgs)
{
return TypeHelper.CreateInstanceByName<ICrossover>(name, constructorArgs);
}
/// <summary>
/// Gets the crossover type by the name.
/// </summary>
/// <returns>The crossover type.</returns>
/// <param name="name">The name of crossover.</param>
public static Type GetCrossoverTypeByName(string name)
{
return TypeHelper.GetTypeByName<ICrossover>(name);
}
#endregion
}
}