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 | package Torello.JavaDoc; import static Torello.Java.C.*; import Torello.HTML.*; import Torello.HTML.NodeSearch.*; import Torello.Java.FileRW; import Torello.Java.StringParse; import Torello.Java.StrCSV; import Torello.Java.StrIndexOf; import Torello.Java.Additional.Ret2; import Torello.Java.Additional.Ret3; import Torello.JDUInternal.Messager.Messager; import Torello.JDUInternal.Messager.MsgControl; import Torello.JDUInternal.Messager.Where.JDUUserAPI; import Torello.JDUInternal.Messager.Where.Where_Am_I; import java.io.File; import java.io.IOException; import java.io.Serializable; import Torello.Java.ReadOnly.ReadOnlyVector; import Torello.Java.ReadOnly.ROTreeSetBuilder; import Torello.Java.ReadOnly.ReadOnlyTreeSet; import java.util.*; import java.util.function.Consumer; /** * A class that parses and encapsulates the contents of a <B>{@code 'package-summary.html'}</B> * File. */ public class PackageSummaryHTML implements Serializable { // When the Messager Reports its errors, this class passes this reference to the Messager // to facilitate the printing of that information (What class encountered an error or warning // that needs to be printed by the Messager). private static final Where_Am_I WHERE_AM_I = JDUUserAPI.PackageSummaryHTML; // ******************************************************************************************** // ******************************************************************************************** // Constructor // ******************************************************************************************** // ******************************************************************************************** public PackageSummaryHTML( final String packageName, final SubSection head, final SubSection topNavBar, final SubSection bottomNavBar, final SubSection description ) { this.packageName = packageName; this.head = head; this.topNavBar = topNavBar; this.bottomNavBar = bottomNavBar; this.description = description; } // ******************************************************************************************** // ******************************************************************************************** // Static-Final Constant Fields // ******************************************************************************************** // ******************************************************************************************** /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ protected static final long serialVersionUID = 1; /** Deprecated, but useful API Error-Message */ public static final String JD_FRAMES_WARNING_MESSAGE = "javadoc: warning - You have specified to generate frames, by using the --frames " + "option.\n" + "The default is currently to not generate frames and the support for \n" + "frames will be removed in a future release.\n" + "To suppress this warning, remove the --frames option and avoid the use of frames.\n"; // ******************************************************************************************** // ******************************************************************************************** // final Class-Data Fields // ******************************************************************************************** // ******************************************************************************************** /** The name of the Java Package represented by this instance. */ public final String packageName; // Contains the top Navigation Bar's HTML // This, and all SubSection instances, must be private, because they are mutable private final SubSection head; // Contains the top Navigation Bar's HTML private final SubSection topNavBar; // Contains the bottom Navigation Bar's HTML private final SubSection bottomNavBar; // THe Top-Description HTML/Text private final SubSection description; // ******************************************************************************************** // ******************************************************************************************** // Simple Accessor Methods // ******************************************************************************************** // ******************************************************************************************** /** * Allows a User to both retrieve and to modify the contents of the * {@code 'package-summary.html'} {@code <HEAD>}-Section. * * @return Vectorized-HTML of this Web-Page's {@code <HEAD>...</HEAD>} Section. */ public Vector<HTMLNode> head() { return this.head.html; } /** * Allows a User to both retrieve and to modify the contents of the * {@code 'package-summary.html'} Nav-Bar. * * @return Vectorized-HTML of this Web-Page's Upper Navigation Menu-Bar. */ public Vector<HTMLNode> topNavBar() { return (this.topNavBar == null) ? null : this.topNavBar.html; } /** * Allows a User to both retrieve and to modify the contents of the * {@code 'package-summary.html'} Nav-Bar. * * @return Vectorized-HTML of this Web-Page's Lower Navigation Menu-Bar. */ public Vector<HTMLNode> bottomNavBar() { return (this.bottomNavBar == null) ? null : this.bottomNavBar.html; } /** * Allows a User to both retrieve and to modify the contents of the * {@code 'package-summary.html'} Description Text-Area. * * @return Vectorized-HTML of this Web-Page's Main Description Box. */ public Vector<HTMLNode> description() { return this.description.html; } // ******************************************************************************************** // ******************************************************************************************** // Default Package-Summary Cleaner // ******************************************************************************************** // ******************************************************************************************** private static final String[] searches = { ".", "<br/>", "\n" }; public static final void defaultCleaner(Vector<HTMLNode> cietSummary) { // boolean VERBOSE = MsgVerbose.isVerbose(); // System.out.println("INSIDE MY LAMBDA:\n" + Util.pageToString(cietSummary)); int i=0, nodePos=-1; /* if (VERBOSE) MsgVerbose.println ("cietSummary: " + BGREEN + Util.pageToString(cietSummary) + RESET); */ while ((nodePos == -1) && (i < searches.length)) nodePos = TextNodeFind.first(cietSummary, TextComparitor.CN_CI, searches[i++]); if (nodePos == -1) { // if (VERBOSE) MsgVerbose.println("No String Markers Found! Exiting..."); return; } String s = cietSummary.elementAt(nodePos).str; int pos = StrIndexOf.first_CI(s, searches[--i]); /* if (VERBOSE) MsgVerbose.println("s: " + s); */ s = s.substring(0, pos); /* if (VERBOSE) MsgVerbose.println("s.substring: " + s); */ if (s.length() != 0) cietSummary.setElementAt(new TextNode(s), nodePos++); if (nodePos < cietSummary.size()) Util.Remove.range(cietSummary, nodePos, cietSummary.size()); // Util.removeAllTagNodes(cietSummary); // CHANGED March 2nd 2022 TagNodeRemove.allExcept(cietSummary, TC.Both, "a", "b", "i", "code", "span"); /* if (VERBOSE) MsgVerbose.println( BCYAN + Util.pageToString(cietSummary) + RESET + "\n************************************************************\n" ); */ } } |