forked from giacomelli/GeneticSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReinsertionService.cs
56 lines (52 loc) · 2.04 KB
/
ReinsertionService.cs
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
55
56
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using GeneticSharp.Infrastructure.Framework.Reflection;
namespace GeneticSharp.Domain.Reinsertions
{
/// <summary>
/// Reinsertion service.
/// </summary>
public static class ReinsertionService
{
#region Methods
/// <summary>
/// Gets available reinsertion types.
/// </summary>
/// <returns>All available reinsertion types.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public static IList<Type> GetReinsertionTypes()
{
return TypeHelper.GetTypesByInterface<IReinsertion>();
}
/// <summary>
/// Gets the available reinsertion names.
/// </summary>
/// <returns>The reinsertion names.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public static IList<string> GetReinsertionNames()
{
return TypeHelper.GetDisplayNamesByInterface<IReinsertion>();
}
/// <summary>
/// Creates the IReinsertion's implementation with the specified name.
/// </summary>
/// <returns>The reinsertion implementation instance.</returns>
/// <param name="name">The reinsertion name.</param>
/// <param name="constructorArgs">Constructor arguments.</param>
public static IReinsertion CreateReinsertionByName(string name, params object[] constructorArgs)
{
return TypeHelper.CreateInstanceByName<IReinsertion>(name, constructorArgs);
}
/// <summary>
/// Gets the reinsertion type by the name.
/// </summary>
/// <returns>The reinsertion type.</returns>
/// <param name="name">The name of reinsertion.</param>
public static Type GetReinsertionTypeByName(string name)
{
return TypeHelper.GetTypeByName<IReinsertion>(name);
}
#endregion
}
}