annotate Implab/Parsing/IAlphabet.cs @ 159:5558e43c79bb v2

minor fix
author cin
date Thu, 18 Feb 2016 16:06:14 +0300
parents 130781364799
children 2a8466f0cb8a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
1 using System;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
2 using System.Collections.Generic;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
3 using System.Linq;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
4 using System.Text;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
5 using System.Threading.Tasks;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
6
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
7 namespace Implab.Parsing {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
8 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
9 /// Алфавит. Множество символов, которые разбиты на классы, при этом классы имеют непрерывную нумерацию,
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
10 /// что позволяет использовать их в качестве индексов массивов.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
11 /// </summary>
158
130781364799 refactoring, code cleanup
cin
parents: 55
diff changeset
12 /// <remarks>
130781364799 refactoring, code cleanup
cin
parents: 55
diff changeset
13 /// <para>Алфавит является сюрьективным отображением множества символов в множество индексов, это позволяет сократить размер таблицы переходов автомата
130781364799 refactoring, code cleanup
cin
parents: 55
diff changeset
14 /// для входных символов, которые для него не различимы.</para>
130781364799 refactoring, code cleanup
cin
parents: 55
diff changeset
15 /// <para>Далее символами алфавита будем называть классы исходных символов.</para>
130781364799 refactoring, code cleanup
cin
parents: 55
diff changeset
16 /// </remarks>
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
17 /// <typeparam name="TSymbol">Тип символов.</typeparam>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
18 public interface IAlphabet<TSymbol> {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
19 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
20 /// Количество символов в алфавите.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
21 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
22 int Count { get; }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
23 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
24 /// Добавляет новый символ в алфавит, если символ уже был добавлен, то
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
25 /// возвращается ранее сопоставленный с символом класс.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
26 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
27 /// <param name="symbol">Символ для добавления.</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
28 /// <returns>Индекс класса, который попоставлен с символом.</returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
29 int DefineSymbol(TSymbol symbol);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
30 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
31 /// Доабвляем класс символов. Множеству указанных исходных символов
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
32 /// будет сопоставлен символ в алфавите.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
33 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
34 /// <param name="symbols">Множестов исходных символов</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
35 /// <returns>Идентификатор символа алфавита.</returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
36 int DefineClass(IEnumerable<TSymbol> symbols);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
37 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
38 /// Создает карту обратного сопоставления символа алфавита и сопоставленным
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
39 /// ему исходным символам.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
40 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
41 /// <returns></returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
42 List<TSymbol>[] CreateReverseMap();
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
43 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
44 /// Создает новый алфавит на основе текущего, горппируя его сиволы в более
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
45 /// крупные непересекающиеся классы символов.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
46 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
47 /// <param name="newAlphabet">Новый, пустой алфавит, в котором быдут определены классы.</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
48 /// <param name="classes">Множество классов символов текущего алфавита.</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
49 /// <returns>Карта для перехода символов текущего
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
50 /// алфавита к символам нового.</returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
51 int[] Reclassify(IAlphabet<TSymbol> newAlphabet, IEnumerable<ICollection<int>> classes);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
52
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
53 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
54 /// Преобразует входной символ в индекс символа из алфавита.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
55 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
56 /// <param name="symobl">Исходный символ</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
57 /// <returns>Индекс в алфавите</returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
58 int Translate(TSymbol symobl);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
59 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
60 }