OSDN Git Service

Improved api docs of Array class
authorDmitry Suzdalev <dimsuz@gmail.com>
Tue, 29 Jan 2013 22:17:22 +0000 (02:17 +0400)
committerDmitry Suzdalev <dimsuz@gmail.com>
Tue, 29 Jan 2013 22:17:22 +0000 (02:17 +0400)
gdx/src/com/badlogic/gdx/utils/Array.java

index b87585a..b4a5e19 100644 (file)
@@ -151,7 +151,11 @@ public class Array<T> implements Iterable<T> {
                items[second] = firstValue;\r
        }\r
 \r
-       /** @param identity If true, == comparison will be used. If false, .equals() comaparison will be used. */\r
+       /**\r
+        * Returns if this array contains value.\r
+        * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+        * @return true if array contains value, false if it doesn't\r
+        */\r
        public boolean contains (T value, boolean identity) {\r
                T[] items = this.items;\r
                int i = size - 1;\r
@@ -165,6 +169,11 @@ public class Array<T> implements Iterable<T> {
                return false;\r
        }\r
 \r
+       /**\r
+        * Returns an index of first occurrence of value in array or -1 if no such value exists\r
+        * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+        * @return An index of first occurrence of value in array or -1 if no such value exists\r
+        */\r
        public int indexOf (T value, boolean identity) {\r
                T[] items = this.items;\r
                if (identity || value == null) {\r
@@ -177,6 +186,12 @@ public class Array<T> implements Iterable<T> {
                return -1;\r
        }\r
 \r
+       /**\r
+        * Returns an index of last occurrence of value in array or -1 if no such value exists.\r
+        * Search is started from the end of an array.\r
+        * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+        * @return An index of first occurrence of value in array or -1 if no such value exists\r
+        */\r
        public int lastIndexOf (T value, boolean identity) {\r
                T[] items = this.items;\r
                if (identity || value == null) {\r
@@ -189,6 +204,11 @@ public class Array<T> implements Iterable<T> {
                return -1;\r
        }\r
 \r
+       /**\r
+        * Removes value from an array if it exists.\r
+        * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+        * @return true if value was found and removed, false otherwise\r
+        */\r
        public boolean removeValue (T value, boolean identity) {\r
                T[] items = this.items;\r
                if (identity || value == null) {\r