X-Git-Url: http://git.osdn.net/view?p=mikutoga%2FTogaGem.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fjp%2Fsourceforge%2Fmikutoga%2Fpmd%2FRigidShapeType.java;h=ed120094b1a5df9c27f23484ec81a98a9881d493;hp=33df15decd870ea6254449d12ec13e5a16365ab2;hb=d68ba6e44800ba2c2f0da1f4b5d6be588b30079f;hpb=22e885262e66e14adb858c35e38f022d86378b13 diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/RigidShapeType.java b/src/main/java/jp/sourceforge/mikutoga/pmd/RigidShapeType.java index 33df15d..ed12009 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd/RigidShapeType.java +++ b/src/main/java/jp/sourceforge/mikutoga/pmd/RigidShapeType.java @@ -1,102 +1,102 @@ -/* - * rigid shape type - * - * License : The MIT License - * Copyright(c) 2010 MikuToga Partners - */ - -package jp.sourceforge.mikutoga.pmd; - -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * 剛体の形状種別。 - * - */ -public enum RigidShapeType { - - /** 球。 */ - SPHERE(0x00), - /** 箱。 */ - BOX(0x01), - /** カプセル。 */ - CAPSULE(0x02), - ; - - private static final String FAMILY_NAME = - "jp.sourceforge.mikutoga.pmd.resources.RigidShapeTypeName"; - - private final byte encoded; - - /** - * コンストラクタ。 - * @param code 符号化int値 - */ - private RigidShapeType(int code){ - this((byte)code); - return; - } - - /** - * コンストラクタ。 - * @param code 符号化byte値 - */ - private RigidShapeType(byte code){ - this.encoded = code; - return; - } - - /** - * byte値からデコードする。 - * @param code byte値 - * @return デコードされた列挙子。該当するものがなければnull - */ - public static RigidShapeType decode(byte code){ - RigidShapeType result = null; - - for(RigidShapeType type : values()){ - if(type.encode() == code){ - result = type; - break; - } - } - - return result; - } - - /** - * byte値にエンコードする。 - * @return byte値 - */ - public byte encode(){ - return this.encoded; - } - - /** - * デフォルトロケールでの表示名を返す。 - * @return 表示名 - */ - public String getGuiName(){ - Locale locale = Locale.getDefault(); - return getGuiName(locale); - } - - /** - * ロケールに準じた表示名を返す。 - * @param locale ロケール。nullならデフォルトロケールと解釈される。 - * @return 表示名 - */ - public String getGuiName(Locale locale){ - if(locale == null) return getGuiName(); - ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale); - String key = name(); - String result = rb.getString(key); - return result; - } - -} +/* + * rigid shape type + * + * License : The MIT License + * Copyright(c) 2010 MikuToga Partners + */ + +package jp.sourceforge.mikutoga.pmd; + +import java.util.Locale; +import java.util.ResourceBundle; + +/** + * 剛体の形状種別。 + * + */ +public enum RigidShapeType { + + /** 球。 */ + SPHERE(0x00), + /** 箱。 */ + BOX(0x01), + /** カプセル。 */ + CAPSULE(0x02), + ; + + private static final String FAMILY_NAME = + "jp.sourceforge.mikutoga.pmd.resources.RigidShapeTypeName"; + + private final byte encoded; + + /** + * コンストラクタ。 + * @param code 符号化int値 + */ + private RigidShapeType(int code){ + this((byte)code); + return; + } + + /** + * コンストラクタ。 + * @param code 符号化byte値 + */ + private RigidShapeType(byte code){ + this.encoded = code; + return; + } + + /** + * byte値からデコードする。 + * @param code byte値 + * @return デコードされた列挙子。該当するものがなければnull + */ + public static RigidShapeType decode(byte code){ + RigidShapeType result = null; + + for(RigidShapeType type : values()){ + if(type.encode() == code){ + result = type; + break; + } + } + + return result; + } + + /** + * byte値にエンコードする。 + * @return byte値 + */ + public byte encode(){ + return this.encoded; + } + + /** + * デフォルトロケールでの表示名を返す。 + * @return 表示名 + */ + public String getGuiName(){ + Locale locale = Locale.getDefault(); + return getGuiName(locale); + } + + /** + * ロケールに準じた表示名を返す。 + * @param locale ロケール。nullならデフォルトロケールと解釈される。 + * @return 表示名 + */ + public String getGuiName(Locale locale){ + if(locale == null) return getGuiName(); + ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale); + String key = name(); + String result = rb.getString(key); + return result; + } + +}