4 * License : The MIT License
5 * Copyright(c) 2010 MikuToga Partners
8 package jp.sfjp.mikutoga.pmd;
10 import java.util.List;
11 import java.util.Locale;
12 import java.util.ResourceBundle;
24 public enum MorphType {
38 private static final ResourceBundle.Control NOFALLBACK;
39 private static final String FAMILY_NAME =
40 "jp.sfjp.mikutoga.pmd.resources.MorphTypeName";
43 List<String> rbforms = ResourceBundle.Control.FORMAT_DEFAULT;
44 NOFALLBACK = ResourceBundle.Control.getNoFallbackControl(rbforms);
46 String name = BASE.getClass().getPackage().getName();
47 assert FAMILY_NAME.startsWith(name);
51 private final byte encoded;
57 private MorphType(int code){
64 * @param code 符号化byte値
66 private MorphType(byte code){
74 * @return デコードされた列挙子。該当するものがなければnull
76 public static MorphType decode(byte code){
77 MorphType result = null;
79 for(MorphType type : values()){
80 if(type.encode() == code){
101 public String getGuiName(){
102 Locale locale = Locale.getDefault();
103 assert locale != null;
104 return getGuiName(locale);
109 * @param locale ロケール。nullならデフォルトロケールと解釈される。
112 public String getGuiName(Locale locale){
113 if(locale == null) return getGuiName();
115 ResourceBundle.getBundle(FAMILY_NAME, locale, NOFALLBACK);
117 String result = rb.getString(key);
125 public boolean isBase(){
126 if(this == BASE) return true;