annotate Implab/Automaton/IAlphabet.cs @ 163:419aa51b04fd ref20160224

JSON moved to Formats namespace Working in RegularDFA
author cin
date Wed, 24 Feb 2016 20:12:52 +0300
parents 0526412bbb26
children 0f70905b4652
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
1 using System;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
2 using System.Collections.Generic;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
3 using System.Linq;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
4 using System.Text;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
5 using System.Threading.Tasks;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
6
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
7 namespace Implab.Automaton {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
8 /// <summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
9 /// Алфавит. Множество символов, которые разбиты на классы, при этом классы имеют непрерывную нумерацию,
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
10 /// что позволяет использовать их в качестве индексов массивов.
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
11 /// </summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
12 /// <remarks>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
13 /// <para>Алфавит является сюрьективным отображением множества символов в множество индексов, это позволяет сократить размер таблицы переходов автомата
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
14 /// для входных символов, которые для него не различимы.</para>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
15 /// </remarks>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
16 /// <typeparam name="TSymbol">Тип символов.</typeparam>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
17 public interface IAlphabet<TSymbol> {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
18 /// <summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
19 /// Количество классов символов в алфавите.
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
20 /// </summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
21 int Count { get; }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
22
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
23 /// <summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
24 /// Создает карту обратного сопоставления класса символов алфавита и сопоставленным
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
25 /// ему исходным символам.
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
26 /// </summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
27 /// <returns></returns>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
28 List<TSymbol>[] CreateReverseMap();
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
29
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
30 /// <summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
31 /// Создает новый алфавит на основе текущего, горппируя его сиволы в более
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
32 /// крупные непересекающиеся классы символов.
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
33 /// </summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
34 /// <param name="newAlphabet">Новый, пустой алфавит, в котором быдут определены классы.</param>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
35 /// <param name="classes">Множество классов символов текущего алфавита.</param>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
36 /// <returns>Карта для перехода классов текущего
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
37 /// алфавита к классам нового.</returns>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
38 /// <remarks>Ползволяет укрупнить алфавит, объединив классы в текущем алфавите. Используется при оптимизации автомата.</remarks>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
39 int[] Reclassify(IAlphabetBuilder<TSymbol> newAlphabet, IEnumerable<IEnumerable<int>> classes);
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
40
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
41 /// <summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
42 /// Преобразует входной символ в индекс символа из алфавита.
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
43 /// </summary>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
44 /// <param name="symobl">Исходный символ</param>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
45 /// <returns>Индекс в алфавите</returns>
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
46 int Translate(TSymbol symobl);
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
47 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
48 }