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.TNRemove;
009import Torello.Java.LV;
010
011/**
012 * Removes all HTML-Tag's from Vectorized-HTML that match a search-criteria based on Tag-Name and
013 * whether the tag is an Opening-Tag or Closing-Tag, then returns a count of the number of tags
014 * that were removed.
015 * 
016 * <BR /><BR /><EMBED CLASS="external-html" DATA-FILE-ID=TagNodeRemove>
017 */
018@Torello.HTML.Tools.JavaDoc.JDHeaderBackgroundImg
019@Torello.HTML.Tools.JavaDoc.StaticFunctional
020public class TagNodeRemove
021{
022    private TagNodeRemove() { }
023
024    public static int first (Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
025    { return TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.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 TNRemove.nthFromEnd (html, ARGCHECK.n(nth, html), new LV(html, sPos, ePos), tagCriteria, ARGCHECK.htmlTags(htmlTags)); }
059}