- All Implemented Interfaces:
public class TextNodeIndex extends NodeIndex<TextNode> implements java.lang.CharSequence, java.io.Serializable, java.lang.CloneableThis is a simple data-class whose primary reason for development was to provide a way for the NodeSearch Package classes to simultaneously return both a
TextNodeinstance, and a
Vector-index location (for that node) - at the same time - when searching HTML web-pages for document-text.
TextNodeIndex: TextNode 'plus' the vector-index
This class is just an extremely simple data-structure-class used, generally, for returning both the index of an instance-node of
class 'TextNode'inside a vectorized-html web-page, and also the
TextNodeitself -simultaneously. The constructor of this class accepts an index, and a
TextNode,and saves both of these datum as
public, finalfields of this class. The
'Peek'suite of search methods in
package NodeSearchreturn instances of this class.
STALE DATA NOTE: If a vectorized-html webpage is modified after any of these
Node + Indexclasses are created / instantiated, and nodes are added or removed from the webpage, then the (integer) index data inside these classes would have become stale when they are next accessed.
public classdefinitions incorporate
Vector-node-content into a single "combined unit" class:
class NodeIndex- is abstract, and the parent of the three above.
class SubSection- a sublist of nodes
It is important to remember that
Vector-position (a.k.a. "
Vector-index") information that is stored inside
Objectinstances of these (extremely-simple) classes will become stale, immediately if nodes are ever added or removed to the underlying
Vectorfrom which these
Node + Indexobject-classes are created. This is because the 'index' is just a pointer into the
Vector! For data-retrieval operations, these classes can prove highly useful. For page-modification operations, it is better to use the
HTML Iterator / HNLIclasses.
Hi-Lited Source-Code: File Size: 1,704 Bytes Line Count: 43 '\n' Characters Found
Methods: interface java.lang.Cloneable Modifier and Type Method
Methods inherited from class Torello.HTML.NodeIndex
addAllInto, addAllInto, charAt, currentNodes, currentSize, equals, firstCurrentNode, hashCode, lastCurrentNode, length, newNodeIndex, originalLocationEnd, originalLocationStart, originalSize, subSequence, toString, update
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, length, subSequence, toString
public static final long serialVersionUIDThis fulfils the SerialVersion UID requirement for all classes that implement Java's
interface java.io.Serializable. Using the
SerializableImplementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
- See Also:
- Constant Field Values
- Exact Field Declaration Expression:
public static final long serialVersionUID = 1;
public TextNodeIndex(int index, TextNode textNode)Constructor for this class.
index- This is the index of vectorized-page that contains
textNode- This is the
TextNodebeing stored in this data-structure.
indexis negative, this exception is thrown.
- Exact Constructor Body:
public TextNodeIndex clone()Java's
interface Cloneablerequirements. This instantiates a new
- A new
TextNodeIndexwhose internal fields are identical to this one.
- Exact Method Body:
return new TextNodeIndex(this.index, this.n);