2 * rigid behavior type
\r
4 * License : The MIT License
\r
5 * Copyright(c) 2010 MikuToga Partners
\r
8 package jp.sourceforge.mikutoga.pmd;
\r
10 import java.util.Locale;
\r
11 import java.util.ResourceBundle;
\r
18 * <li>0x02:物理演算+ボーン位置合わせ
\r
21 public enum RigidBehaviorType {
\r
27 /** 物理演算+ボーン位置合わせ。 */
\r
28 BONEDDYNAMICS(0x02),
\r
31 private static final String FAMILY_NAME =
\r
32 "jp.sourceforge.mikutoga.pmd.resources.RigidBehaviorTypeName";
\r
34 private final byte encoded;
\r
38 * @param code 符号化int値
\r
40 private RigidBehaviorType(int code){
\r
47 * @param code 符号化byte値
\r
49 private RigidBehaviorType(byte code){
\r
50 this.encoded = code;
\r
57 * @return デコードされた列挙子。該当するものがなければnull
\r
59 public static RigidBehaviorType decode(byte code){
\r
60 RigidBehaviorType result = null;
\r
62 for(RigidBehaviorType type : values()){
\r
63 if(type.encode() == code){
\r
76 public byte encode(){
\r
77 return this.encoded;
\r
81 * デフォルトロケールでの表示名を返す。
\r
84 public String getGuiName(){
\r
85 Locale locale = Locale.getDefault();
\r
86 return getGuiName(locale);
\r
91 * @param locale ロケール。nullならデフォルトロケールと解釈される。
\r
94 public String getGuiName(Locale locale){
\r
95 if(locale == null) return getGuiName();
\r
96 ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale);
\r
97 String key = name();
\r
98 String result = rb.getString(key);
\r