From 0981fcac71392365839d313ae8cb43bf15908349 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 1 Apr 2011 11:25:27 +0200 Subject: [PATCH] Add methods to add, remove, and count parts contained in a PartContainer. --- .../net/pterodactylus/sone/text/PartContainer.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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 // -- 2.7.4