1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package Torello.HTML.NodeSearch;

import java.util.*;

import Torello.HTML.*;
import Torello.HTML.NodeSearch.searchLoops.TNPeekIncl;
import Torello.Java.LV;

/**
 * Searches for {@link TagNode} matches, using exactly the same criteria offered by class
 * {@link TagNodePeek}, but also retrieves the corresponding Closing-Tag from the {@code Vector},
 * and returns them, all nodes &amp; between them, <B><I>and</I></B> their corresponding
 * {@code Vector}-index locations as a {@link SubSection}.
 * 
 * <EMBED CLASS='external-html' DATA-FILE-ID=TagNodePeekInclusive>
 */
@Torello.JavaDoc.JDHeaderBackgroundImg
@Torello.JavaDoc.StaticFunctional
public class TagNodePeekInclusive
{
    private TagNodePeekInclusive() { }

    public static SubSection                first                       (Vector<? extends HTMLNode> html, String... htmlTags)
    { return                                TNPeekIncl.nth              (html, 1, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }

    public static SubSection                last                        (Vector<? extends HTMLNode> html, String... htmlTags)
    { return                                TNPeekIncl.nthFromEnd       (html, 1, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }

    public static Vector<SubSection>        all                         (Vector<? extends HTMLNode> html, String... htmlTags)
    { return                                TNPeekIncl.all              (html, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }

    public static Vector<SubSection>        allExcept                   (Vector<? extends HTMLNode> html, String... htmlTags)
    { return                                TNPeekIncl.allExcept        (html, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }

    public static SubSection                first                       (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
    { return                                TNPeekIncl.nth              (html, 1, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }

    public static SubSection                last                        (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
    { return                                TNPeekIncl.nthFromEnd       (html, 1, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }

    public static Vector<SubSection>        all                         (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
    { return                                TNPeekIncl.all              (html, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }

    public static Vector<SubSection>        allExcept                   (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
    { return                                TNPeekIncl.allExcept        (html, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }

    // NEW ADDITIONS - nth and nthFromEnd

    public static SubSection                nth                         (Vector<? extends HTMLNode> html, int nth, String... htmlTags)
    { return                                TNPeekIncl.nth              (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }

    public static SubSection                nthFromEnd                  (Vector<? extends HTMLNode> html, int nth, String... htmlTags)
    { return                                TNPeekIncl.nthFromEnd       (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }

    public static SubSection                nth                         (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, String... htmlTags)
    { return                                TNPeekIncl.nth              (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }

    public static SubSection                nthFromEnd                  (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, String... htmlTags)
    { return                                TNPeekIncl.nthFromEnd       (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
}