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