From: David ‘Bombe’ Roden Date: Fri, 1 Apr 2011 09:25:27 +0000 (+0200) Subject: Add methods to add, remove, and count parts contained in a PartContainer. X-Git-Tag: 0.6^2~35 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0981fcac71392365839d313ae8cb43bf15908349;p=Sone.git Add methods to add, remove, and count parts contained in a PartContainer. --- diff --git a/src/main/java/net/pterodactylus/sone/text/PartContainer.java b/src/main/java/net/pterodactylus/sone/text/PartContainer.java index 05bfb3e..4993324 100644 --- a/src/main/java/net/pterodactylus/sone/text/PartContainer.java +++ b/src/main/java/net/pterodactylus/sone/text/PartContainer.java @@ -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 //