001package Torello.HTML.NodeSearch;
002
003import java.util.*;
004
005import Torello.HTML.*;
006import Torello.HTML.NodeSearch.searchLoops.TNPeekIncl;
007import Torello.Java.LV;
008
009/**
010 * Searches for {@link TagNode} matches, using exactly the same criteria offered by class
011 * {@link TagNodePeek}, but also retrieves the corresponding Closing-Tag from the {@code Vector},
012 * and returns them, all nodes &amp; between them, <B><I>and</I></B> their corresponding
013 * {@code Vector}-index locations as a {@link SubSection}.
014 * 
015 * <EMBED CLASS="external-html" DATA-FILE-ID=TagNodePeekInclusive>
016 */
017@Torello.HTML.Tools.JavaDoc.JDHeaderBackgroundImg
018@Torello.HTML.Tools.JavaDoc.StaticFunctional
019public class TagNodePeekInclusive
020{
021    private TagNodePeekInclusive() { }
022
023    public static SubSection                first                       (Vector<? extends HTMLNode> html, String... htmlTags)
024    { return                                TNPeekIncl.nth              (html, 1, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }
025
026    public static SubSection                last                        (Vector<? extends HTMLNode> html, String... htmlTags)
027    { return                                TNPeekIncl.nthFromEnd       (html, 1, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }
028
029    public static Vector<SubSection>        all                         (Vector<? extends HTMLNode> html, String... htmlTags)
030    { return                                TNPeekIncl.all              (html, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }
031
032    public static Vector<SubSection>        allExcept                   (Vector<? extends HTMLNode> html, String... htmlTags)
033    { return                                TNPeekIncl.allExcept        (html, new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }
034
035    public static SubSection                first                       (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
036    { return                                TNPeekIncl.nth              (html, 1, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
037
038    public static SubSection                last                        (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
039    { return                                TNPeekIncl.nthFromEnd       (html, 1, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
040
041    public static Vector<SubSection>        all                         (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
042    { return                                TNPeekIncl.all              (html, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
043
044    public static Vector<SubSection>        allExcept                   (Vector<? extends HTMLNode> html, int sPos, int ePos, String... htmlTags)
045    { return                                TNPeekIncl.allExcept        (html, new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
046
047    // NEW ADDITIONS - nth and nthFromEnd
048
049    public static SubSection                nth                         (Vector<? extends HTMLNode> html, int nth, String... htmlTags)
050    { return                                TNPeekIncl.nth              (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }
051
052    public static SubSection                nthFromEnd                  (Vector<? extends HTMLNode> html, int nth, String... htmlTags)
053    { return                                TNPeekIncl.nthFromEnd       (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), ARGCHECK.htmlTags(htmlTags)); }
054
055    public static SubSection                nth                         (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, String... htmlTags)
056    { return                                TNPeekIncl.nth              (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
057
058    public static SubSection                nthFromEnd                  (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, String... htmlTags)
059    { return                                TNPeekIncl.nthFromEnd       (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), ARGCHECK.htmlTags(htmlTags)); }
060}