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 TextNode} instance, and a 009 * {@code Vector}-index location (for that node) - <I>at the same time</I> - when searching HTML 010 * web-pages for document-text. 011 * 012 * <BR /><BR /> 013 * <EMBED CLASS='external-html' DATA-FILE-ID=TEXT_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 TextNode 018 * @see NodeIndex 019 * @see Torello.HTML.NodeSearch.TextNodePeek 020 */ 021public class TextNodeIndex 022 extends NodeIndex<TextNode> 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 textNode} 031 * @param textNode This is the {@link TextNode} being stored in this data-structure. 032 * @throws IndexOutOfBoundsException if {@code index} is negative, this exception is thrown. 033 * @throws NullPointerException if {@code textNode} is null. 034 */ 035 public TextNodeIndex(int index, TextNode textNode) 036 { super(index, textNode); } 037 038 /** 039 * Java's {@code interface Cloneable} requirements. This instantiates a new 040 * {@code TextNodeIndex} with identical {@code TextNode n} and {@code int index} fields. 041 * 042 * @return A new {@code TextNodeIndex} whose internal fields are identical to this one. 043 */ 044 public TextNodeIndex clone() { return new TextNodeIndex(this.index, this.n); } 045}