-
-
Notifications
You must be signed in to change notification settings - Fork 334
/
TerminationService.cs
52 lines (48 loc) · 1.71 KB
/
TerminationService.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
using System;
using System.Collections.Generic;
namespace GeneticSharp
{
/// <summary>
/// Termination service.
/// </summary>
public static class TerminationService
{
#region Methods
/// <summary>
/// Gets available termination types.
/// </summary>
/// <returns>All available termination types.</returns>
public static IList<Type> GetTerminationTypes()
{
return TypeHelper.GetTypesByInterface<ITermination>();
}
/// <summary>
/// Gets the available termination names.
/// </summary>
/// <returns>The termination names.</returns>
public static IList<string> GetTerminationNames()
{
return TypeHelper.GetDisplayNamesByInterface<ITermination>();
}
/// <summary>
/// Creates the ITermination's implementation with the specified name.
/// </summary>
/// <returns>The ITermination's implementation instance.</returns>
/// <param name="name">The ITermination name.</param>
/// <param name="constructorArgs">Constructor arguments.</param>
public static ITermination CreateTerminationByName(string name, params object[] constructorArgs)
{
return TypeHelper.CreateInstanceByName<ITermination>(name, constructorArgs);
}
/// <summary>
/// Gets the termination type by the name.
/// </summary>
/// <returns>The termination type.</returns>
/// <param name="name">The name of termination.</param>
public static Type GetTerminationTypeByName(string name)
{
return TypeHelper.GetTypeByName<ITermination>(name);
}
#endregion
}
}