OSDN Git Service

1.105.3-SNAPSHOT版開発開始
[mikutoga/TogaGem.git] / src / main / java / jp / sourceforge / mikutoga / pmd / BoneInfo.java
index d19efc4..e8f2882 100644 (file)
-/*\r
- * bone information\r
- *\r
- * License : The MIT License\r
- * Copyright(c) 2010 MikuToga Partners\r
- */\r
-\r
-package jp.sourceforge.mikutoga.pmd;\r
-\r
-import jp.sourceforge.mikutoga.corelib.I18nText;\r
-import jp.sourceforge.mikutoga.corelib.SerialNumbered;\r
-\r
-/**\r
- * ボーン情報。\r
- */\r
-public class BoneInfo implements SerialNumbered {\r
-\r
-    private final I18nText boneName = new I18nText();\r
-    private BoneType boneType;\r
-\r
-    private BoneInfo prevBone;\r
-    private BoneInfo nextBone;\r
-    private BoneInfo ikBone;\r
-\r
-    private final Pos3d position = new Pos3d();\r
-\r
-    private int rotationRatio;\r
-\r
-    private int serialNo = -1;\r
-\r
-    /**\r
-     * コンストラクタ。\r
-     */\r
-    public BoneInfo(){\r
-        super();\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * ボーン名を返す。\r
-     * @return ボーン名\r
-     */\r
-    public I18nText getBoneName(){\r
-        return this.boneName;\r
-    }\r
-\r
-    /**\r
-     * ボーン種別を設定する。\r
-     * @param type ボーン種別\r
-     * @throws NullPointerException 引数がnull\r
-     */\r
-    public void setBoneType(BoneType type) throws NullPointerException{\r
-        if(type == null) throw new NullPointerException();\r
-        this.boneType = type;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * ボーン種別を返す。\r
-     * @return ボーン種別\r
-     */\r
-    public BoneType getBoneType(){\r
-        return this.boneType;\r
-    }\r
-\r
-    /**\r
-     * 親(前)ボーンを設定する。\r
-     * @param prevBone 前ボーン。ない場合はnullを指定。\r
-     */\r
-    public void setPrevBone(BoneInfo prevBone){\r
-        this.prevBone = prevBone;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 親(前)ボーンを返す。\r
-     * @return 前ボーン。ない場合はnullを返す。\r
-     */\r
-    public BoneInfo getPrevBone(){\r
-        return this.prevBone;\r
-    }\r
-\r
-    /**\r
-     * 子(次)ボーンを設定する。\r
-     * 捩りボーンでは軸方向に位置するボーン、\r
-     * 回転連動ボーンでは影響元ボーン。\r
-     * @param nextBone 次ボーン。ない場合はnullを指定。\r
-     */\r
-    public void setNextBone(BoneInfo nextBone){\r
-        this.nextBone = nextBone;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 子(次)ボーンを返す。\r
-     * 捩りボーンでは軸方向に位置するボーン、\r
-     * 回転連動ボーンでは影響元ボーン。\r
-     * @return 次ボーン。ない場合はnullを返す。\r
-     */\r
-    public BoneInfo getNextBone(){\r
-        return this.nextBone;\r
-    }\r
-\r
-    /**\r
-     * このボーンが影響を受けるIKボーンを設定する。\r
-     * @param ikBoneArg IKボーン。ない場合はnullを指定。\r
-     */\r
-    public void setIKBone(BoneInfo ikBoneArg){\r
-        this.ikBone = ikBoneArg;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * このボーンが影響を受けるIKボーンを返す。\r
-     * @return IKボーン。ない場合はnull\r
-     */\r
-    public BoneInfo getIKBone(){\r
-        return this.ikBone;\r
-    }\r
-\r
-    /**\r
-     * ボーン位置を返す。\r
-     * @return ボーン位置\r
-     */\r
-    public Pos3d getPosition(){\r
-        return this.position;\r
-    }\r
-\r
-    /**\r
-     * 回転連動の影響度を返す。\r
-     * 回転連動ボーンの場合のみ有効。\r
-     * @return 回転連動の影響度\r
-     */\r
-    public int getRotationRatio(){\r
-        return this.rotationRatio;\r
-    }\r
-\r
-    /**\r
-     * 回転連動の影響度を設定する。\r
-     * 回転連動ボーンの場合のみ有効。\r
-     * @param ratio 回転連動の影響度\r
-     */\r
-    public void setRotationRatio(int ratio){\r
-        this.rotationRatio = ratio;\r
-    }\r
-\r
-    /**\r
-     * {@inheritDoc}\r
-     * @param num {@inheritDoc}\r
-     */\r
-    @Override\r
-    public void setSerialNumber(int num){\r
-        this.serialNo = num;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * {@inheritDoc}\r
-     * @return {@inheritDoc}\r
-     */\r
-    @Override\r
-    public int getSerialNumber(){\r
-        return this.serialNo;\r
-    }\r
-\r
-    /**\r
-     * {@inheritDoc}\r
-     * @return {@inheritDoc}\r
-     */\r
-    @Override\r
-    public String toString(){\r
-        StringBuilder result = new StringBuilder();\r
-\r
-        result.append("Bone")\r
-              .append(this.serialNo)\r
-              .append("(")\r
-              .append(this.boneName.getPrimaryText())\r
-              .append(")");\r
-\r
-        result.append(" type=")\r
-              .append(this.boneType);\r
-\r
-        result.append(" prev=");\r
-        if(this.prevBone != null) result.append(this.prevBone.getBoneName());\r
-        else                      result.append("NONE");\r
-\r
-        result.append(" next=");\r
-        if(this.nextBone != null) result.append(this.nextBone.getBoneName());\r
-        else                      result.append("NONE");\r
-\r
-        if(this.boneType == BoneType.LINKEDROT){\r
-            result.append(" rotraio=").append(this.rotationRatio);\r
-        }else{\r
-            result.append(" ik=");\r
-            if(this.ikBone != null) result.append(this.ikBone.getBoneName());\r
-            else                    result.append("NONE");\r
-        }\r
-\r
-        result.append(" ").append(this.position);\r
-\r
-        return result.toString();\r
-    }\r
-\r
-}\r
+/*
+ * bone information
+ *
+ * License : The MIT License
+ * Copyright(c) 2010 MikuToga Partners
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import jp.sourceforge.mikutoga.corelib.I18nText;
+import jp.sourceforge.mikutoga.corelib.SerialNumbered;
+
+/**
+ * ボーン情報。
+ */
+public class BoneInfo implements SerialNumbered {
+
+    private final I18nText boneName = new I18nText();
+    private BoneType boneType;
+
+    private BoneInfo prevBone;
+    private BoneInfo nextBone;
+    private BoneInfo ikBone;
+
+    private final Pos3d position = new Pos3d();
+
+    private int rotationRatio;
+
+    private int serialNo = -1;
+
+    /**
+     * コンストラクタ。
+     */
+    public BoneInfo(){
+        super();
+        return;
+    }
+
+    /**
+     * ボーン名を返す。
+     * @return ボーン名
+     */
+    public I18nText getBoneName(){
+        return this.boneName;
+    }
+
+    /**
+     * ボーン種別を設定する。
+     * @param type ボーン種別
+     * @throws NullPointerException 引数がnull
+     */
+    public void setBoneType(BoneType type) throws NullPointerException{
+        if(type == null) throw new NullPointerException();
+        this.boneType = type;
+        return;
+    }
+
+    /**
+     * ボーン種別を返す。
+     * @return ボーン種別
+     */
+    public BoneType getBoneType(){
+        return this.boneType;
+    }
+
+    /**
+     * 親(前)ボーンを設定する。
+     * @param prevBone 前ボーン。ない場合はnullを指定。
+     */
+    public void setPrevBone(BoneInfo prevBone){
+        this.prevBone = prevBone;
+        return;
+    }
+
+    /**
+     * 親(前)ボーンを返す。
+     * @return 前ボーン。ない場合はnullを返す。
+     */
+    public BoneInfo getPrevBone(){
+        return this.prevBone;
+    }
+
+    /**
+     * 子(次)ボーンを設定する。
+     * 捩りボーンでは軸方向に位置するボーン、
+     * 回転連動ボーンでは影響元ボーン。
+     * @param nextBone 次ボーン。ない場合はnullを指定。
+     */
+    public void setNextBone(BoneInfo nextBone){
+        this.nextBone = nextBone;
+        return;
+    }
+
+    /**
+     * 子(次)ボーンを返す。
+     * 捩りボーンでは軸方向に位置するボーン、
+     * 回転連動ボーンでは影響元ボーン。
+     * @return 次ボーン。ない場合はnullを返す。
+     */
+    public BoneInfo getNextBone(){
+        return this.nextBone;
+    }
+
+    /**
+     * このボーンが影響を受けるIKボーンを設定する。
+     * @param ikBoneArg IKボーン。ない場合はnullを指定。
+     */
+    public void setIKBone(BoneInfo ikBoneArg){
+        this.ikBone = ikBoneArg;
+        return;
+    }
+
+    /**
+     * このボーンが影響を受けるIKボーンを返す。
+     * @return IKボーン。ない場合はnull
+     */
+    public BoneInfo getIKBone(){
+        return this.ikBone;
+    }
+
+    /**
+     * ボーン位置を返す。
+     * @return ボーン位置
+     */
+    public Pos3d getPosition(){
+        return this.position;
+    }
+
+    /**
+     * 回転連動の影響度を返す。
+     * 回転連動ボーンの場合のみ有効。
+     * @return 回転連動の影響度
+     */
+    public int getRotationRatio(){
+        return this.rotationRatio;
+    }
+
+    /**
+     * 回転連動の影響度を設定する。
+     * 回転連動ボーンの場合のみ有効。
+     * @param ratio 回転連動の影響度
+     */
+    public void setRotationRatio(int ratio){
+        this.rotationRatio = ratio;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @param num {@inheritDoc}
+     */
+    @Override
+    public void setSerialNumber(int num){
+        this.serialNo = num;
+        return;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return {@inheritDoc}
+     */
+    @Override
+    public int getSerialNumber(){
+        return this.serialNo;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return {@inheritDoc}
+     */
+    @Override
+    public String toString(){
+        StringBuilder result = new StringBuilder();
+
+        result.append("Bone")
+              .append(this.serialNo)
+              .append("(")
+              .append(this.boneName.getPrimaryText())
+              .append(")");
+
+        result.append(" type=")
+              .append(this.boneType);
+
+        result.append(" prev=");
+        if(this.prevBone != null) result.append(this.prevBone.getBoneName());
+        else                      result.append("NONE");
+
+        result.append(" next=");
+        if(this.nextBone != null) result.append(this.nextBone.getBoneName());
+        else                      result.append("NONE");
+
+        if(this.boneType == BoneType.LINKEDROT){
+            result.append(" rotraio=").append(this.rotationRatio);
+        }else{
+            result.append(" ik=");
+            if(this.ikBone != null) result.append(this.ikBone.getBoneName());
+            else                    result.append("NONE");
+        }
+
+        result.append(" ").append(this.position);
+
+        return result.toString();
+    }
+
+}