OSDN Git Service

1.105.3-SNAPSHOT版開発開始
[mikutoga/TogaGem.git] / src / main / java / jp / sourceforge / mikutoga / pmd / RigidShape.java
index 5906953..8af0765 100644 (file)
-/*\r
- * rigid shape information\r
- *\r
- * License : The MIT License\r
- * Copyright(c) 2010 MikuToga Partners\r
- */\r
-\r
-package jp.sourceforge.mikutoga.pmd;\r
-\r
-/**\r
- * 剛体形状に関する情報。\r
- * 球及びカプセルの半径と箱の幅は同じ値が用いられる。\r
- */\r
-public class RigidShape {\r
-\r
-    private RigidShapeType type = RigidShapeType.BOX;\r
-    private float width  = 0.1f;\r
-    private float height = 0.1f;\r
-    private float depth  = 0.1f;\r
-\r
-    /**\r
-     * コンストラクタ。\r
-     */\r
-    public RigidShape(){\r
-        super();\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 剛体形状種別を返す。\r
-     * @return 剛体形状種別\r
-     */\r
-    public RigidShapeType getShapeType(){\r
-        return this.type;\r
-    }\r
-\r
-    /**\r
-     * 剛体形状種別を設定する。\r
-     * @param typeArg 剛体形状種別\r
-     * @throws NullPointerException 引数がnull\r
-     */\r
-    public void setShapeType(RigidShapeType typeArg)\r
-            throws NullPointerException{\r
-        if(typeArg == null) throw new NullPointerException();\r
-        this.type = typeArg;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 箱の幅を返す。\r
-     * @return 箱の幅\r
-     */\r
-    public float getWidth(){\r
-        return this.width;\r
-    }\r
-\r
-    /**\r
-     * 箱の幅を設定する。\r
-     * @param width 箱の幅\r
-     */\r
-    public void setWidth(float width){\r
-        this.width = width;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 箱及びカプセルの高さを返す。\r
-     * @return 箱及びカプセルの高さ\r
-     */\r
-    public float getHeight(){\r
-        return this.height;\r
-    }\r
-\r
-    /**\r
-     * 箱及びカプセルの高さを設定する。\r
-     * @param height 箱及びカプセルの高さ\r
-     */\r
-    public void setHeight(float height){\r
-        this.height = height;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 箱の奥行きを返す。\r
-     * @return 箱の奥行き\r
-     */\r
-    public float getDepth(){\r
-        return this.depth;\r
-    }\r
-\r
-    /**\r
-     * 箱の奥行きを設定する。\r
-     * @param depth 箱の奥行き\r
-     */\r
-    public void setDepth(float depth){\r
-        this.depth = depth;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 球及びカプセルの半径を返す。\r
-     * @return 球及びカプセルの半径\r
-     */\r
-    public float getRadius(){\r
-        return this.width;\r
-    }\r
-\r
-    /**\r
-     * 球及びカプセルの半径を設定する。\r
-     * @param radius 球及びカプセルの半径\r
-     */\r
-    public void setRadius(float radius){\r
-        this.width = radius;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * {@inheritDoc}\r
-     * @return {@inheritDoc}\r
-     */\r
-    @Override\r
-    public String toString(){\r
-        StringBuilder result = new StringBuilder();\r
-\r
-        result.append(this.type).append(' ');\r
-\r
-        switch(this.type){\r
-        case SPHERE:\r
-            result.append("r=").append(this.width);\r
-            break;\r
-        case BOX:\r
-            result.append("w=").append(this.width).append(", ");\r
-            result.append("h=").append(this.height).append(", ");\r
-            result.append("d=").append(this.depth);\r
-            break;\r
-        case CAPSULE:\r
-            result.append("r=").append(this.width).append(", ");\r
-            result.append("h=").append(this.height);\r
-            break;\r
-        default:\r
-            assert false;\r
-            throw new AssertionError();\r
-        }\r
-\r
-        return  result.toString();\r
-    }\r
-\r
-}\r
+/*
+ * rigid shape information
+ *
+ * License : The MIT License
+ * Copyright(c) 2010 MikuToga Partners
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+/**
+ * 剛体形状に関する情報。
+ * 球及びカプセルの半径と箱の幅は同じ値が用いられる。
+ */
+public class RigidShape {
+
+    private RigidShapeType type = RigidShapeType.BOX;
+    private float width  = 0.1f;
+    private float height = 0.1f;
+    private float depth  = 0.1f;
+
+    /**
+     * コンストラクタ。
+     */
+    public RigidShape(){
+        super();
+        return;
+    }
+
+    /**
+     * 剛体形状種別を返す。
+     * @return 剛体形状種別
+     */
+    public RigidShapeType getShapeType(){
+        return this.type;
+    }
+
+    /**
+     * 剛体形状種別を設定する。
+     * @param typeArg 剛体形状種別
+     * @throws NullPointerException 引数がnull
+     */
+    public void setShapeType(RigidShapeType typeArg)
+            throws NullPointerException{
+        if(typeArg == null) throw new NullPointerException();
+        this.type = typeArg;
+        return;
+    }
+
+    /**
+     * 箱の幅を返す。
+     * @return 箱の幅
+     */
+    public float getWidth(){
+        return this.width;
+    }
+
+    /**
+     * 箱の幅を設定する。
+     * @param width 箱の幅
+     */
+    public void setWidth(float width){
+        this.width = width;
+        return;
+    }
+
+    /**
+     * 箱及びカプセルの高さを返す。
+     * @return 箱及びカプセルの高さ
+     */
+    public float getHeight(){
+        return this.height;
+    }
+
+    /**
+     * 箱及びカプセルの高さを設定する。
+     * @param height 箱及びカプセルの高さ
+     */
+    public void setHeight(float height){
+        this.height = height;
+        return;
+    }
+
+    /**
+     * 箱の奥行きを返す。
+     * @return 箱の奥行き
+     */
+    public float getDepth(){
+        return this.depth;
+    }
+
+    /**
+     * 箱の奥行きを設定する。
+     * @param depth 箱の奥行き
+     */
+    public void setDepth(float depth){
+        this.depth = depth;
+        return;
+    }
+
+    /**
+     * 球及びカプセルの半径を返す。
+     * @return 球及びカプセルの半径
+     */
+    public float getRadius(){
+        return this.width;
+    }
+
+    /**
+     * 球及びカプセルの半径を設定する。
+     * @param radius 球及びカプセルの半径
+     */
+    public void setRadius(float radius){
+        this.width = radius;
+        return;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return {@inheritDoc}
+     */
+    @Override
+    public String toString(){
+        StringBuilder result = new StringBuilder();
+
+        result.append(this.type).append(' ');
+
+        switch(this.type){
+        case SPHERE:
+            result.append("r=").append(this.width);
+            break;
+        case BOX:
+            result.append("w=").append(this.width).append(", ");
+            result.append("h=").append(this.height).append(", ");
+            result.append("d=").append(this.depth);
+            break;
+        case CAPSULE:
+            result.append("r=").append(this.width).append(", ");
+            result.append("h=").append(this.height);
+            break;
+        default:
+            assert false;
+            throw new AssertionError();
+        }
+
+        return  result.toString();
+    }
+
+}