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.TextNodes.TxNCount; 009import Torello.Java.LV; 010 011/** 012 * Counts instances of {@link TextNode} that match a search-criteria which may be specified using 013 * {@code String-Predicate's}, Regular-Expressions or a {@link TextComparitor}. 014 * 015 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=TextNodeCount> 016 */ 017@Torello.JavaDoc.JDHeaderBackgroundImg 018@Torello.JavaDoc.StaticFunctional 019public class TextNodeCount 020{ 021 private TextNodeCount() { } 022 023 // **** all: no sPos, ePos 024 public static int all (Vector<? extends HTMLNode> html, TextComparitor tc, String... compareStr) 025 { return TxNCount.all (html, new LV(html, 0, -1), ARGCHECK.TC(tc, compareStr)); } 026 public static int all (Vector<? extends HTMLNode> html, Pattern p) 027 { return TxNCount.all (html, new LV(html, 0, -1), ARGCHECK.REGEX(p)); } 028 public static int all (Vector<? extends HTMLNode> html, Predicate<String> p) 029 { return TxNCount.all (html, new LV(html, 0, -1), p); } 030 031 // **** all: CRITERIA INCLUDES sPos, ePos 032 public static int all (Vector<? extends HTMLNode> html, int sPos, int ePos, TextComparitor tc, String... compareStr) 033 { return TxNCount.all (html, new LV(html, sPos, ePos), ARGCHECK.TC(tc, compareStr)); } 034 public static int all (Vector<? extends HTMLNode> html, int sPos, int ePos, Pattern p) 035 { return TxNCount.all (html, new LV(html, sPos, ePos), ARGCHECK.REGEX(p)); } 036 public static int all (Vector<? extends HTMLNode> html, int sPos, int ePos, Predicate<String> p) 037 { return TxNCount.all (html, new LV(html, sPos, ePos), p); } 038 039 040 // **** all: no sPos, ePos 041 public static int allExcept (Vector<? extends HTMLNode> html, TextComparitor tc, String... compareStr) 042 { return TxNCount.allExcept (html, new LV(html, 0, -1), ARGCHECK.TC(tc, compareStr)); } 043 public static int allExcept (Vector<? extends HTMLNode> html, Pattern p) 044 { return TxNCount.allExcept (html, new LV(html, 0, -1), ARGCHECK.REGEX(p)); } 045 public static int allExcept (Vector<? extends HTMLNode> html, Predicate<String> p) 046 { return TxNCount.allExcept (html, new LV(html, 0, -1), p); } 047 048 // **** all: CRITERIA INCLUDES sPos, ePos 049 public static int allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, TextComparitor tc, String... compareStr) 050 { return TxNCount.allExcept (html, new LV(html, sPos, ePos), ARGCHECK.TC(tc, compareStr)); } 051 public static int allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, Pattern p) 052 { return TxNCount.allExcept (html, new LV(html, sPos, ePos), ARGCHECK.REGEX(p)); } 053 public static int allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, Predicate<String> p) 054 { return TxNCount.allExcept (html, new LV(html, sPos, ePos), p); } 055}