-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataCollectionFactory.cs
More file actions
25 lines (22 loc) · 991 Bytes
/
DataCollectionFactory.cs
File metadata and controls
25 lines (22 loc) · 991 Bytes
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
using Lib;
namespace SampleAnalysis;
public static class DataCollectionFactory
{
public const string ArrayListCollectionName = "arrayList";
public const string LinkedListCollectionName = "linkedList";
public const string SortedTreeCollectionName = "sortedTree";
public const string DictionaryCollectionName = "dict";
public const string ArraySegmentsCollectionName = "arraySegments";
public static IDataCollection<T> Create<T>(string name)
{
return name switch
{
ArrayListCollectionName => new ArrayListDataCollection<T>(),
LinkedListCollectionName => new LinkedListDataCollection<T>(),
SortedTreeCollectionName => new TreeDataCollection<T>(),
DictionaryCollectionName => new DictionaryDataCollection<T>(),
ArraySegmentsCollectionName => new ListSegmentsDataCollection<T>(),
_ => throw new Exception($"Unknown data collection implementation {name}")
};
}
}