comparison Implab/Parsing/AlphabetBase.cs @ 59:21611344d366

code cleanup
author cin
date Wed, 18 Jun 2014 03:54:02 +0400
parents c0bf853aa04f
children 97fbbf816844
comparison
equal deleted inserted replaced
58:1710dcda34bb 59:21611344d366
15 15
16 public int Count { 16 public int Count {
17 get { return m_nextId; } 17 get { return m_nextId; }
18 } 18 }
19 19
20 protected AlphabetBase() { 20 protected AlphabetBase(int mapSize) {
21 m_map = new int[MapSize]; 21 m_map = new int[mapSize];
22 } 22 }
23 23
24 protected AlphabetBase(int[] map) { 24 protected AlphabetBase(int[] map) {
25 Debug.Assert(map != null); 25 Debug.Assert(map != null);
26 Debug.Assert(map.Length == MapSize);
27 26
28 m_map = map; 27 m_map = map;
29 m_nextId = map.Max() + 1; 28 m_nextId = map.Max() + 1;
30 } 29 }
31 30
92 91
93 public abstract int GetSymbolIndex(T symbol); 92 public abstract int GetSymbolIndex(T symbol);
94 93
95 public abstract IEnumerable<T> InputSymbols { get; } 94 public abstract IEnumerable<T> InputSymbols { get; }
96 95
97 protected abstract int MapSize { get; }
98
99 public int[] GetTranslationMap() { 96 public int[] GetTranslationMap() {
100 return m_map; 97 return m_map;
101 } 98 }
102 } 99 }
103 } 100 }