2using System.Collections.Generic;
13 private readonly Dictionary<string, IMathematicalDecisionMapper>
16 StringComparer.OrdinalIgnoreCase);
41 ArgumentNullException.ThrowIfNull(
52 throw new InvalidOperationException(
53 $
"A mathematical decision mapper for category " +
54 $
"'{category}' is already registered.");
74 ArgumentNullException.ThrowIfNull(
99 return _mappers.ContainsKey(
120 string normalizedCategory =
124 if (_mappers.TryGetValue(
131 throw new KeyNotFoundException(
132 $
"No mathematical decision mapper is registered for " +
133 $
"category '{normalizedCategory}'.");
153 return _mappers.TryGetValue(
166 public IReadOnlyList<IMathematicalDecisionMapper>
GetAll()
168 return _mappers.Values
172 StringComparer.OrdinalIgnoreCase)
189 return _mappers.Remove(
202 private static string NormalizeCategory(
205 if (
string.IsNullOrWhiteSpace(
208 throw new InvalidOperationException(
209 "A mathematical decision-mapper category is " +
213 return category.Trim();
Stores and resolves mathematical decision mappers by business-domain category.
bool TryGet(string category, out IMathematicalDecisionMapper? mapper)
Attempts to get a decision mapper for a category.
int Count
Gets the number of registered decision mappers.
bool Remove(string category)
Removes a decision mapper.
bool Contains(string category)
Determines whether a decision mapper is registered for a category.
void Register(IMathematicalDecisionMapper mapper)
Registers a mathematical decision mapper.
IReadOnlyList< IMathematicalDecisionMapper > GetAll()
Returns all registered decision mappers ordered by category.
void Clear()
Removes all registered decision mappers.
IMathematicalDecisionMapper GetRequired(string category)
Gets the required decision mapper for a category.
void RegisterOrReplace(IMathematicalDecisionMapper mapper)
Registers or replaces a mathematical decision mapper.
Defines a mapper responsible for one family of lot-sizing decisions identified by a mathematical doma...
string Category
Gets the mathematical domain-key category handled by this mapper.