package com.alexrnl.subtitlecorrector.io;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;

/**
 * Class defining a subtitle format.<br >/
 * @author Alex
 */
public class SubtitleFormat {
	/** The name of the format */
	private final String			name;
	/** The extensions of subtitle encoded in that format */
	private final Set<String>		extensions;
	/** The reader for this subtitle's format */
	private final SubtitleReader	reader;
	/** The writer for this subtitle's format */
	private final SubtitleWriter	writer;
	
	/**
	 * Constructor #1.<br />
	 * @param name
	 *        the name of the subtitle format.
	 * @param reader
	 *        the reader for the format.
	 * @param writer
	 *        the writer for the format.
	 * @param extensions
	 *        the extensions of the subtitle in that format.
	 */
	public SubtitleFormat (final String name, final SubtitleReader reader,
			final SubtitleWriter writer, final String... extensions) {
		this(name, Arrays.asList(extensions), reader, writer);
	}
	
	/**
	 * Constructor #2.<br />
	 * @param name
	 *        the name of the subtitle format.
	 * @param extensions
	 *        the extensions of the subtitle in that format.
	 * @param reader
	 *        the reader for the format.
	 * @param writer
	 *        the writer for the format.
	 */
	public SubtitleFormat (final String name, final Collection<String> extensions,
			final SubtitleReader reader, final SubtitleWriter writer) {
		super();
		this.name = name;
		this.extensions = Collections.unmodifiableSortedSet(new TreeSet<>(extensions));
		this.reader = reader;
		this.writer = writer;
	}
	
	/**
	 * Return the attribute name.
	 * @return the attribute name.
	 */
	public String getName () {
		return name;
	}
	
	/**
	 * Return the attribute extensions.
	 * @return the attribute extensions.
	 */
	public Set<String> getExtensions () {
		return extensions;
	}
	
	/**
	 * Return the attribute reader.
	 * @return the attribute reader.
	 */
	public SubtitleReader getReader () {
		return reader;
	}
	
	/**
	 * Return the attribute writer.
	 * @return the attribute writer.
	 */
	public SubtitleWriter getWriter () {
		return writer;
	}
	
}

@@ -169,16 +169,171 @@
 eeSet;%0A%0A
+import com.alexrnl.commons.utils.object.AutoCompare;%0Aimport com.alexrnl.commons.utils.object.AutoHashCode;%0Aimport com.alexrnl.commons.utils.object.Field;%0A%0A
 /**%0A * C
@@ -1900,24 +1900,32 @@
  name.%0A%09 */%0A
+%09@Field%0A
 %09public Stri
@@ -2384,10 +2384,389 @@
 r;%0A%09%7D%0A%09%0A
+%09@Override%0A%09public int hashCode () %7B%0A%09%09return AutoHashCode.getInstance().hashCode(this);%0A%09%7D%0A%09%0A%09@Override%0A%09public boolean equals (final Object obj) %7B%0A%09%09if (!(obj instanceof SubtitleFormat)) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09return AutoCompare.getInstance().compare(this, (SubtitleFormat) obj);%0A%09%7D%0A%09%0A%09@Override%0A%09public String toString () %7B%0A%09%09return getName() + %22%5B%22 + extensions + %22%5D%22;%0A%09%7D%0A%09%0A
 %7D%0A

Add Object method override