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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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.InnerTags.ITCount;
import Torello.Java.LV;

/**
 * Searches Vectorized-HTML for Tag-Matches using Inner-Tag (attribute) names & values as
 * search-criteria, and returns the number of matches that were found.
 * 
 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=InnerTagCount> 
 */
@Torello.JavaDoc.JDHeaderBackgroundImg
@Torello.JavaDoc.StaticFunctional
public class InnerTagCount
{
    private InnerTagCount() { }

    // **** Find-First, CRITERIA: htmlTag, sPos, ePos
    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String htmlTag, String innerTag)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), ARGCHECK.TRUE); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String htmlTag, String innerTag, TextComparitor tc, String... compareStr)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), ARGCHECK.TC(tc, compareStr)); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String htmlTag, String innerTag, Pattern p)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), ARGCHECK.REGEX(p)); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String htmlTag, String innerTag, Predicate<String> attributeValuePred)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), attributeValuePred); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, Predicate<TagNode> p, String... htmlTags)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), p, ARGCHECK.htmlTags(htmlTags)); }


    // **** Find-All, CRITERIA: htmlTag
    public static int all(Vector<? extends HTMLNode> html, String htmlTag, String innerTag)
    { return ITCount.ALL(html, new LV(html, 0, -1), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), ARGCHECK.TRUE); }

    public static int all(Vector<? extends HTMLNode> html, String htmlTag, String innerTag, TextComparitor tc, String... compareStr)
    { return ITCount.ALL(html, new LV(html, 0, -1), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), ARGCHECK.TC(tc, compareStr)); }

    public static int all(Vector<? extends HTMLNode> html, String htmlTag, String innerTag, Pattern p)
    { return ITCount.ALL(html, new LV(html, 0, -1), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), ARGCHECK.REGEX(p)); }

    public static int all(Vector<? extends HTMLNode> html, String htmlTag, String innerTag, Predicate<String> attributeValuePred)
    { return ITCount.ALL(html, new LV(html, 0, -1), ARGCHECK.htmlTag(htmlTag), ARGCHECK.innerTag(innerTag), attributeValuePred); }

    public static int all(Vector<? extends HTMLNode> html, Predicate<TagNode> p, String... htmlTags)
    { return ITCount.ALL(html, new LV(html, 0, -1), p, ARGCHECK.htmlTags(htmlTags)); }


    // **** Find-First, CRITERIA: sPos, ePos
    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String innerTag)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), null, ARGCHECK.innerTag(innerTag), ARGCHECK.TRUE); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String innerTag, TextComparitor tc, String... compareStr)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), null, ARGCHECK.innerTag(innerTag), ARGCHECK.TC(tc, compareStr)); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String innerTag, Pattern p)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), null, ARGCHECK.innerTag(innerTag), ARGCHECK.REGEX(p)); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, String innerTag, Predicate<String> attributeValuePred)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), null, ARGCHECK.innerTag(innerTag), attributeValuePred); }

    public static int all(Vector<? extends HTMLNode> html, int sPos, int ePos, Predicate<TagNode> p)
    { return ITCount.ALL(html, new LV(html, sPos, ePos), p); }


    // **** Find-All, ALL-CRITERIA-NULL
    public static int all(Vector<? extends HTMLNode> html, String innerTag)
    { return ITCount.ALL(html, new LV(html, 0, -1), null, ARGCHECK.innerTag(innerTag), ARGCHECK.TRUE); }

    public static int all(Vector<? extends HTMLNode> html, String innerTag, TextComparitor tc, String... compareStr)
    { return ITCount.ALL(html, new LV(html, 0, -1), null, ARGCHECK.innerTag(innerTag), ARGCHECK.TC(tc, compareStr)); }

    public static int all(Vector<? extends HTMLNode> html, String innerTag, Pattern p)
    { return ITCount.ALL(html, new LV(html, 0, -1), null, ARGCHECK.innerTag(innerTag), ARGCHECK.REGEX(p)); }

    public static int all(Vector<? extends HTMLNode> html, String innerTag, Predicate<String> attributeValuePred)
    { return ITCount.ALL(html, new LV(html, 0, -1), null, ARGCHECK.innerTag(innerTag), attributeValuePred); }

    public static int all(Vector<? extends HTMLNode> html, Predicate<TagNode> p)
    { return ITCount.ALL(html, new LV(html, 0, -1), p); }
}