+ return new Metadata(formatMetadata, contentMetadata.name(name));
+ }
+
+ /**
+ * Returns the title of the content.
+ *
+ * @return The title of the content
+ */
+ public String title() {
+ return contentMetadata.title();
+ }
+
+ /**
+ * Returns new metadata with the same attributes as this metadata but with the
+ * title changed to the given title.
+ *
+ * @param title
+ * The new title
+ * @return The new metadata
+ */
+ public Metadata title(String title) {
+ return new Metadata(formatMetadata, contentMetadata.title(title));
+ }
+
+ /**
+ * Returns the comment of the content, if any.
+ *
+ * @return The comment of the content
+ */
+ public Optional<String> comment() {
+ return contentMetadata.comment();
+ }
+
+ /**
+ * Returns new metadata with the same attributes as this metadata but with the
+ * comment changed to the given comment.
+ *
+ * @param comment
+ * The new comment
+ * @return The new metadata
+ */
+ public Metadata comment(String comment) {
+ return new Metadata(formatMetadata, contentMetadata.comment(comment));
+ }
+
+ /**
+ * Returns the title with the comment appended in parantheses, if a comment has
+ * been set.
+ *
+ * @return The title with the comment appended
+ */
+ public String fullTitle() {
+ return String.format("%s%s", title(), comment().isPresent() ? String.format(" (%s)", comment().get()) : "");
+ }
+
+ /**
+ * Returns whether this metadata object equals the given object if the comments
+ * of this and the given object are ignored.
+ *
+ * @param object
+ * The object to compare to this one
+ * @return {@code true} if the given object and this object are equal if the
+ * comments are ignored, {@code false} otherwise
+ */
+ public boolean equalsIgnoreComment(Object object) {
+ if (!(object instanceof Metadata)) {
+ return false;
+ }
+ Metadata metadata = (Metadata) object;
+ return formatMetadata.equals(metadata.formatMetadata) && contentMetadata.equalsIgnoreComment(metadata.contentMetadata);