package net.pterodactylus.sone.text;
import java.io.IOException;
+import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
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
//
}
}
+ //
+ // OBJECT METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ StringWriter stringWriter = new StringWriter();
+ try {
+ render(stringWriter);
+ } catch (IOException ioe1) {
+ /* should never throw, ignore. */
+ }
+ return stringWriter.toString();
+ }
+
}