package splppp0001;

/**
    Class HTMLHead helps the programmer to build the <HEAD> ... </HEAD>
    part of an HTML page. So far it can tackle only a subset of the
    tags (and of their options) that can be inserted in an HTML page
    header.
*/
public class HTMLHead {
    private String title;
    private String author;
    private String jumper;

    /**
        Constructor. 
    */
    public HTMLHead() {
        title = "";
        author = "";
        jumper = "";
    }

    /**
        It sets the title of the HTML page to the value of 't1'.
    */
    public void setTitle(String tl) {
        title = tl;
    }

    /**
        It sets the author of the HTML page to the value of 'au'.
    */
    public void setAuthor(String au) {
        author = au;
    }

    /**
        It adds a jumper to the URL identified by 'dest' to the HTML page.
    */
    public void addJumper(String dest) {
        jumper = "<META HTTP-EQUIV=\"Refresh\" Content = \"2; URL=" + dest + "\">";
    }

    /**
        Method toString is used to assemble the header components.
    */
    public String toString() {
        String out;
        out = "<HEAD>\n";
        out += "<TITLE>" + title + "</TITLE>\n";
        out += "<META author=\"" + author + "\">\n";
        out += jumper;
        out += "</HEAD>";
        return out;
    }
}
