forked from aalhour/C-Sharp-Algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditDistanceCostsMap.cs
29 lines (26 loc) · 953 Bytes
/
EditDistanceCostsMap.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
using System;
using Algorithms.Common;
namespace Algorithms.Strings
{
/// <summary>
/// Edit Distance Costs Map.
/// Helper class used with the EditDistance class.
/// </summary>
public class EditDistanceCostsMap<TCost> where TCost : IComparable<TCost>, IEquatable<TCost>
{
public TCost DeletionCost { get; set; }
public TCost InsertionCost { get; set; }
public TCost SubstitutionCost { get; set; }
/// <summary>
/// CONSTRUCTOR
/// </summary>
public EditDistanceCostsMap(TCost insertionCost, TCost deletionCost, TCost substitutionCost)
{
if (false == default(TCost).IsNumber())
throw new InvalidOperationException("Invalid cost type TCost. Please choose TCost to be a number.");
DeletionCost = deletionCost;
InsertionCost = insertionCost;
SubstitutionCost = substitutionCost;
}
}
}