1
0
mirror of https://github.com/chylex/Code-Statistics.git synced 2024-11-24 12:42:46 +01:00
Code-Statistics/LanguageJava/Elements/Modifiers.cs

51 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using CodeStatisticsCore.Collections;
namespace LanguageJava.Elements{
[Flags]
public enum Modifiers{
None = 0x0,
Public = 0x1,
Protected = 0x2,
Private = 0x4,
Abstract = 0x8,
Final = 0x10,
Static = 0x20,
Synchronized = 0x40,
Transient = 0x80,
Volatile = 0x100,
Native = 0x200,
Strictfp = 0x400,
Default = 0x800
}
public static class JavaModifiers{
private static readonly BiDictionary<Modifiers, string> ModifierDict = new BiDictionary<Modifiers, string>{
{ Modifiers.Public, "public" },
{ Modifiers.Protected, "protected" },
{ Modifiers.Private, "private" },
{ Modifiers.Abstract, "abstract" },
{ Modifiers.Final, "final" },
{ Modifiers.Static, "static" },
{ Modifiers.Synchronized, "synchronized" },
{ Modifiers.Transient, "transient" },
{ Modifiers.Volatile, "volatile" },
{ Modifiers.Native, "native" },
{ Modifiers.Strictfp, "strictfp" },
{ Modifiers.Default, "default" }
};
public static IEnumerable<Modifiers> Values { get { return ModifierDict.Keys; } }
public static IEnumerable<string> Strings { get { return ModifierDict.Values; } }
public static Modifiers FromString(string str){
return ModifierDict.GetKey(str);
}
public static string ToString(Modifiers modifier){
return ModifierDict.GetValue(modifier);
}
}
}