forked from giacomelli/GeneticSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionService.cs
More file actions
54 lines (50 loc) · 1.83 KB
/
SelectionService.cs
File metadata and controls
54 lines (50 loc) · 1.83 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
53
54
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using GeneticSharp.Infrastructure.Framework.Reflection;
namespace GeneticSharp.Domain.Selections
{
/// <summary>
/// Selection service.
/// </summary>
public static class SelectionService
{
#region Methods
/// <summary>
/// Gets available selection types.
/// </summary>
/// <returns>All available selection types.</returns>
public static IList<Type> GetSelectionTypes()
{
return TypeHelper.GetTypesByInterface<ISelection>();
}
/// <summary>
/// Gets the available selection names.
/// </summary>
/// <returns>The selection names.</returns>
public static IList<string> GetSelectionNames()
{
return TypeHelper.GetDisplayNamesByInterface<ISelection>();
}
/// <summary>
/// Creates the ISelection's implementation with the specified name.
/// </summary>
/// <returns>The selection implementation instance.</returns>
/// <param name="name">The selection name.</param>
/// <param name="constructorArgs">Constructor arguments.</param>
public static ISelection CreateSelectionByName(string name, params object[] constructorArgs)
{
return TypeHelper.CreateInstanceByName<ISelection>(name, constructorArgs);
}
/// <summary>
/// Gets the selection type by the name.
/// </summary>
/// <returns>The selection type.</returns>
/// <param name="name">The name of selection.</param>
public static Type GetSelectionTypeByName(string name)
{
return TypeHelper.GetTypeByName<ISelection>(name);
}
#endregion
}
}