comparison Implab/Parsing/EnumAlphabet.cs @ 156:97fbbf816844 v2

Promises: SignalXXX methods merged into SignalHandler method. Components: RunnableComponent In progress
author cin
date Mon, 15 Feb 2016 04:22:15 +0300
parents 653c4e04968b
children 130781364799
comparison
equal deleted inserted replaced
155:037df317f126 156:97fbbf816844
1 using Implab; 1 using System;
2 using System;
3 using System.Collections.Generic; 2 using System.Collections.Generic;
4 using System.Diagnostics; 3 using System.Diagnostics;
5 using System.Globalization; 4 using System.Globalization;
6 using System.Linq; 5 using System.Linq;
7 using System.Text; 6 using System.Diagnostics.CodeAnalysis;
8 using System.Threading.Tasks;
9 7
10 namespace Implab.Parsing { 8 namespace Implab.Parsing {
11 /// <summary> 9 /// <summary>
12 /// Алфавит символами которого являются элементы перечислений. 10 /// Алфавит символами которого являются элементы перечислений.
13 /// </summary> 11 /// </summary>
14 /// <typeparam name="T">Тип перечислений</typeparam> 12 /// <typeparam name="T">Тип перечислений</typeparam>
15 public class EnumAlphabet<T> : AlphabetBase<T> where T : struct, IConvertible { 13 public class EnumAlphabet<T> : AlphabetBase<T> where T : struct, IConvertible {
14 [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
16 static readonly T[] _symbols; 15 static readonly T[] _symbols;
17 static readonly EnumAlphabet<T> _fullAlphabet; 16 static readonly EnumAlphabet<T> _fullAlphabet;
18 17
19 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] 18 [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
20 static EnumAlphabet() { 19 static EnumAlphabet() {
21 if (!typeof(T).IsEnum) 20 if (!typeof(T).IsEnum)
22 throw new InvalidOperationException("Invalid generic parameter, enumeration is required"); 21 throw new InvalidOperationException("Invalid generic parameter, enumeration is required");
23 22
24 if (Enum.GetUnderlyingType(typeof(T)) != typeof(Int32)) 23 if (Enum.GetUnderlyingType(typeof(T)) != typeof(Int32))