Code cleanup.
This commit is contained in:
@@ -209,16 +209,16 @@ public final class Operators {
|
||||
}
|
||||
|
||||
// Usable AlmostEqual function, based on http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
|
||||
private static boolean almostEqual2sComplement(double A, double B, long maxUlps) {
|
||||
private static boolean almostEqual2sComplement(double a, double b, long maxUlps) {
|
||||
// Make sure maxUlps is non-negative and small enough that the
|
||||
// default NAN won't compare as equal to anything.
|
||||
//assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); // this is for floats, not doubles
|
||||
|
||||
long aLong = Double.doubleToRawLongBits(A);
|
||||
long aLong = Double.doubleToRawLongBits(a);
|
||||
// Make aLong lexicographically ordered as a twos-complement long
|
||||
if (aLong < 0) aLong = 0x8000000000000000L - aLong;
|
||||
|
||||
long bLong = Double.doubleToRawLongBits(B);
|
||||
long bLong = Double.doubleToRawLongBits(b);
|
||||
// Make bLong lexicographically ordered as a twos-complement long
|
||||
if (bLong < 0) bLong = 0x8000000000000000L - bLong;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class Switch extends Node implements RValue {
|
||||
}
|
||||
|
||||
boolean breakDetected = false;
|
||||
for (int i = index; i < caseStatements.length && !breakDetected ; ++i) {
|
||||
for (int i = index; i < caseStatements.length && !breakDetected; ++i) {
|
||||
final RValue invokable = caseStatements[i].optimize();
|
||||
|
||||
if (invokable instanceof Sequence) {
|
||||
|
||||
@@ -37,6 +37,12 @@ public final class DocumentationPrinter {
|
||||
private DocumentationPrinter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates documentation.
|
||||
*
|
||||
* @param args arguments
|
||||
* @throws IOException thrown on I/O error
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
File commandsDir = new File(args[0]);
|
||||
|
||||
@@ -96,7 +102,7 @@ public final class DocumentationPrinter {
|
||||
try {
|
||||
stream = new FileOutputStream("wiki_permissions.txt");
|
||||
PrintStream print = new PrintStream(stream);
|
||||
_writePermissionsWikiTable(print, commandClasses, "/");
|
||||
writePermissionsWikiTable(print, commandClasses, "/");
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
@@ -104,8 +110,8 @@ public final class DocumentationPrinter {
|
||||
}
|
||||
}
|
||||
|
||||
private static void _writePermissionsWikiTable(PrintStream stream,
|
||||
List<Class<?>> commandClasses, String prefix) {
|
||||
private static void writePermissionsWikiTable(PrintStream stream,
|
||||
List<Class<?>> commandClasses, String prefix) {
|
||||
|
||||
for (Class<?> cls : commandClasses) {
|
||||
for (Method method : cls.getMethods()) {
|
||||
@@ -162,7 +168,7 @@ public final class DocumentationPrinter {
|
||||
method.getAnnotation(NestedCommand.class);
|
||||
|
||||
Class<?>[] nestedClasses = nested.value();
|
||||
_writePermissionsWikiTable(stream,
|
||||
writePermissionsWikiTable(stream,
|
||||
Arrays.asList(nestedClasses),
|
||||
prefix + cmd.aliases()[0] + " ");
|
||||
}
|
||||
@@ -176,7 +182,7 @@ public final class DocumentationPrinter {
|
||||
try {
|
||||
stream = new FileOutputStream("plugin.yml");
|
||||
PrintStream print = new PrintStream(stream);
|
||||
_writeBukkitYAML(print);
|
||||
writeBukkitYAML(print);
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
@@ -184,7 +190,7 @@ public final class DocumentationPrinter {
|
||||
}
|
||||
}
|
||||
|
||||
private static void _writeBukkitYAML(PrintStream stream) {
|
||||
private static void writeBukkitYAML(PrintStream stream) {
|
||||
|
||||
stream.println("name: WorldEdit");
|
||||
stream.println("main: com.sk89q.worldedit.bukkit.WorldEditPlugin");
|
||||
|
||||
Reference in New Issue
Block a user