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;
29 public enum BoneType {
53 private static final ResourceBundle.Control NOFALLBACK;
54 private static final String FAMILY_NAME =
55 "jp.sfjp.mikutoga.pmd.resources.BoneTypeName";
58 List<String> rbforms = ResourceBundle.Control.FORMAT_DEFAULT;
59 NOFALLBACK = ResourceBundle.Control.getNoFallbackControl(rbforms);
61 String name = ROTATE.getClass().getPackage().getName();
62 assert FAMILY_NAME.startsWith(name);
66 private final byte encoded;
72 private BoneType(int code){
79 * @param code 符号化byte値
81 private BoneType(byte code){
89 * @return デコードされた列挙子。該当するものがなければnull
91 public static BoneType decode(byte code){
92 BoneType result = null;
94 for(BoneType type : values()){
95 if(type.encode() == code){
108 public byte encode(){
116 public String getGuiName(){
117 Locale locale = Locale.getDefault();
118 assert locale != null;
119 return getGuiName(locale);
124 * @param locale ロケール。nullならデフォルトロケールと解釈される。
127 public String getGuiName(Locale locale){
128 if(locale == null) return getGuiName();
130 ResourceBundle.getBundle(FAMILY_NAME, locale, NOFALLBACK);
132 String result = rb.getString(key);