-
Notifications
You must be signed in to change notification settings - Fork 0
/
StorageWordItemProcessor.cs
34 lines (33 loc) · 1.19 KB
/
StorageWordItemProcessor.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Grammophone.Indexing
{
/// <summary>
/// Strategy for addition of word items into the <see cref="RadixTree{C, D, N}.Branch.NodeData"/>
/// of a radix tree branch through <see cref="IWordItemStorage{D}"/> interface.
/// </summary>
/// <typeparam name="C">The type of the character of a word.</typeparam>
/// <typeparam name="D">The type of information allocated per word.</typeparam>
/// <typeparam name="N">
/// The type of extra data stored per node,
/// expected to implement <see cref="IWordItemStorage{D}"/>.
/// </typeparam>
[Serializable]
public class StorageWordItemProcessor<C, D, N> : WordItemProcessor<C, D, N>
where N: IWordItemStorage<D>
{
/// <summary>
/// Adds the <paramref name="wordItem"/> to the <see cref="RadixTree{C, D, N}.Branch.NodeData"/>
/// field of the <paramref name="branch"/>.
/// </summary>
/// <remarks>
/// The addition is accomplished through the <see cref="IWordItemStorage{D}"/> interface.
/// </remarks>
public override void OnWordAdd(C[] str, D wordItem, RadixTree<C, D, N>.Branch branch)
{
branch.NodeData.AddWordItem(wordItem);
}
}
}