001package Torello.HTML.NodeSearch;
002
003import java.util.Vector;
004import java.util.regex.Pattern;
005import java.util.function.Predicate;
006
007import Torello.HTML.*;
008import Torello.HTML.NodeSearch.searchLoops.TagNodes.TNPoll;
009import Torello.Java.LV;
010
011/**
012 * Extracts and returns Tags from an HTML-{@code Vector} that match a user-specified criteria
013 * based on Tag-Name and whether the tag is an openning or closing tag.
014 * 
015 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=TagNodePoll>
016 */
017@Torello.JavaDoc.JDHeaderBackgroundImg
018@Torello.JavaDoc.StaticFunctional
019public class TagNodePoll
020{
021    private TagNodePoll() { }
022
023    public static TagNode                first                       (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
024    { return                             TNPoll.nth                  (html, 1, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
025
026    public static TagNode                last                        (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
027    { return                             TNPoll.nthFromEnd           (html, 1, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
028
029    public static Vector<TagNode>        all                         (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
030    { return                             TNPoll.all                  (html, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
031
032    public static Vector<TagNode>        allExcept                   (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
033    { return                             TNPoll.allExcept            (html, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
034
035    public static TagNode                first                       (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags)
036    { return                             TNPoll.nth                  (html, 1, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
037
038    public static TagNode                last                        (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags)
039    { return                             TNPoll.nthFromEnd           (html, 1, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
040
041    public static Vector<TagNode>        all                         (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags)
042    { return                             TNPoll.all                  (html, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
043
044    public static Vector<TagNode>        allExcept                   (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags)
045    { return                             TNPoll.allExcept            (html, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
046
047    public static TagNode                nth                         (Vector<? extends HTMLNode> html, int nth, TC tagCriteria, String... htmlTags)
048    { return                             TNPoll.nth                  (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
049
050    public static TagNode                nthFromEnd                  (Vector<? extends HTMLNode> html, int nth, TC tagCriteria, String... htmlTags)
051    { return                             TNPoll.nthFromEnd           (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
052
053    public static TagNode                nth                         (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, TC tagCriteria, String... htmlTags)
054    { return                             TNPoll.nth                  (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
055
056    public static TagNode                nthFromEnd                  (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, TC tagCriteria, String... htmlTags)
057    { return                             TNPoll.nthFromEnd           (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
058}