001package Torello.HTML;
002
003import java.util.Comparator;
004import java.io.Serializable;
005
006/**
007 * This is a simple data-class whose primary reason for development was to provide a way for the
008 * NodeSearch Package classes to simultaneously return both a {@link CommentNode} instance, and a
009 * {@code Vector}-index location (for that node) - <I>at the same time</I> - when searching HTML
010 * web-pages for HTML comments.
011 * 
012 * <BR /><BR />
013 * <EMBED CLASS='external-html' DATA-FILE-ID=COMMENT_NODE_INDEX>
014 * <!-- <EMBED CLASS='external-html' DATA-FILE-ID=NODE_INDEX> -->
015 * <EMBED CLASS='external-html' DATA-FILE-ID=IMPLEMENTS_REPLACE>
016 * 
017 * @see CommentNode
018 * @see NodeIndex
019 * @see Torello.HTML.NodeSearch.CommentNodePeek
020 */
021public class CommentNodeIndex
022    extends NodeIndex<CommentNode>
023    implements CharSequence, Serializable, Cloneable
024{
025    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
026    public static final long serialVersionUID = 1;
027
028    /**
029     * Constructor for this class. 
030     * @param index This is the index of vectorized-page that contains {@code commentNode}
031     * @param commentNode The {@link CommentNode} being stored in this data-structure.
032     * @throws IndexOutOfBoundsException if {@code index} is negative, this exception is thrown.
033     * @throws NullPointerException if {@code commentNode} is null.
034     */
035    public CommentNodeIndex(int index, CommentNode commentNode)
036    { super(index, commentNode); }
037
038    /**
039     * Java's {@code interface Cloneable} requirements.  This instantiates a new
040     * {@code CommentNodeIndex} with identical {@code CommentNode n} and {@code int index} fields.
041     * 
042     * @return A new {@code CommentNodeIndex} whose internal fields are identical to this one.
043     */
044    public CommentNodeIndex clone() { return new CommentNodeIndex(this.index, this.n); }
045}