001package Torello.HTML;
002
003/**
004 * If an HTML-Page {@code Vector} index-position should contain a {@code TagNode} whose
005 * <CODE>TagNode&#46;isClosing</CODE> field is set {@code FALSE}, <I>but that field is
006 * {@code TRUE},</I> then this exception should throw.
007 * 
008 * <BR /><BR /><B CLASS=JDDescLabel>Using this Exception:</B>
009 * 
010 * <BR />This type of situation is good to check when a method or function receives an
011 * {@code int[]} position-{@code array} generated by one of the Node-Search Package {@code FIND}
012 * methods.
013 * 
014 * <BR /><BR />Usually such position integer-arrays point to lists of nodes, and guaranteeing that
015 * <I>each node pointed-to by that array is, in fact, an Open-TagNode</I>, is usually a good check
016 * to perform.
017 */
018public class OpeningTagNodeExpectedException extends TagNodeExpectedException
019{
020    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX> */
021    public static final long serialVersionUID = 1;
022
023    /** Constructs an {@code OpeningTagNodeExpectedException} with no detail message. */
024    public OpeningTagNodeExpectedException()
025    { super(); }
026
027    /**
028     * Constructs an {@code OpeningTagNodeExpectedException} with the specified detail message.
029     * @param message the detail message.
030     */
031    public OpeningTagNodeExpectedException(String message)
032    { super(message); }
033
034    /**
035     * Constructs a new exception with the specified detail message and cause.
036     * 
037     * <BR /><BR /><B CLASS=JDDescLabel>NOTE:</B>
038     * 
039     * <BR /><BR />The detail message associated with cause is not automatically incorporated into
040     * this exception's detail message.
041     * 
042     * @param message The detail message (which is saved for later retrieval by the
043     * {@code Throwable.getMessage()} method).
044     * 
045     * @param cause the cause (which is saved for later retrieval by the
046     * {@code Throwable.getCause()} method).  (A null value is permitted, and indicates that the
047     * cause is nonexistent or unknown.)
048     */
049    public OpeningTagNodeExpectedException(String message, Throwable cause)
050    { super(message, cause); }
051
052    /**
053     * Constructs a new exception with the specified cause and a detail message of
054     * {@code (cause==null ? null : cause.toString())} (which typically contains the class and
055     * detail message of cause).
056     * 
057     * <BR /><BR />This constructor is useful for exceptions that are little more than wrappers for
058     * other {@code Throwables.}
059     * 
060     * @param cause The cause (which is saved for later retrieval by the
061     * {@code Throwable.getCause()} method).  (A null value is permitted, and indicates that the
062     * cause is nonexistent or unknown.)
063     */
064    public OpeningTagNodeExpectedException(Throwable cause)
065    { super(cause); }
066
067    /**
068     * Builds a new exception with a consistently worded error message.  The parameter
069     * {@code 'pos'} is used to identify the {@code Vector} location where the error has occurred.
070     * 
071     * @param pos This is the {@code Vector} index where an Opening HTML {@code TagNode} Element
072     * was expected.
073     */
074    public OpeningTagNodeExpectedException(int pos)
075    {
076        this(
077            "The Object reference at vector location [" + pos + "] was an instance of TagNode, but " +
078            "it's 'isClosing' field was set to TRUE.  An Opening HTML Element (not a closing one) was " +
079            "expected here."
080        );
081    } 
082}