001package Torello.HTML;
002
003/**
004 * If a programmer is expecting an HTML-Page {@code Vector} position-index to contain a
005 * {@code TagNode} whose <CODE>TagNode&#46;isClosing</CODE> field to be set to {@code TRUE} and it
006 * is not, then this exception should be thrown.
007 * 
008 * <BR /><BR /><B CLASS=JDDescLabel>NOTE:</B>
009 * 
010 * <BR />This {@code Exception} differs from the similarly-named {@link ClosingTagNodeException},
011 * in that, here the programmer is specifying that the error which has occured is that the user
012 * expected to find a <B>'closing version'</B> of a {@link TagNode} - one where it's
013 * {@link TagNode#isClosing isClosing} field had been set to {@code FALSE}.
014 * 
015 * <BR /><BR />In {@code ClosingTagNodeException}, the user has attempted to perform some operation
016 * on a {@code TagNode} element which is not permitted to be done to or by {@code TagNode's} whose
017 * {@code 'isClosing'} field is set to {@code TRUE}.  They are similar, but the origins of the 
018 * throws are quite different.  In the latter, usually a user has performed a {@link TagNode}
019 * operation on the wrong type of {@code TagNode}.
020 */
021public class ClosingTagNodeExpectedException extends TagNodeExpectedException
022{
023    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX> */
024    public static final long serialVersionUID = 1;
025
026    /** Constructs an {@code ClosingTagNodeExpectedException} with no detail message. */
027    public ClosingTagNodeExpectedException()
028    { super(); }
029
030    /**
031     * Constructs an {@code ClosingTagNodeExpectedException} with the specified detail message.
032     * @param message the detail message.
033     */
034    public ClosingTagNodeExpectedException(String message)
035    { super(message); }
036
037    /**
038     * Constructs a new exception with the specified detail message and cause.
039     * 
040     * <BR /><BR /><B CLASS=JDDescLabel>NOTE:</B>
041     * 
042     * <BR /><BR />The detail message associated with cause is not automatically incorporated into
043     * this exception's detail message.
044     * 
045     * @param message The detail message (which is saved for later retrieval by the
046     * {@code Throwable.getMessage()} method).
047     * 
048     * @param cause the cause (which is saved for later retrieval by the {@code Throwable.getCause()}
049     * method).  (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
050     */
051    public ClosingTagNodeExpectedException(String message, Throwable cause)
052    { super(message, cause); }
053
054    /**
055     * Constructs a new exception with the specified cause and a detail message of
056     * {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail
057     * message of cause).
058     * This constructor is useful for exceptions that are little more than wrappers for other
059     * {@code Throwables.}
060     * 
061     * @param cause The cause (which is saved for later retrieval by the {@code Throwable.getCause()}
062     * method).  (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
063     */
064    public ClosingTagNodeExpectedException(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 ClosingTagNodeExpectedException(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}