Mercurial > pub > ImplabNet
comparison Implab/Parsing/EnumAlphabet.cs @ 59:21611344d366
code cleanup
| author | cin |
|---|---|
| date | Wed, 18 Jun 2014 03:54:02 +0400 |
| parents | c0bf853aa04f |
| children | 653c4e04968b |
comparison
equal
deleted
inserted
replaced
| 58:1710dcda34bb | 59:21611344d366 |
|---|---|
| 1 using Implab; | 1 using Implab; |
| 2 using System; | 2 using System; |
| 3 using System.Collections.Generic; | 3 using System.Collections.Generic; |
| 4 using System.Diagnostics; | |
| 4 using System.Globalization; | 5 using System.Globalization; |
| 5 using System.Linq; | 6 using System.Linq; |
| 6 using System.Text; | 7 using System.Text; |
| 7 using System.Threading.Tasks; | 8 using System.Threading.Tasks; |
| 8 | 9 |
| 43 } | 44 } |
| 44 } | 45 } |
| 45 | 46 |
| 46 | 47 |
| 47 public EnumAlphabet() | 48 public EnumAlphabet() |
| 48 : base() { | 49 : base(_symbols.Length) { |
| 49 } | 50 } |
| 50 | 51 |
| 51 public EnumAlphabet(int[] map) | 52 public EnumAlphabet(int[] map) |
| 52 : base(map) { | 53 : base(map) { |
| 54 Debug.Assert(map.Length == _symbols.Length); | |
| 53 } | 55 } |
| 54 | 56 |
| 55 | 57 |
| 56 public override int GetSymbolIndex(T symbol) { | 58 public override int GetSymbolIndex(T symbol) { |
| 57 return symbol.ToInt32(CultureInfo.InvariantCulture); | 59 return symbol.ToInt32(CultureInfo.InvariantCulture); |
| 59 | 61 |
| 60 public override IEnumerable<T> InputSymbols { | 62 public override IEnumerable<T> InputSymbols { |
| 61 get { return _symbols; } | 63 get { return _symbols; } |
| 62 } | 64 } |
| 63 | 65 |
| 64 protected override int MapSize { | |
| 65 get { return _symbols.Length; } | |
| 66 } | |
| 67 } | 66 } |
| 68 } | 67 } |
