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.TagNodes.TNFind; 009import Torello.Java.LV; 010 011/** 012 * Searches an HTML-Vector for HTML-Tag's that match a specified search-criteria based on Tag-Name 013 * and whether the Tag is an opening or closing tag, and returns the Vector-indices for those 014 * matches. 015 * 016 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=TagNodeFind> 017 */ 018@Torello.JavaDoc.JDHeaderBackgroundImg 019@Torello.JavaDoc.StaticFunctional 020public class TagNodeFind 021{ 022 private TagNodeFind() { } 023 024 public static int first (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags) 025 { return TNFind.nth (html, 1, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 026 027 public static int last (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags) 028 { return TNFind.nthFromEnd (html, 1, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 029 030 public static int[] all (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags) 031 { return TNFind.all (html, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 032 033 public static int[] allExcept (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags) 034 { return TNFind.allExcept (html, new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 035 036 public static int first (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags) 037 { return TNFind.nth (html, 1, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 038 039 public static int last (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags) 040 { return TNFind.nthFromEnd (html, 1, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 041 042 public static int[] all (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags) 043 { return TNFind.all (html, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 044 045 public static int[] allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, TC tagCriteria, String... htmlTags) 046 { return TNFind.allExcept (html, new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 047 048 public static int nth (Vector<? extends HTMLNode> html, int nth, TC tagCriteria, String... htmlTags) 049 { return TNFind.nth (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 050 051 public static int nthFromEnd (Vector<? extends HTMLNode> html, int nth, TC tagCriteria, String... htmlTags) 052 { return TNFind.nthFromEnd (html, ARGCHECK.n(nth, html), new LV(html, 0, -1), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 053 054 public static int nth (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, TC tagCriteria, String... htmlTags) 055 { return TNFind.nth (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 056 057 public static int nthFromEnd (Vector<? extends HTMLNode> html, int nth, int sPos, int ePos, TC tagCriteria, String... htmlTags) 058 { return TNFind.nthFromEnd (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); } 059}