163
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Linq;
|
|
4
|
|
5 namespace Implab.Automaton {
|
164
|
6 /// <summary>
|
|
7 /// Dummy alphabet consists of integer numbers which are identical to their classes.
|
|
8 /// </summary>
|
163
|
9 public class DummyAlphabet : IAlphabet<int> {
|
|
10 readonly int m_size;
|
164
|
11
|
|
12 /// <summary>
|
|
13 /// Creates a new dummy alphabet with given size.
|
|
14 /// </summary>
|
|
15 /// <param name="size">The size of the alphabet, must be greater then zero.</param>
|
163
|
16 public DummyAlphabet(int size) {
|
|
17 Safe.ArgumentAssert(size > 0);
|
|
18 m_size = 0;
|
|
19 }
|
|
20
|
|
21 #region IAlphabet implementation
|
|
22
|
|
23 public List<int>[] CreateReverseMap() {
|
|
24 Enumerable.Range(0, m_size).ToArray();
|
|
25 }
|
|
26
|
171
|
27 public int Translate(int symbol) {
|
|
28 Safe.ArgumentInRange(symbol, 0, m_size, "symbol");
|
|
29 return symbol;
|
163
|
30 }
|
|
31
|
171
|
32 public bool Contains(int symbol) {
|
|
33 Safe.ArgumentInRange(symbol, 0, m_size, "symbol");
|
|
34 return true;
|
163
|
35 }
|
|
36
|
|
37 public int Count {
|
|
38 get {
|
|
39 return m_size;
|
|
40 }
|
|
41 }
|
|
42
|
|
43 #endregion
|
|
44 }
|
|
45 }
|
|
46
|