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