001package myhw3.data;
002
003import java.lang.Comparable;
004
005/**
006 * <p>An immutable video object.</p>
007 *
008 * <p>Comprises a triple: title, year, director.</p>
009 *
010 * <p><b>Object invariant:</b></p>
011 * <ul>
012 *   <li>title is non-null, no leading or final spaces, not empty string</li>
013 *   <li>year is greater than 1800, less than 5000</li>
014 *   <li>director is non-null, no leading or final spaces, not empty string</li>
015 * </ul>
016 * @see Data
017 */
018public interface Video extends Comparable<Video> {
019
020        /**
021         *  Return the value of the attribute.
022         */
023        public String director();
024
025        /**
026         *  Return the value of the attribute.
027         */
028        public String title();
029
030        /**
031         *  Return the value of the attribute.
032         */
033        public int year();
034
035        /**
036         * Compare the attributes of this object with those of thatObject.
037         * @param thatObject the Object to be compared.
038         * @return true if this object is the same as the obj argument;
039         *  false otherwise.
040         */
041        public boolean equals(Object thatObject);
042
043        /**
044         * Return a hash code value for this object using the algorithm from Bloch:
045         * fields are added in the following order: title, year, director.
046         */
047        public int hashCode();
048
049        /**
050         * Compares the attributes of this object with those of thatObject, in
051         * the following order: title, year, director.
052         * @param that the Video to be compared.
053         * @return a negative integer, zero, or a positive integer as this
054         *  object is less than, equal to, or greater than that object.
055         */
056        public int compareTo(Video that);
057
058        /**
059         * Return a string representation of the object in the following format:
060         * <code>"title (year) : director"</code>.
061         */
062        public String toString();
063}