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.CommentNodes.CmtNCount; 009import Torello.Java.LV; 010 011/** 012 * Counts HTML Comments which match a user-specified criteria, such as a 013 * {@code String-Predicate}, Regular-Expression or {@link TextComparitor}. 014 * 015 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=CommentNodeCount> 016 */ 017@Torello.JavaDoc.JDHeaderBackgroundImg 018@Torello.JavaDoc.StaticFunctional 019public class CommentNodeCount 020{ 021 private CommentNodeCount() { } 022 023 // **** all: no sPos, ePos 024 public static int all (Vector<? extends HTMLNode> html, TextComparitor tc, String... compareStr) 025 { return CmtNCount.all (html, new LV(html, 0, -1), ARGCHECK.TC(tc, compareStr)); } 026 public static int all (Vector<? extends HTMLNode> html, Pattern p) 027 { return CmtNCount.all (html, new LV(html, 0, -1), ARGCHECK.REGEX(p)); } 028 public static int all (Vector<? extends HTMLNode> html, Predicate<String> p) 029 { return CmtNCount.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 CmtNCount.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 CmtNCount.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 CmtNCount.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 CmtNCount.allExcept (html, new LV(html, 0, -1), ARGCHECK.TC(tc, compareStr)); } 043 public static int allExcept (Vector<? extends HTMLNode> html, Pattern p) 044 { return CmtNCount.allExcept (html, new LV(html, 0, -1), ARGCHECK.REGEX(p)); } 045 public static int allExcept (Vector<? extends HTMLNode> html, Predicate<String> p) 046 { return CmtNCount.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 CmtNCount.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 CmtNCount.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 CmtNCount.allExcept (html, new LV(html, sPos, ePos), p); } 055}