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.TNGet;
009import Torello.Java.LV;
010
011/**
012 * Searches an HTML-Vector for HTML-Tag matches based on Tag-Name and whether or not the Tag
013 * is an Opening-Tag, and then returns those matches as instances of {@link TagNode}.
014 * 
015 * <BR /><BR /><EMBED CLASS="external-html" DATA-FILE-ID=TagNodeGet>
016 */
017@Torello.HTML.Tools.JavaDoc.JDHeaderBackgroundImg
018@Torello.HTML.Tools.JavaDoc.StaticFunctional
019public class TagNodeGet
020{
021    private TagNodeGet() { }
022
023    public static TagNode first             (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
024    { return TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.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 TNGet.nthFromEnd               (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
058
059}