1 /* Copyright 2015 Google Inc. All Rights Reserved. 2 3 Distributed under MIT license. 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 5 */ 6 namespace Org.Brotli.Dec 7 { 8 /// <summary>Enumeration of all possible word transformations.</summary> 9 /// <remarks> 10 /// Enumeration of all possible word transformations. 11 /// <p>There are two simple types of transforms: omit X first/last symbols, two character-case 12 /// transforms and the identity transform. 13 /// </remarks> 14 internal sealed class WordTransformType 15 { 16 internal const int Identity = 0; 17 18 internal const int OmitLast1 = 1; 19 20 internal const int OmitLast2 = 2; 21 22 internal const int OmitLast3 = 3; 23 24 internal const int OmitLast4 = 4; 25 26 internal const int OmitLast5 = 5; 27 28 internal const int OmitLast6 = 6; 29 30 internal const int OmitLast7 = 7; 31 32 internal const int OmitLast8 = 8; 33 34 internal const int OmitLast9 = 9; 35 36 internal const int UppercaseFirst = 10; 37 38 internal const int UppercaseAll = 11; 39 40 internal const int OmitFirst1 = 12; 41 42 internal const int OmitFirst2 = 13; 43 44 internal const int OmitFirst3 = 14; 45 46 internal const int OmitFirst4 = 15; 47 48 internal const int OmitFirst5 = 16; 49 50 internal const int OmitFirst6 = 17; 51 52 internal const int OmitFirst7 = 18; 53 54 internal const int OmitFirst8 = 19; 55 56 internal const int OmitFirst9 = 20; 57 GetOmitFirst(int type)58 internal static int GetOmitFirst(int type) 59 { 60 return type >= OmitFirst1 ? (type - OmitFirst1 + 1) : 0; 61 } 62 GetOmitLast(int type)63 internal static int GetOmitLast(int type) 64 { 65 return type <= OmitLast9 ? (type - OmitLast1 + 1) : 0; 66 } 67 } 68 } 69