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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
package Torello.HTML.Tools.JavaDoc;

import Torello.HTML.*;
import Torello.HTML.NodeSearch.*;

import Torello.Java.StrReplace;
import Torello.Java.StringParse;
import Torello.Java.UnreachableError;

import Torello.Java.Shell.C;

import java.util.*;
import java.io.*;

/**
 * <B STYLE='color:darkred;'>Java Doc HTML-File Reader:</B>
 * 
 * Find and retrieve the entities of any of the five Java Doc generated Detail Sections.
 * 
 * <BR /><BR /><EMBED CLASS="external-html" DATA-FILE-ID=DET_MAIN_DESC>
 */
@StaticFunctional
public class Details
{
    private Details() { }

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=JD_CTOR_DM>
     * <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_WIDGET DATA-P1=Constructor> 
     */
    protected static final String JAVADOC_CONSTRUCTOR_DETAIL_MARKER =
        "==== CONSTRUCTOR DETAIL ====";

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=JD_FIELD_DM>
     * <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_WIDGET DATA-P1=Field> 
     */
    protected static final String JAVADOC_FIELD_DETAIL_MARKER =
        "==== FIELD DETAIL ====";

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=JD_METH_DM>
     * <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_WIDGET DATA-P1=Method>  
     */
    protected static final String JAVADOC_METHOD_DETAIL_MARKER =
        "==== METHOD DETAIL ====";

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=JD_EC_DM> 
     * <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_WIDGET DATA-P1='Enum Constant'> 
     */
    protected static final String JAVADOC_ENUM_CONST_DETAIL_MARKER =
        "==== ENUM CONSTANT DETAIL ====";

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=JD_AE_DM>
     * <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_WIDGET DATA-P1='Element'>
     */
    protected static final String JAVADOC_ANNOTATION_ELEMENT_DETAIL_MARKER =
        "==== ANNOTATION TYPE MEMBER DETAIL ====";

    /**
     * Converts a Java {@code 'Entity'} to one of the 'Detail Section' {@code MARKER String's}.
     *
     * @param section This may be any of the entities, except {@link Entity#INNER_CLASS}.
     * 
     * @return The appropriate {@code 'MARKER'}, all of which are listed in the 'Fields' section
     * at the top of this class.
     */
    protected static String entityToMarker(Entity section)
    {
        if (section == null) throw new NullPointerException
            ("You have passed null to parameter 'section'.  This is not allowed here.");

        switch (section)
        {
            case METHOD:            return JAVADOC_METHOD_DETAIL_MARKER;
            case FIELD:             return JAVADOC_FIELD_DETAIL_MARKER;
            case CONSTRUCTOR:       return JAVADOC_CONSTRUCTOR_DETAIL_MARKER;
            case ENUM_CONSTANT:     return JAVADOC_ENUM_CONST_DETAIL_MARKER;
            case ANNOTATION_ELEM:   return JAVADOC_ANNOTATION_ELEMENT_DETAIL_MARKER;

            case INNER_CLASS:
                throw new DetailsException(
                    "You have passed 'innerClass' to this method in class Details, but inner-" +
                    "classes do not have a 'Detail' section."
                );

            default:
                System.out.println("There are no other Entities.");
                throw new UnreachableError();
        }
    }

