1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | package Torello.HTML.NodeSearch; import java.util.Vector; import java.util.regex.Pattern; import java.util.function.Predicate; import Torello.HTML.*; import Torello.HTML.NodeSearch.searchLoops.TextNodes.TxNCount; import Torello.Java.LV; /** * Counts instances of {@link TextNode} that match a search-criteria which may be specified using * {@code String-Predicate's}, Regular-Expressions or a {@link TextComparitor}. * * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=TextNodeCount> */ @Torello.JavaDoc.JDHeaderBackgroundImg @Torello.JavaDoc.StaticFunctional public class TextNodeCount { private TextNodeCount() { } // **** all: no sPos, ePos public static int all (Vector<? extends HTMLNode> html, TextComparitor tc, String... compareStr) { return TxNCount.all (html, new LV(html, 0, -1), ARGCHECK.TC(tc, compareStr)); } public static int all (Vector<? extends HTMLNode> html, Pattern p) { return TxNCount.all (html, new LV(html, 0, -1), ARGCHECK.REGEX(p)); } public static int all (Vector<? extends HTMLNode> html, Predicate<String> p) { return TxNCount.all (html, new LV(html, 0, -1), p); } // **** all: CRITERIA INCLUDES sPos, ePos public static int all (Vector<? extends HTMLNode> html, int sPos, int ePos, TextComparitor tc, String... compareStr) { return TxNCount.all (html, new LV(html, sPos, ePos), ARGCHECK.TC(tc, compareStr)); } public static int all (Vector<? extends HTMLNode> html, int sPos, int ePos, Pattern p) { return TxNCount.all (html, new LV(html, sPos, ePos), ARGCHECK.REGEX(p)); } public static int all (Vector<? extends HTMLNode> html, int sPos, int ePos, Predicate<String> p) { return TxNCount.all (html, new LV(html, sPos, ePos), p); } // **** all: no sPos, ePos public static int allExcept (Vector<? extends HTMLNode> html, TextComparitor tc, String... compareStr) { return TxNCount.allExcept (html, new LV(html, 0, -1), ARGCHECK.TC(tc, compareStr)); } public static int allExcept (Vector<? extends HTMLNode> html, Pattern p) { return TxNCount.allExcept (html, new LV(html, 0, -1), ARGCHECK.REGEX(p)); } public static int allExcept (Vector<? extends HTMLNode> html, Predicate<String> p) { return TxNCount.allExcept (html, new LV(html, 0, -1), p); } // **** all: CRITERIA INCLUDES sPos, ePos public static int allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, TextComparitor tc, String... compareStr) { return TxNCount.allExcept (html, new LV(html, sPos, ePos), ARGCHECK.TC(tc, compareStr)); } public static int allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, Pattern p) { return TxNCount.allExcept (html, new LV(html, sPos, ePos), ARGCHECK.REGEX(p)); } public static int allExcept (Vector<? extends HTMLNode> html, int sPos, int ePos, Predicate<String> p) { return TxNCount.allExcept (html, new LV(html, sPos, ePos), p); } } |