You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/05/01 18:46:10 UTC
[commons-bcel] 07/08: Use camel-case.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
commit db3b0e1ffe5ad6dd154cd032a3faf454eef4acdc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun May 1 14:27:06 2022 -0400
Use camel-case.
---
src/main/java/org/apache/bcel/util/Class2HTML.java | 122 ++++++++++-----------
1 file changed, 61 insertions(+), 61 deletions(-)
diff --git a/src/main/java/org/apache/bcel/util/Class2HTML.java b/src/main/java/org/apache/bcel/util/Class2HTML.java
index de048d16..ef56ab14 100644
--- a/src/main/java/org/apache/bcel/util/Class2HTML.java
+++ b/src/main/java/org/apache/bcel/util/Class2HTML.java
@@ -55,27 +55,27 @@ import org.apache.bcel.classfile.Utility;
*/
public class Class2HTML implements Constants {
- private static String class_package; // name of package, unclean to make it static, but ...
- private static String class_name; // name of current class, dito
- private static ConstantPool constant_pool;
- private static final Set<String> basic_types = new HashSet<>();
+ private static String classPackage; // name of package, unclean to make it static, but ...
+ private static String className; // name of current class, dito
+ private static ConstantPool constantPool;
+ private static final Set<String> basicTypes = new HashSet<>();
static {
- basic_types.add("int");
- basic_types.add("short");
- basic_types.add("boolean");
- basic_types.add("void");
- basic_types.add("char");
- basic_types.add("byte");
- basic_types.add("long");
- basic_types.add("double");
- basic_types.add("float");
+ basicTypes.add("int");
+ basicTypes.add("short");
+ basicTypes.add("boolean");
+ basicTypes.add("void");
+ basicTypes.add("char");
+ basicTypes.add("byte");
+ basicTypes.add("long");
+ basicTypes.add("double");
+ basicTypes.add("float");
}
public static void main( final String[] argv ) throws IOException {
- final String[] file_name = new String[argv.length];
+ final String[] fileName = new String[argv.length];
int files = 0;
ClassParser parser = null;
- JavaClass java_class = null;
- String zip_file = null;
+ JavaClass javaClass = null;
+ String zipFile = null;
final char sep = File.separatorChar;
String dir = "." + sep; // Where to store HTML files
/* Parse command line arguments.
@@ -95,26 +95,26 @@ public class Class2HTML implements Constants {
}
}
} else if (argv[i].equals("-zip")) {
- zip_file = argv[++i];
+ zipFile = argv[++i];
} else {
System.out.println("Unknown option " + argv[i]);
}
} else {
- file_name[files++] = argv[i];
+ fileName[files++] = argv[i];
}
}
if (files == 0) {
System.err.println("Class2HTML: No input files specified.");
} else { // Loop through files ...
for (int i = 0; i < files; i++) {
- System.out.print("Processing " + file_name[i] + "...");
- if (zip_file == null) {
- parser = new ClassParser(file_name[i]); // Create parser object from file
+ System.out.print("Processing " + fileName[i] + "...");
+ if (zipFile == null) {
+ parser = new ClassParser(fileName[i]); // Create parser object from file
} else {
- parser = new ClassParser(zip_file, file_name[i]); // Create parser object from zip file
+ parser = new ClassParser(zipFile, fileName[i]); // Create parser object from zip file
}
- java_class = parser.parse();
- new Class2HTML(java_class, dir);
+ javaClass = parser.parse();
+ new Class2HTML(javaClass, dir);
System.out.println("Done.");
}
}
@@ -125,26 +125,26 @@ public class Class2HTML implements Constants {
* i.e., an index to a string.
*/
static String referenceClass( final int index ) {
- String str = constant_pool.getConstantString(index, Const.CONSTANT_Class);
+ String str = constantPool.getConstantString(index, Const.CONSTANT_Class);
str = Utility.compactClassName(str);
- str = Utility.compactClassName(str, class_package + ".", true);
- return "<A HREF=\"" + class_name + "_cp.html#cp" + index + "\" TARGET=ConstantPool>" + str
+ str = Utility.compactClassName(str, classPackage + ".", true);
+ return "<A HREF=\"" + className + "_cp.html#cp" + index + "\" TARGET=ConstantPool>" + str
+ "</A>";
}
static String referenceType( final String type ) {
- String short_type = Utility.compactClassName(type);
- short_type = Utility.compactClassName(short_type, class_package + ".", true);
+ String shortType = Utility.compactClassName(type);
+ shortType = Utility.compactClassName(shortType, classPackage + ".", true);
final int index = type.indexOf('['); // Type is an array?
- String base_type = type;
+ String baseType = type;
if (index > -1) {
- base_type = type.substring(0, index); // Tack of the `['
+ baseType = type.substring(0, index); // Tack of the `['
}
// test for basic type
- if (basic_types.contains(base_type)) {
+ if (basicTypes.contains(baseType)) {
return "<FONT COLOR=\"#00FF00\">" + type + "</FONT>";
}
- return "<A HREF=\"" + base_type + ".html\" TARGET=_top>" + short_type + "</A>";
+ return "<A HREF=\"" + baseType + ".html\" TARGET=_top>" + shortType + "</A>";
}
@@ -173,7 +173,7 @@ public class Class2HTML implements Constants {
}
- private final JavaClass java_class; // current class object
+ private final JavaClass javaClass; // current class object
private final String dir;
@@ -182,54 +182,54 @@ public class Class2HTML implements Constants {
/**
* Write contents of the given JavaClass into HTML files.
*
- * @param java_class The class to write
+ * @param javaClass The class to write
* @param dir The directory to put the files in
*/
- public Class2HTML(final JavaClass java_class, final String dir) throws IOException {
- final Method[] methods = java_class.getMethods();
- this.java_class = java_class;
+ public Class2HTML(final JavaClass javaClass, final String dir) throws IOException {
+ final Method[] methods = javaClass.getMethods();
+ this.javaClass = javaClass;
this.dir = dir;
- class_name = java_class.getClassName(); // Remember full name
- constant_pool = java_class.getConstantPool();
+ className = javaClass.getClassName(); // Remember full name
+ constantPool = javaClass.getConstantPool();
// Get package name by tacking off everything after the last `.'
- final int index = class_name.lastIndexOf('.');
+ final int index = className.lastIndexOf('.');
if (index > -1) {
- class_package = class_name.substring(0, index);
+ classPackage = className.substring(0, index);
} else {
- class_package = ""; // default package
+ classPackage = ""; // default package
}
- final ConstantHTML constant_html = new ConstantHTML(dir, class_name, class_package, methods,
- constant_pool);
+ final ConstantHTML constantHtml = new ConstantHTML(dir, className, classPackage, methods,
+ constantPool);
/* Attributes can't be written in one step, so we just open a file
* which will be written consequently.
*/
- final AttributeHTML attribute_html = new AttributeHTML(dir, class_name, constant_pool,
- constant_html);
- new MethodHTML(dir, class_name, methods, java_class.getFields(),
- constant_html, attribute_html);
+ final AttributeHTML attributeHtml = new AttributeHTML(dir, className, constantPool,
+ constantHtml);
+ new MethodHTML(dir, className, methods, javaClass.getFields(),
+ constantHtml, attributeHtml);
// Write main file (with frames, yuk)
- writeMainHTML(attribute_html);
- new CodeHTML(dir, class_name, methods, constant_pool, constant_html);
- attribute_html.close();
+ writeMainHTML(attributeHtml);
+ new CodeHTML(dir, className, methods, constantPool, constantHtml);
+ attributeHtml.close();
}
- private void writeMainHTML( final AttributeHTML attribute_html ) throws IOException {
- try (PrintWriter file = new PrintWriter(new FileOutputStream(dir + class_name + ".html"))) {
- file.println("<HTML>\n" + "<HEAD><TITLE>Documentation for " + class_name + "</TITLE>" + "</HEAD>\n"
+ private void writeMainHTML( final AttributeHTML attributeHtml ) throws IOException {
+ try (PrintWriter file = new PrintWriter(new FileOutputStream(dir + className + ".html"))) {
+ file.println("<HTML>\n" + "<HEAD><TITLE>Documentation for " + className + "</TITLE>" + "</HEAD>\n"
+ "<FRAMESET BORDER=1 cols=\"30%,*\">\n" + "<FRAMESET BORDER=1 rows=\"80%,*\">\n"
- + "<FRAME NAME=\"ConstantPool\" SRC=\"" + class_name + "_cp.html" + "\"\n MARGINWIDTH=\"0\" "
+ + "<FRAME NAME=\"ConstantPool\" SRC=\"" + className + "_cp.html" + "\"\n MARGINWIDTH=\"0\" "
+ "MARGINHEIGHT=\"0\" FRAMEBORDER=\"1\" SCROLLING=\"AUTO\">\n" + "<FRAME NAME=\"Attributes\" SRC=\""
- + class_name + "_attributes.html" + "\"\n MARGINWIDTH=\"0\" "
+ + className + "_attributes.html" + "\"\n MARGINWIDTH=\"0\" "
+ "MARGINHEIGHT=\"0\" FRAMEBORDER=\"1\" SCROLLING=\"AUTO\">\n" + "</FRAMESET>\n"
- + "<FRAMESET BORDER=1 rows=\"80%,*\">\n" + "<FRAME NAME=\"Code\" SRC=\"" + class_name
+ + "<FRAMESET BORDER=1 rows=\"80%,*\">\n" + "<FRAME NAME=\"Code\" SRC=\"" + className
+ "_code.html\"\n MARGINWIDTH=0 " + "MARGINHEIGHT=0 FRAMEBORDER=1 SCROLLING=\"AUTO\">\n"
- + "<FRAME NAME=\"Methods\" SRC=\"" + class_name + "_methods.html\"\n MARGINWIDTH=0 "
+ + "<FRAME NAME=\"Methods\" SRC=\"" + className + "_methods.html\"\n MARGINWIDTH=0 "
+ "MARGINHEIGHT=0 FRAMEBORDER=1 SCROLLING=\"AUTO\">\n" + "</FRAMESET></FRAMESET></HTML>");
}
- final Attribute[] attributes = java_class.getAttributes();
+ final Attribute[] attributes = javaClass.getAttributes();
for (int i = 0; i < attributes.length; i++) {
- attribute_html.writeAttribute(attributes[i], "class" + i);
+ attributeHtml.writeAttribute(attributes[i], "class" + i);
}
}
}