FileDocCategorySizeDatePackage
Show.javaAPI DocExample1648Sun Sep 02 14:59:02 BST 2001chap4

Show

public class Show extends Object implements Comparable

Fields Summary
private String
title
private int
channel
private Date
startTime
private Date
endTime
Constructors Summary
public Show(String title, int channel, Date startTime, Date endTime)

        this.title = title;
        this.channel = channel;
        this.startTime = startTime;
        this.endTime = endTime;
    
Methods Summary
public intcompareTo(java.lang.Object obj)

        Show rhs = (Show) obj;
        int comparison = this.startTime.compareTo(rhs.startTime);
        if (comparison == 0) {
            if (this.channel < rhs.channel) {
                comparison = -1;
            } else if (this.channel > rhs.channel) {
                comparison = 1;
            }
        }
        return comparison;
    
public booleanequals(java.lang.Object obj)

        if (obj instanceof Show) {
            Show rhs = (Show) obj;
            return this.startTime.equals(rhs.startTime)
                    && this.channel == rhs.channel;
        }
        return false;
    
public intgetChannel()

        return this.channel;
    
public java.util.DategetEndTime()

        return this.endTime;
    
public java.util.DategetStartTime()

        return this.startTime;
    
public java.lang.StringgetTitle()

        return this.title;
    
public java.lang.StringtoString()

        SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");
        return "Channel " + this.channel
                + " from "
                + sdf.format(this.startTime) + " to "
                + sdf.format(this.endTime)
                + ": " + this.title;