Package Torello.HTML

Class TagNodeIndex

  • All Implemented Interfaces:, java.lang.CharSequence, java.lang.Cloneable, java.lang.Comparable<Replaceable>, Replaceable

    public class TagNodeIndex
    extends NodeIndex<TagNode>
    implements java.lang.CharSequence,, java.lang.Cloneable
    This 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 TagNode instance, and a Vector-index location (for that node) - at the same time - when searching HTML web-pages for HTML tags.

    TagNodeIndex: TagNode '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 'TagNode' inside a vectorized-html web-page, and also the TagNode itself -simultaneously. The constructor of this class accepts an index, and a TagNode, and saves both of these datum as public, final fields of this class. The 'Peek' suite of search methods in package NodeSearch return instances of this class.

    STALE DATA NOTE: If a vectorized-html webpage is modified after any of these Node + Index classes 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.

    The following public class definitions incorporate Vector-index and Vector-node-content into a single "combined unit" class:

    It is important to remember that Vector-position (a.k.a. "Vector-index") information that is stored inside Object instances of these (extremely-simple) classes will become stale, immediately if nodes are ever added or removed to the underlying Vector from which these Node + Index object-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 / HNLI classes.
    See Also:
    TagNode, NodeIndex, TagNodePeek, InnerTagPeek, Serialized Form

    • Field Detail

      • serialVersionUID

        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface Using the Serializable Implementation 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;
    • Constructor Detail

      • TagNodeIndex

        🡅  🡇    
        public TagNodeIndex​(int index,
                            TagNode tagNode)
        Constructor for this class.
        index - This is the index of vectorized-page that contains tagNode
        tagNode - This is the TagNode being stored in this data-structure.
        java.lang.IndexOutOfBoundsException - if index is negative, this exception is thrown.
        java.lang.NullPointerException - if tagNode is null.
        Exact Constructor Body:
         super(index, tagNode);
    • Method Detail

      • clone

        public TagNodeIndex clone()
        Java's interface Cloneable requirements. This instantiates a new TagNodeIndex with identical TagNode n and int index fields.
        clone in class java.lang.Object
        A new TagNodeIndex whose internal fields are identical to this one.
        Exact Method Body:
         return new TagNodeIndex(this.index, this.n);