    /**
     * All Detail-Marker {@code CommentNode} positions that are available on the page.
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return The same {@code int[]} returned by {@code CommentNodeFind.all}
     * @see CommentNodeFind
     */
    public static int[] allEntityMarkers(Vector<HTMLNode> javaDocHTMLCIETPage)
    {
        return CommentNodeFind.all(
            javaDocHTMLCIETPage, TextComparitor.CN_OR,
            JAVADOC_CONSTRUCTOR_DETAIL_MARKER,
            JAVADOC_FIELD_DETAIL_MARKER,
            JAVADOC_METHOD_DETAIL_MARKER,
            JAVADOC_ENUM_CONST_DETAIL_MARKER,
            JAVADOC_ANNOTATION_ELEMENT_DETAIL_MARKER
        );
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Retrieve Details - Entire 'Details' Section
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * Retrieves all HTML description/explanation 'Detail Section' elements inside the provided
     * page, for a specific type of detail.  If parameter {@code 'section'} receives
     * {@code Entity.METHOD}, all of the HTML 'Method Details' will be provided, as instances of
     * {@code SubSection}, in the returned {@code Vector}.
     * 
     * <BR /><BR /><B>NOTE:</B> This method is identical to
     * {@link #sectionAllDetailsDP(Vector, Entity)}, except that it returns {@link SubSection}
     * instances, rather than {@link DotPair} instances.
     * 
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * 
     * @param section Specifies which 'Detail Section' is being requested.  Note that 
     * {@code Entity.INNER_CLASS} may not be used here.
     * 
     * @return A call to a {@code Peek} method is made, so this means that {@code SubSection} is
     * being returned.  The {@code Vector<SubSection>} will contain the HTML, and the location in
     * the page {@code Vector} for every detail (HTML Explanation) available in the specified
     * 'Detail Section'.
     * 
     * @see #hasAnnotationElemDetails(Vector)
     * @see #detailsSection(Vector, String)
     * @see InnerTagPeekInclusive
     * 
     * @throws DetailsException If {@code Entity.INNER_CLASS} is pssed to parameter
     * {@code 'section'}
     */
    public static Vector<SubSection> sectionAllDetails
        (Vector<HTMLNode> javaDocHTMLCIETPage, Entity section)
    {
        // The Annotation Element Details have HTML that differs slightly from the other four
        // detail sections for the other four 'Entities'

        if (section == Entity.ANNOTATION_ELEM)
        {
            DotPair aeDetailsSection = hasAnnotationElemDetails(javaDocHTMLCIETPage);

            if (aeDetailsSection == null) return new Vector<>();

            return InnerTagPeekInclusive.all(
                javaDocHTMLCIETPage, aeDetailsSection.start, aeDetailsSection.end,
                "section", "role", TextComparitor.EQ, "region"
            );
        }
        else
        {
            DotPair detailsSection = detailsSection(javaDocHTMLCIETPage, entityToMarker(section));

            if (detailsSection == null) return new Vector<>();

            return InnerTagPeekInclusive.all(
                javaDocHTMLCIETPage, detailsSection.start, detailsSection.end,
                "ul", "class", TextComparitor.C, "blockList", "blockListLast"
            );
        }
    }

    /**
     * Retrieves all HTML description/explanation 'Detail Section' elements inside the provided
     * page, for a specific type of detail.  If parameter {@code 'section'} receives
     * {@code Entity.METHOD}, all of the HTML 'Method Details' will be provided, as instances of
     * {@code SubSection}, in the returned {@code Vector}.
     * 
     * <BR /><BR /><B>NOTE:</B> This method is identical to
     * {@link #sectionAllDetails(Vector, Entity)}, except that it returns {@link DotPair}
     * instances, rather than {@link SubSection} instances.
     * 
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * 
     * @param section Specifies which 'Detail Section' is being requested.  Note that 
     * {@code Entity.INNER_CLASS} may not be used here.
     * 
     * @return A call to a {@code Find} method is made, so this means that {@code DotPair} is
     * being returned.  The {@code Vector<DotPair>} will contain the HTML, and the location in
     * the page {@code Vector} for every detail (HTML Explanation) available in the specified
     * 'Detail Section'.
     * 
     * @see #hasAnnotationElemDetails(Vector)
     * @see #detailsSection(Vector, String)
     * @see InnerTagFindInclusive
     * 
     * @throws DetailsException If {@code Entity.INNER_CLASS} is pssed to parameter
     * {@code 'section'}
     */
    public static Vector<DotPair> sectionAllDetailsDP
        (Vector<HTMLNode> javaDocHTMLCIETPage, Entity section)
    {
        // The Annotation Element Details have HTML that differs slightly from the other four
        // detail sections for the other four 'Entities'

        if (section == Entity.ANNOTATION_ELEM)
        {
            DotPair aeDetailsSection = hasAnnotationElemDetails(javaDocHTMLCIETPage);

            if (aeDetailsSection == null) return new Vector<>();

            return InnerTagFindInclusive.all(
                javaDocHTMLCIETPage, aeDetailsSection.start, aeDetailsSection.end,
                "section", "role", TextComparitor.EQ, "region"
            );
        }
        else
        {
            DotPair detailsSection = detailsSection(javaDocHTMLCIETPage, entityToMarker(section));

            if (detailsSection == null) return new Vector<>();

            return InnerTagFindInclusive.all(
                javaDocHTMLCIETPage, detailsSection.start, detailsSection.end,
                "ul", "class", TextComparitor.C, "blockList", "blockListLast"
            );
        }
    }

    /**
     * <EMBED CLASS="external-html" DATA-FILE-ID=JD_HAS_DET>
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return An instance of {@code class DotPair} that points to the begin and end index
     * locations of input parameter {@code 'javaDocHTMLCIETPage'} were the primary <B>'Details
     * Section'</B> resides.
     * @see Torello.HTML.NodeSearch.InnerTagFindInclusive
     */
    public static DotPair hasDetails(Vector<HTMLNode> javaDocHTMLCIETPage)
    {
        return InnerTagFindInclusive.first
            (javaDocHTMLCIETPage, "div", "class", TextComparitor.C, "details");
    }

    /**
     * This will return a specific Java Doc Details Section on a Java Doc Generated HTML
     * page.  This class is used internally.
     * 
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * 
     * @param commentMarker This must be one of the five {@code 'MARKER' String's}, which
     * are the {@code static} constants defined at the top of this class.  This marker will
     * denote which JavaDoc Details Section is being requested.
     * 
     * @return This will return an index-pointer pair to an HTML {@code <UL>} and
     * {@code </UL>} opening-closing pair.  This HTML {@code <UL>}-pointer should be
     * the requested Details Section.
     * 
     * <BR /><BR />Null will be returned if there is no {@code CommentNode} containing the
     * {@code 'commentMarker'}, or if - once that {@code CommentNode} is found - there is not
     * {@code <UL CLASS='blockList'>} element found in the vicinity.
     * 
     * @see CommentNodeFind
     * @see InnerTagFindInclusive
     */
    protected static DotPair detailsSection
        (Vector<HTMLNode> javaDocHTMLCIETPage, String commentMarker)
    {
        int pos = CommentNodeFind.first
            (javaDocHTMLCIETPage, TextComparitor.CN_CI, commentMarker);

        if (pos == -1) return null;

        DotPair ret = InnerTagFindInclusive.first
            (javaDocHTMLCIETPage, pos, -1, "ul", "class", TextComparitor.C, "blockList");

        // Make sure a <TABLE CLASS="memberSummary"...> was found, and that it is in the
        // CLOSE VICINITY of pos - OTHERWISE return null;
        if ((ret == null) || ((ret.start - pos) > 25)) return null;

        return ret;
    }

    /**
     * This method will retrieve an {@code HNLIInclusive Iterator} that iterates the unordered
     * lists of any details section which is passed to this method.
     * 
     * <EMBED CLASS='external-html' DATA-FILE-ID=DET_ITER_EX>
     * 
     * <BR /><BR /><B STYLE='color: red;'>WARNING:</B> <I>This method cannot be used to retrieve
     * details for {@code Annotation Elements}!</I>  The HTML for these details are wrapped in 
     * something that differs (albeit very slightly).  To retrieve the specific details elements
     * for {@code Annotation Element}, use the method
     * {@link #annotationElemDetailsIterator(Vector)}
     * 
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * 
     * @param detailsSection This instance of {@code DotPair} <I>should contain a complete
     * Java Doc {@code 'Details'} section!</I>  This index-pointer pair should be retrieved
     * from the {@code 'has'} methods in this class.  If an incorrect pointer is passed here,
     * an exception is thrown!
     * 
     * @return This will return an instance of the 'HTML Node List Inclusive Iterator.'  This
     * {@code Iterator} has a suite of methods that facilitate retrieving the contents of a
     * particular element in the underlying HTML {@code Vector's} Unordered Lists. 
     * 
     * @throws DetailsException If the reference passed to {@code 'detailsSection'} is null,
     * or if it does not point to a proper opening and closing HTML {@code <UL>} element.
     * See the code included below to view the range of possible exception throws.
     * 
     * @see InnerTagInclusiveIterator
     * @see TagNodeExpectedException
     * @see OpeningTagNodeExpectedException
     * @see ClosingTagNodeExpectedException
     * @see HTMLTokException
     */
    public static HNLIInclusive detailsIterator
        (Vector<HTMLNode> javaDocHTMLCIETPage, DotPair detailsSection)
    {
        if (javaDocHTMLCIETPage == null)
            throw new NullPointerException("Parameter 'javaDocHTMLCIETPage' may not be null.");

        if (detailsSection == null) throw new DetailsException(
            "The Details Section Iterator you have requested cannot be built without a proper " +
            "index-pointer 'DotPair' instance which points to a Details Section on the page " +
            "you have passed to 'javadocHTMLCIETPage'.  The reference you have passed to " +
            "'detailsSection' is null."
        );

        try
        {
            // Temporary Variables, used to do a few (quick) checks
            HTMLNode    n;
            TagNode     tn;
    
            n = javaDocHTMLCIETPage.elementAt(detailsSection.start);

            if (! (n instanceof TagNode)) throw new TagNodeExpectedException(
                "The HTMLNode at index 'detailsSection.start' did not contain a TagNode, but " +
                "rather a " + n.getClass().getSimpleName()
            );

            tn = (TagNode) n;

            if (tn.isClosing) throw new OpeningTagNodeExpectedException(
                "The TagNode at index 'detailsSection.start' was a closing element whose " +
                "'.isClosing' field was true.  This should be an HTML Opening <UL ...> " +
                "element"
            );

            if (! tn.tok.equals("ul")) throw new HTMLTokException(
                "The TagNode at index 'detailsSection.start' was not an HTML <UL> element " +
                "because its '.tok' field was not \"ul\", but rather \"" + tn.tok + "\""
            );

            n = javaDocHTMLCIETPage.elementAt(detailsSection.end);

            if (! (n instanceof TagNode)) throw new TagNodeExpectedException(
                "The HTMLNode at index 'detailsSection.end' did not contain a TagNode, but " +
                "rather a " + n.getClass().getSimpleName()
            );

            tn = (TagNode) n;

            if (! tn.isClosing) throw new ClosingTagNodeExpectedException(
                "The TagNode at index 'detailsSection.end' was an opening element whose " +
                "'.isClosing' field was false.  This should be an HTML Opening </UL> " +
                "element"
            );

            if (! tn.tok.equals("ul")) throw new HTMLTokException(
                "The TagNode at index 'detailsSection.end' was not an HTML </UL> element " +
                "because its '.tok' field was not \"ul\", but rather \"" + tn.tok + "\""
            );
        }
        catch (Exception e)
        {
            throw new DetailsException(
                "There was a problem with the DotPair Vector-index pointer you have passed  " +
                "(parameter 'detailsSection').  This DotPair should contain a valid Detail " +
                "Section Pointer for the Java Doc Web Page you have passed, but it did not.  " +
                "Please see this exception getCause() method for more information.", e
            );
        }

        // Actually building the iterator is really easy.  It is one line, followed by the
        // cursor-restriction method-call!
        HNLIInclusive ret = InnerTagInclusiveIterator.get(javaDocHTMLCIETPage,
            "ul", "class", TextComparitor.C, "blockList", "blockListLast");

        // '+ 1' is needed since there is an "outer <UL class='blockList'>" TagNode
        // ==>  The "Enumerated-Constant Details (entire) Section" is 
        //      also a <UL CLASS='blockList'> too!
        ret.restrictCursor(detailsSection.start + 1, detailsSection.end);

        return ret;
    }

    /**
     * This is a helper method that is used by the {@code 'iterator'} Convenience Methods
     * defined in this class.
     * 
     * <BR /><BR />Note that it is (likely) much more efficient to invoke the
     * {@link #detailsIterator(Vector, DotPair)} method directly - <I>assuming you have already
     * obtained a valid {@code DotPair} instance of the requisite 'Details Section' (using one of
     * the {@code 'has'} methods!)</I>
     * 
     * <BR /><BR /><B STYLE='color:red;'>WARNING:</B> Do not invoke this method with the
     * {@code 'commentMarker'} {@link #JAVADOC_ANNOTATION_ELEMENT_DETAIL_MARKER}.  
     * {@code Annotation Details} use HTML that differs (slightly) from the other details sections.
     * You must use the method {@link #annotationElemDetailsIterator(Vector)}, instead.
     * 
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * 
     * @param commentMarker This Java {@code String} should be any one of the listed 
     * {@code static, final} 'Comment Marker' {@code String's}, <I>all of which are defined at
     * the top of this class.</I>
     * 
     * @return This will return a {@code 'Details Section Iterator'} that iterates the table
     * rows (a.k.a. 'The Summaries') in the specified {@code 'Details Section'}.
     * 
     * @throws DetailsException This will throw if the specified 'Details Section' isn't
     * found.
     * 
     * @see #detailsSection(Vector, String)
     * @see #detailsIterator(Vector, DotPair)
     */
    protected static HNLIInclusive detailsIterator
        (Vector<HTMLNode> javaDocHTMLCIETPage, String commentMarker)
    {
        DotPair dp = detailsSection(javaDocHTMLCIETPage, commentMarker);

        if (dp == null) throw new DetailsException(
            "The detail-section iterator you have requested cannot be built.  There was no " +
            "Detail Section that matches the 'commentMarker' parameter you have passed (or " +
            "you have not passed a valid comment marker).  Did you use one of the markers " +
            "which are defined as static-final fields at the top of this class?"
        );

        return detailsIterator(javaDocHTMLCIETPage, dp);
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Constructor Details Section
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-P1=Constructor>
     * <EMBED CLASS="external-html" DATA-FILE-ID=JD_CTOR_DET>
     * <EMBED CLASS="external-html" DATA-FILE-ID=DETAIL_WIDGET> <!-- local vars -->
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_DP> <!-- local vars -->
     * @see #detailsSection(Vector, String)
     * @see #JAVADOC_CONSTRUCTOR_DETAIL_MARKER
     */
    public static final DotPair hasConstructorDetails (Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsSection(javaDocHTMLCIETPage, JAVADOC_CONSTRUCTOR_DETAIL_MARKER); }

    /**
     * Convenience Method.
     * <BR />Invokes: {@link #detailsIterator(Vector, String)}
     * <BR />Passes: {@link #JAVADOC_CONSTRUCTOR_DETAIL_MARKER}
     * <BR /><B STYLE='color:red'>IMPORTANT:</B> If you have called {@code hasConstructorDetails}
     * already, it is more efficient to invoke {@link #detailsIterator(Vector, DotPair)}
     * directly, using that {@code DotPair} instead.
     */
    public static HNLIInclusive constructorDetailsIterator(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsIterator(javaDocHTMLCIETPage, JAVADOC_CONSTRUCTOR_DETAIL_MARKER); }


    // ********************************************************************************************
    // ********************************************************************************************
    // Field Details Section
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-P1=Field>
     * <EMBED CLASS="external-html" DATA-FILE-ID=JD_FIELD_DET>
     * <EMBED CLASS="external-html" DATA-FILE-ID=DETAIL_WIDGET> <!-- local vars -->
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_DP> <!-- local vars -->
     * @see #detailsSection(Vector, String)
     * @see #JAVADOC_FIELD_DETAIL_MARKER
     */
    public static final DotPair hasFieldDetails(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsSection(javaDocHTMLCIETPage, JAVADOC_FIELD_DETAIL_MARKER); }

    /**
     * Convenience Method.
     * <BR />Invokes: {@link #detailsIterator(Vector, String)}
     * <BR />Passes: {@link #JAVADOC_FIELD_DETAIL_MARKER}
     * <BR /><B STYLE='color:red'>IMPORTANT:</B> If you have called {@code hasFieldDetails}
     * already, it is more efficient to invoke {@link #detailsIterator(Vector, DotPair)}
     * directly, using that {@code DotPair} instead.
     */
    public static HNLIInclusive fieldDetailsIterator(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsIterator(javaDocHTMLCIETPage, JAVADOC_FIELD_DETAIL_MARKER); }


    // ********************************************************************************************
    // ********************************************************************************************
    // Method Details Section
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-P1=Method>
     * <EMBED CLASS="external-html" DATA-FILE-ID=JD_METH_DET>
     * <EMBED CLASS="external-html" DATA-FILE-ID=DETAIL_WIDGET> <!-- local vars -->
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_DP> <!-- local vars -->
     * @see #detailsSection(Vector, String)
     * @see #JAVADOC_METHOD_DETAIL_MARKER
     */
    public static final DotPair hasMethodDetails(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsSection(javaDocHTMLCIETPage, JAVADOC_METHOD_DETAIL_MARKER); }

    /**
     * Convenience Method.
     * <BR />Invokes: {@link #detailsIterator(Vector, String)}
     * <BR />Passes: {@link #JAVADOC_METHOD_DETAIL_MARKER}
     * <BR /><B STYLE='color:red'>IMPORTANT:</B> If you have called {@code hasMethodDetails}
     * already, it is more efficient to invoke {@link #detailsIterator(Vector, DotPair)}
     * directly, using that {@code DotPair} instead.
     */
    public static HNLIInclusive methodDetailsIterator(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsIterator(javaDocHTMLCIETPage, JAVADOC_METHOD_DETAIL_MARKER); }


    // ********************************************************************************************
    // ********************************************************************************************
    // Enum Constant Details Section
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-P1='Enum Constant'>
     * <EMBED CLASS="external-html" DATA-FILE-ID=JD_EC_DET>
     * <EMBED CLASS="external-html" DATA-FILE-ID=DETAIL_WIDGET>  <!-- local vars -->
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_DP> <!-- local vars -->
     * @see #detailsSection(Vector, String)
     * @see #JAVADOC_ENUM_CONST_DETAIL_MARKER
     */
    public static final DotPair hasEnumConstDetails(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsSection(javaDocHTMLCIETPage, JAVADOC_ENUM_CONST_DETAIL_MARKER); }

    /**
     * Convenience Method.
     * <BR />Invokes: {@link #detailsIterator(Vector, String)}
     * <BR />Passes: {@link #JAVADOC_ENUM_CONST_DETAIL_MARKER}
     * <BR /><B STYLE='color:red'>IMPORTANT:</B> If you have called {@code hasEnumConstDetails}
     * already, it is more efficient to invoke {@link #detailsIterator(Vector, DotPair)}
     * directly, using that {@code DotPair} instead.
     */
    public static HNLIInclusive enumConstDetailsIterator(Vector<HTMLNode> javaDocHTMLCIETPage)
    { return detailsIterator(javaDocHTMLCIETPage, JAVADOC_ENUM_CONST_DETAIL_MARKER); }


    // ********************************************************************************************
    // ********************************************************************************************
    // Annotation Element Details Section
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-P1=Element>
     * <EMBED CLASS="external-html" DATA-FILE-ID=JD_AE_DET> 
     * <EMBED CLASS="external-html" DATA-FILE-ID=DETAIL_WIDGET> <!-- local vars -->
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=DETAIL_DP> <!-- local vars -->
     * @see Torello.HTML.NodeSearch.CommentNodeFind
     * @see Torello.HTML.NodeSearch.InnerTagFind
     * @see Util.Inclusive#find(Vector, int)
     * @see #JAVADOC_ANNOTATION_ELEMENT_DETAIL_MARKER
     */
    public static final DotPair hasAnnotationElemDetails(Vector<HTMLNode> javaDocHTMLCIETPage)
    {
        int elemDetailsPos = CommentNodeFind.first
            (javaDocHTMLCIETPage, TextComparitor.CN_CI, JAVADOC_ANNOTATION_ELEMENT_DETAIL_MARKER);

        if (elemDetailsPos == -1) return null;

        // NOTE: We use 'last' and 'elemDetailsPos' as the endPos here (slightly different)
        int sPos = InnerTagFind.last(
            javaDocHTMLCIETPage, 0, elemDetailsPos, "ul", "class",
            TextComparitor.C, "blockList"
        );

        if (sPos == -1) return null;

        int ePos = Util.Inclusive.find(javaDocHTMLCIETPage, sPos);

        if (ePos == -1) return null;

        return new DotPair(sPos, ePos);
    }

    /**
     * <EMBED CLASS='external-html' DATA-FILE-ID=JD_AE_ITER>
     * 
     * @param javaDocHTMLCIETPage <EMBED CLASS="external-html" DATA-FILE-ID=JDHCIETP>
     * 
     * @return This will return an instance of the 'HTML Node List Inclusive Iterator.'  This
     * {@code Iterator} has a suite of methods that facilitate retrieving the contents of an
     * {@code Element Details} section's Unordered Lists.
     * 
     * <BR /><BR />The {@code <UL>} elements iterated contain {@code Annotation Element}
     * explanations &amp; definitions.
     * 
     * @see Torello.HTML.NodeSearch.InnerTagInclusiveIterator
     * @see #hasAnnotationElemDetails(Vector)
     * @throws DetailsException If there is not {@code Element Details} section on this page.
     */
    public static HNLIInclusive annotationElemDetailsIterator(Vector<HTMLNode> javaDocHTMLCIETPage)
    {
        DotPair annotationElemDetailsSection = hasAnnotationElemDetails(javaDocHTMLCIETPage);

        if (annotationElemDetailsSection == null) throw new DetailsException(
            "The detail-section iterator you have requested cannot be built.  There was no " +
            "Annotation Element Detail Section on this page."
        );

        HNLIInclusive ret = InnerTagInclusiveIterator.get
            (javaDocHTMLCIETPage, "section", "role", TextComparitor.EQ, "region");

        ret.restrictCursor(annotationElemDetailsSection);

        return ret;
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // Package Private Remove Details
    // ********************************************************************************************
    // ********************************************************************************************


    // Package Private.  This is done in JavaDocHTMLFile, through the 'Upgrade' Configuration
    // Predicates
    //
    // MESSAGER: ONLY 'println' / 'isVerbose'

    static void removeAllDetails(Vector<HTMLNode> fileVec)
    {
        int numDetailNodesRemoved = InnerTagRemoveInclusive.first
            (fileVec, "div", "class", TextComparitor.C, "details");

        if (Messager.isVerbose()) Messager.println(
            '\t' + StringParse.rightSpacePad("Removed: ", 25) + C.BRED +
            "[" + StringParse.zeroPad10e4(numDetailNodesRemoved) +
            "]" + C.RESET + " description section nodes."
        );

        // Finds all "relative links" on the page.  These are the ones that point to the method
        // Details, and all of them need to be removed
        Vector<DotPair> links =
            InnerTagFindInclusive.all(fileVec, "a", "href", TextComparitor.SW, "#");

        // Convert the list of start-and-end points to an integer array.
        int[] linksPos = DotPair.endPointsToPosArray(links, true);

        // Remove them!  AGAIN: These are the links to the "Method Details" in the NodeSearch
        // classes.  Remember - The Method Details are removed from the NodeSearch classes
        Util.removeNodesOPT(fileVec, linksPos);

        if (Messager.isVerbose()) Messager.println(
            '\t' + StringParse.rightSpacePad("Removed: ", 25) + C.BRED +
            "[" + StringParse.zeroPad10e4(linksPos.length) +
            "]" + C.RESET + " Summary (<A HREF=>...</A>) Anchor Nodes."
        );
    }

    // Package Private.  This is done in JavaDocHTMLFile, through the 'Upgrade' Configuration
    // Predicates
    //
    // MESSAGER: ONLY 'println' / 'isVerbose'

    static void removeAllDetails
        (Vector<HTMLNode> javaDocHTMLCIETPage, Entity entity)
    {
        // This should never happen.  It is called in JavaDocHTMLFile, and that class does not
        // use INNER_CLASS as the entity.
        if (entity == Entity.INNER_CLASS) throw new DetailsException(
            "INNER_CLASS' was passed to parameter 'entity', but Inner Classes do not have a " +
            "Detail Section"
        );

        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // Removes the entire detail-descriptions for the specific section/entity
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        // This gets the location for the "Comment Node Marker" for the specific 'Detail Section'
        // that has been slated for removal.
        int detailsMarkerPos =
            CommentNodeFind.first(javaDocHTMLCIETPage, TextComparitor.CN, entityToMarker(entity));

        // There is not details section on this page for the specified 'entity' (Method, Field
        // Constructor, etc...)
        if (detailsMarkerPos == -1) return;

        // Get rid of the marker comment!
        javaDocHTMLCIETPage.removeElementAt(detailsMarkerPos);

        // The "Detail Section" that should be removed is wrapped in a 
        // <SECTION ROLE='region'> ... </SECTION> HTML Tag.
        // REMOVE IT, THAT'S ALL
        int removed = InnerTagRemoveInclusive.first(
            javaDocHTMLCIETPage, detailsMarkerPos, -1, "section", "role",
            TextComparitor.EQ_CI, "region"
        );

        if (Messager.isVerbose()) Messager.println(
            "Removed: " + C.BRED +
            "[" + StringParse.zeroPad10e4(removed) +
            "] " + C.RESET + entity.toString() + " Details Nodes."
        );

        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // Removes the <A HREF=...> for the summary-descriptions inside the **SUMMARY-SECTION***
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        Vector<DotPair> links = null;

        if (entity != Entity.ANNOTATION_ELEM)
        {
            // This gets the location for the "Comment Node Marker" for the specific
            // 'Summary Section' that has been slated for removal.

            int summaryMarkerPos = CommentNodeFind.first(
                javaDocHTMLCIETPage, TextComparitor.CN,
                /* Summaries. */ HELPER.entityToMarker(entity)
            );

            // Theoretically, this can never happen, so throw an exception.
            if (summaryMarkerPos == -1) throw new DetailsException(
                "There seems to be a " + entity.toString() + " Details Section, but not a " +
                entity.toString() + " Summary Section.  Java Doc Error."
            );

            // This gets the entire <SECTION ROLE='region'> ... </SECTION> which holds the entire
            // summary table for a specific section-entity.  (Fields, Methods, Constructors, etc..)
            DotPair summDP  = InnerTagFindInclusive.first(
                javaDocHTMLCIETPage, summaryMarkerPos, -1, "section", "role",
                TextComparitor.EQ_CI, "region"
            );

            // This removes the <A HREF=...> for all of the links in the summary section.
            links = InnerTagFindInclusive.all(
                javaDocHTMLCIETPage, summDP.start, summDP.end,
                "a", "href", TextComparitor.SW, "#"
            );
        }
        // Annotaton Elements have two types of summaries section.
        // Carbon copy of the above stuff, but done twice
        else
        {
            links = new Vector<>();

            int summaryMarkerPos = CommentNodeFind.first(
                javaDocHTMLCIETPage, TextComparitor.CN,
                // Summaries.JAVADOC_REQUIRED_ANNOTATION_ELEMENT_SUMMARY_MARKER
                "==== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ===="
            );

            if (summaryMarkerPos != -1)
            {
                DotPair summDP  = InnerTagFindInclusive.first(
                    javaDocHTMLCIETPage, detailsMarkerPos, -1, "section", "role",
                    TextComparitor.EQ_CI, "region"
                );

                if (summDP != null)
                    links.addAll(InnerTagFindInclusive.all(
                        javaDocHTMLCIETPage, summDP.start, summDP.end,
                        "a", "href", TextComparitor.SW, "#"
                    ));
            }

            summaryMarkerPos = CommentNodeFind.first(
                javaDocHTMLCIETPage, TextComparitor.CN,
                // Summaries.JAVADOC_OPTIONAL_ANNOTATION_ELEMENT_SUMMARY_MARKER
                "==== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ===="
            );

            if (summaryMarkerPos != -1)
            {
                DotPair summDP  = InnerTagFindInclusive.first(
                    javaDocHTMLCIETPage, detailsMarkerPos, -1, "section", "role",
                    TextComparitor.EQ_CI, "region"
                );

                if (summDP != null)
                    links.addAll(InnerTagFindInclusive.all(
                        javaDocHTMLCIETPage, summDP.start, summDP.end,
                        "a", "href", TextComparitor.SW, "#"
                    ));
            }
        }

        // This should never happen.  It is better to throw an informative exception, rather
        // than an NPE, or meaningless one.
        if ((links == null) || (links.size() == 0)) throw new DetailsException(
            "There was either no " + entity.toString() + " Summary Exception or that section " +
            "was empty."
        );

        // Only remove the anchors, not  the text.
        int[] linksPos = DotPair.endPointsToPosArray(links, true);
    
        // Remove them!
        Util.removeNodesOPT(javaDocHTMLCIETPage, linksPos);

        if (Messager.isVerbose()) Messager.println(
            "Removed: " + C.BRED +
            "[" + StringParse.zeroPad10e4(linksPos.length) +
            "] " + C.RESET + entity.toString() + " Summary Anchor (<A HREF=>...</A>) Nodes."
        );
    }
}