annotate Implab/Parsing/IAlphabet.cs @ 161:2a8466f0cb8a v2

DFA refactoring
author cin
date Fri, 19 Feb 2016 18:07:17 +0300
parents 130781364799
children
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 /// </remarks>
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
16 /// <typeparam name="TSymbol">Тип символов.</typeparam>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
17 public interface IAlphabet<TSymbol> {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
18 /// <summary>
161
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
19 /// Количество классов символов в алфавите.
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
20 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
21 int Count { get; }
161
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
22
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
23 /// <summary>
161
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
24 /// Создает карту обратного сопоставления класса символов алфавита и сопоставленным
55
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 /// <returns></returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
28 List<TSymbol>[] CreateReverseMap();
161
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
29
55
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="newAlphabet">Новый, пустой алфавит, в котором быдут определены классы.</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
35 /// <param name="classes">Множество классов символов текущего алфавита.</param>
161
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
36 /// <returns>Карта для перехода классов текущего
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
37 /// алфавита к классам нового.</returns>
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
38 /// <remarks>Ползволяет укрупнить алфавит, объединив классы в текущем алфавите. Используется при оптимизации автомата.</remarks>
2a8466f0cb8a DFA refactoring
cin
parents: 158
diff changeset
39 int[] Reclassify(IAlphabetBuilder<TSymbol> newAlphabet, IEnumerable<ICollection<int>> classes);
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
40
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
41 /// <summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
42 /// Преобразует входной символ в индекс символа из алфавита.
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
43 /// </summary>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
44 /// <param name="symobl">Исходный символ</param>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
45 /// <returns>Индекс в алфавите</returns>
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
46 int Translate(TSymbol symobl);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
47 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
48 }