Add methods to add, remove, and count parts contained in a PartContainer.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Apr 2011 09:25:27 +0000 (11:25 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Apr 2011 09:25:27 +0000 (11:25 +0200)
src/main/java/net/pterodactylus/sone/text/PartContainer.java

index 05bfb3e..4993324 100644 (file)
@@ -49,6 +49,36 @@ public class PartContainer implements Part {
                parts.add(part);
        }
 
+       /**
+        * Returns the part at the given index.
+        *
+        * @param index
+        *            The index of the part
+        * @return The part
+        */
+       public Part getPart(int index) {
+               return parts.get(index);
+       }
+
+       /**
+        * Removes the part at the given index.
+        *
+        * @param index
+        *            The index of the part to remove
+        */
+       public void removePart(int index) {
+               parts.remove(index);
+       }
+
+       /**
+        * Returns the number of parts.
+        *
+        * @return The number of parts
+        */
+       public int size() {
+               return parts.size();
+       }
+
        //
        // PART METHODS
        //