Permalink
Browse files

CheckStyle: Fix name violations

  • Loading branch information...
Pieter12345 committed Jun 9, 2018
1 parent fc08e99 commit 065ca39ea468bc18148814b2999b86a9938c0116
Showing with 1,431 additions and 1,397 deletions.
  1. +15 −15 src/main/java/com/laytonsmith/PureUtilities/ArgumentParser.java
  2. +7 −7 src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassDiscoveryURLCache.java
  3. +6 −6 src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/ClassMirrorVisitor.java
  4. +3 −3 src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/FieldMirror.java
  5. +4 −4 src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/ModifierMirror.java
  6. +2 −4 src/main/java/com/laytonsmith/PureUtilities/CommandExecutor.java
  7. +3 −3 src/main/java/com/laytonsmith/PureUtilities/Common/Annotations/AnnotationChecks.java
  8. +5 −5 src/main/java/com/laytonsmith/PureUtilities/Common/Annotations/CheckOverrides.java
  9. +11 −11 src/main/java/com/laytonsmith/PureUtilities/Common/FileUtil.java
  10. +5 −5 src/main/java/com/laytonsmith/PureUtilities/Common/Range.java
  11. +3 −3 src/main/java/com/laytonsmith/PureUtilities/Common/StreamUtils.java
  12. +5 −5 src/main/java/com/laytonsmith/PureUtilities/Common/StringUtils.java
  13. +29 −29 src/main/java/com/laytonsmith/PureUtilities/Common/WinRegistry.java
  14. +4 −4 src/main/java/com/laytonsmith/PureUtilities/MemoryMapFileUtil.java
  15. +10 −10 src/main/java/com/laytonsmith/PureUtilities/SSHWrapper.java
  16. +8 −8 src/main/java/com/laytonsmith/PureUtilities/SignalHandler.java
  17. +60 −60 src/main/java/com/laytonsmith/PureUtilities/Sizes.java
  18. +46 −44 src/main/java/com/laytonsmith/PureUtilities/TermColors.java
  19. +6 −6 src/main/java/com/laytonsmith/PureUtilities/VirtualFS/VirtualFileSystem.java
  20. +15 −14 src/main/java/com/laytonsmith/PureUtilities/Web/WebUtility.java
  21. +3 −3 src/main/java/com/laytonsmith/PureUtilities/rParser.java
  22. +2 −2 src/main/java/com/laytonsmith/abstraction/MCWorld.java
  23. +16 −16 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitConvertor.java
  24. +2 −2 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCColor.java
  25. +14 −14 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCMetadataValue.java
  26. +10 −10 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCMetadatable.java
  27. +7 −7 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCWorld.java
  28. +6 −6 src/main/java/com/laytonsmith/abstraction/bukkit/entities/BukkitMCArrow.java
  29. +5 −5 src/main/java/com/laytonsmith/abstraction/bukkit/entities/BukkitMCWitherSkull.java
  30. +13 −13 src/main/java/com/laytonsmith/abstraction/bukkit/events/BukkitWeatherEvents.java
  31. +12 −12 src/main/java/com/laytonsmith/abstraction/bukkit/events/BukkitWorldEvents.java
  32. +3 −3 src/main/java/com/laytonsmith/abstraction/enums/MCChatColor.java
  33. +4 −4 src/main/java/com/laytonsmith/abstraction/enums/bukkit/BukkitMCRegainReason.java
  34. +3 −3 src/main/java/com/laytonsmith/commandhelper/BukkitDirtyRegisteredListener.java
  35. +4 −4 src/main/java/com/laytonsmith/commandhelper/CommandHelperListener.java
  36. +2 −2 src/main/java/com/laytonsmith/commandhelper/CommandHelperMessageListener.java
  37. +4 −4 src/main/java/com/laytonsmith/commandhelper/CommandHelperPlugin.java
  38. +27 −27 src/main/java/com/laytonsmith/core/AliasCore.java
  39. +9 −8 src/main/java/com/laytonsmith/core/CHLog.java
  40. +6 −6 src/main/java/com/laytonsmith/core/EmailProfile.java
  41. +4 −4 src/main/java/com/laytonsmith/core/Globals.java
  42. +3 −3 src/main/java/com/laytonsmith/core/Installer.java
  43. +105 −105 src/main/java/com/laytonsmith/core/Main.java
  44. +2 −2 src/main/java/com/laytonsmith/core/MainSandbox.java
  45. +102 −101 src/main/java/com/laytonsmith/core/MethodScriptCompiler.java
  46. +42 −42 src/main/java/com/laytonsmith/core/Script.java
  47. +5 −5 src/main/java/com/laytonsmith/core/Security.java
  48. +17 −16 src/main/java/com/laytonsmith/core/Static.java
  49. +1 −1 src/main/java/com/laytonsmith/core/compiler/AliasCompiler.java
  50. +2 −2 src/main/java/com/laytonsmith/core/compiler/CompilerObject.java
  51. +1 −0 src/main/java/com/laytonsmith/core/compiler/Keyword.java
  52. +111 −111 src/main/java/com/laytonsmith/core/compiler/LexerObject.java
  53. +8 −8 src/main/java/com/laytonsmith/core/compiler/keywords/DoKeyword.java
  54. +4 −4 src/main/java/com/laytonsmith/core/compiler/keywords/ForKeyword.java
  55. +7 −7 src/main/java/com/laytonsmith/core/compiler/keywords/TryKeyword.java
  56. +62 −62 src/main/java/com/laytonsmith/core/constructs/CArray.java
  57. +5 −5 src/main/java/com/laytonsmith/core/constructs/CByteArray.java
  58. +8 −8 src/main/java/com/laytonsmith/core/constructs/CClassType.java
  59. +2 −2 src/main/java/com/laytonsmith/core/constructs/CResource.java
  60. +2 −2 src/main/java/com/laytonsmith/core/constructs/Construct.java
  61. +9 −9 src/main/java/com/laytonsmith/core/constructs/IVariable.java
  62. +1 −1 src/main/java/com/laytonsmith/core/constructs/Target.java
  63. +2 −2 src/main/java/com/laytonsmith/core/constructs/Token.java
  64. +13 −13 src/main/java/com/laytonsmith/core/constructs/Variable.java
  65. +2 −2 src/main/java/com/laytonsmith/core/events/BoundEvent.java
  66. +15 −13 src/main/java/com/laytonsmith/core/events/EventBuilder.java
  67. +12 −12 src/main/java/com/laytonsmith/core/events/EventUtils.java
  68. +5 −5 src/main/java/com/laytonsmith/core/events/drivers/InventoryEvents.java
  69. +11 −13 src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java
  70. +4 −3 src/main/java/com/laytonsmith/core/events/drivers/ServerEvents.java
  71. +12 −12 src/main/java/com/laytonsmith/core/events/drivers/VehicleEvents.java
  72. +7 −7 src/main/java/com/laytonsmith/core/exceptions/ConfigCompileException.java
  73. +26 −26 src/main/java/com/laytonsmith/core/extensions/ExtensionManager.java
  74. +3 −3 src/main/java/com/laytonsmith/core/federation/FederationConnection.java
  75. +2 −2 src/main/java/com/laytonsmith/core/federation/FederationRegistration.java
  76. +5 −0 src/main/java/com/laytonsmith/core/functions/ArrayHandling.java
  77. +6 −8 src/main/java/com/laytonsmith/core/functions/BasicLogic.java
  78. +11 −11 src/main/java/com/laytonsmith/core/functions/BossBar.java
  79. +23 −25 src/main/java/com/laytonsmith/core/functions/Cmdline.java
  80. +4 −4 src/main/java/com/laytonsmith/core/functions/CompositeFunction.java
  81. +8 −0 src/main/java/com/laytonsmith/core/functions/DataHandling.java
  82. +2 −2 src/main/java/com/laytonsmith/core/functions/Echoes.java
  83. +4 −4 src/main/java/com/laytonsmith/core/functions/Enchantments.java
  84. +31 −31 src/main/java/com/laytonsmith/core/functions/EntityManagement.java
  85. +9 −9 src/main/java/com/laytonsmith/core/functions/EventBinding.java
  86. +2 −2 src/main/java/com/laytonsmith/core/functions/FileHandling.java
  87. +7 −7 src/main/java/com/laytonsmith/core/functions/IncludeCache.java
  88. +3 −3 src/main/java/com/laytonsmith/core/functions/ItemMeta.java
  89. +6 −5 src/main/java/com/laytonsmith/core/functions/Marquee.java
  90. +8 −0 src/main/java/com/laytonsmith/core/functions/Meta.java
  91. +10 −10 src/main/java/com/laytonsmith/core/functions/Minecraft.java
  92. +2 −2 src/main/java/com/laytonsmith/core/functions/Performance.java
  93. +11 −11 src/main/java/com/laytonsmith/core/functions/PlayerManagement.java
  94. +7 −7 src/main/java/com/laytonsmith/core/functions/Reflection.java
  95. +2 −0 src/main/java/com/laytonsmith/core/functions/Regex.java
  96. +5 −5 src/main/java/com/laytonsmith/core/functions/ResourceManager.java
  97. +3 −3 src/main/java/com/laytonsmith/core/functions/SQL.java
  98. +18 −18 src/main/java/com/laytonsmith/core/functions/Scheduling.java
  99. +18 −13 src/main/java/com/laytonsmith/core/functions/StringHandling.java
  100. +8 −8 src/main/java/com/laytonsmith/core/functions/Threading.java
  101. +2 −2 src/main/java/com/laytonsmith/core/functions/Web.java
  102. +6 −6 src/main/java/com/laytonsmith/core/functions/World.java
  103. +2 −2 src/main/java/com/laytonsmith/core/functions/XGUI.java
  104. +3 −3 src/main/java/com/laytonsmith/core/packetjumper/PacketJumper.java
  105. +4 −4 src/main/java/com/laytonsmith/core/profiler/ProfilePoint.java
  106. +7 −6 src/main/java/com/laytonsmith/core/profiler/Profiler.java
  107. +5 −5 src/main/java/com/laytonsmith/persistence/DataSourceFactory.java
  108. +7 −7 src/main/java/com/laytonsmith/persistence/MemoryDataSource.java
  109. +4 −4 src/main/java/com/laytonsmith/persistence/ThreadsafeDataSource.java
  110. +2 −2 src/main/java/com/laytonsmith/tools/Interpreter.java
  111. +14 −13 src/main/java/com/laytonsmith/tools/Manager.java
  112. +1 −1 src/main/java/com/laytonsmith/tools/SimpleSyntaxHighlighter.java
  113. +33 −34 src/main/java/com/laytonsmith/tools/docgen/DocGenTemplates.java
  114. +3 −3 src/main/java/com/laytonsmith/tools/docgen/DocGenUIHandler.java
  115. +16 −16 src/main/java/com/laytonsmith/tools/docgen/ExtensionDocGen.java
  116. +5 −5 src/main/java/com/laytonsmith/tools/docgen/sitedeploy/APIBuilder.java
  117. +9 −8 src/main/java/com/laytonsmith/tools/docgen/sitedeploy/SiteDeploy.java
  118. +11 −11 src/test/java/com/laytonsmith/PureUtilities/VirtualFS/VirtualFSTest.java
  119. +10 −10 src/test/java/com/laytonsmith/PureUtilities/ZipReaderTest.java
  120. +2 −2 src/test/java/com/laytonsmith/core/functions/ArrayHandlingTest.java
  121. +36 −36 src/test/java/com/laytonsmith/core/functions/BasicLogicTest.java
  122. +5 −4 src/test/java/com/laytonsmith/core/functions/EchoesTest.java
  123. +9 −9 src/test/java/com/laytonsmith/testing/C.java
  124. +3 −3 src/test/java/com/laytonsmith/testing/RandomTests.java
  125. +3 −3 src/test/java/com/laytonsmith/testing/StaticTest.java
@@ -949,17 +949,17 @@ public ArgumentParserResults match(String[] args) throws ValidationException {
//First, we have to tokenize the strings. Since we can have quoted arguments, we can't simply split on spaces.
List<String> arguments = new ArrayList<String>();
StringBuilder buf = new StringBuilder();
boolean state_in_single_quote = false;
boolean state_in_double_quote = false;
boolean stateInSingleQuote = false;
boolean stateInDoubleQuote = false;
for(int i = 0; i < args.length(); i++) {
Character c0 = args.charAt(i);
Character c1 = i + 1 < args.length() ? args.charAt(i + 1) : null;
if(c0 == '\\') {
if(c1 == '\'' && state_in_single_quote
|| c1 == '"' && state_in_double_quote
|| c1 == ' ' && !state_in_double_quote && !state_in_single_quote
|| c1 == '\\' && (state_in_double_quote || state_in_single_quote)) {
if(c1 == '\'' && stateInSingleQuote
|| c1 == '"' && stateInDoubleQuote
|| c1 == ' ' && !stateInDoubleQuote && !stateInSingleQuote
|| c1 == '\\' && (stateInDoubleQuote || stateInSingleQuote)) {
//We are escaping the next character. Add it to the buffer instead, and
//skip ahead two
buf.append(c1);
@@ -970,7 +970,7 @@ public ArgumentParserResults match(String[] args) throws ValidationException {
}
if(c0 == ' ') {
if(!state_in_double_quote && !state_in_single_quote) {
if(!stateInDoubleQuote && !stateInSingleQuote) {
//argument split
if(buf.length() != 0) {
arguments.add(buf.toString());
@@ -979,31 +979,31 @@ public ArgumentParserResults match(String[] args) throws ValidationException {
continue;
}
}
if(c0 == '\'' && !state_in_double_quote) {
if(state_in_single_quote) {
state_in_single_quote = false;
if(c0 == '\'' && !stateInDoubleQuote) {
if(stateInSingleQuote) {
stateInSingleQuote = false;
arguments.add(buf.toString());
buf = new StringBuilder();
} else {
if(buf.length() != 0) {
arguments.add(buf.toString());
buf = new StringBuilder();
}
state_in_single_quote = true;
stateInSingleQuote = true;
}
continue;
}
if(c0 == '"' && !state_in_single_quote) {
if(state_in_double_quote) {
state_in_double_quote = false;
if(c0 == '"' && !stateInSingleQuote) {
if(stateInDoubleQuote) {
stateInDoubleQuote = false;
arguments.add(buf.toString());
buf = new StringBuilder();
} else {
if(buf.length() != 0) {
arguments.add(buf.toString());
buf = new StringBuilder();
}
state_in_double_quote = true;
stateInDoubleQuote = true;
}
continue;
}
@@ -63,36 +63,36 @@ public ClassDiscoveryURLCache(URL url, ProgressIterator progress) {
* @throws java.lang.ClassNotFoundException
*/
public ClassDiscoveryURLCache(URL url, InputStream descriptor) throws IOException, ClassNotFoundException {
List<ClassMirror<?>> _list;
List<ClassMirror<?>> list;
ObjectInputStream ois = new ObjectInputStream(descriptor);
try {
_list = (List<ClassMirror<?>>) ois.readObject();
list = (List<ClassMirror<?>>) ois.readObject();
} catch (ClassNotFoundException ex) {
if(url != null) {
//We can recover from this one, but it won't be instant.
_list = new ClassDiscoveryURLCache(url).list;
list = new ClassDiscoveryURLCache(url).list;
} else {
throw ex;
}
}
ois.close();
for(ClassMirror m : _list) {
for(ClassMirror m : list) {
ReflectionUtils.set(ClassMirror.class, m, "originalURL", url);
}
this.list = _list;
this.list = list;
}
public void writeDescriptor(OutputStream out) throws IOException {
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(list);
oos.writeObject(this.list);
oos.close();
}
@Override
public String toString() {
return "[" + ClassDiscoveryURLCache.class.getSimpleName() + ": " + list.size() + "]";
return "[" + ClassDiscoveryURLCache.class.getSimpleName() + ": " + this.list.size() + "]";
}
/**
@@ -160,9 +160,9 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
for(Type type : Type.getArgumentTypes(desc)) {
parameterMirrors.add(new ClassReferenceMirror(type.getDescriptor()));
}
AbstractMethodMirror _methodMirror;
AbstractMethodMirror methodMirror;
if(ConstructorMirror.INIT.equals(name)) {
_methodMirror = new ConstructorMirror(
methodMirror = new ConstructorMirror(
classInfo.classReferenceMirror,
new ModifierMirror(ModifierMirror.Type.METHOD, access),
new ClassReferenceMirror(Type.getReturnType(desc).getDescriptor()),
@@ -172,7 +172,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
(access & ACC_SYNTHETIC) == ACC_SYNTHETIC
);
} else {
_methodMirror = new MethodMirror(
methodMirror = new MethodMirror(
classInfo.classReferenceMirror,
new ModifierMirror(ModifierMirror.Type.METHOD, access),
new ClassReferenceMirror(Type.getReturnType(desc).getDescriptor()),
@@ -182,22 +182,22 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
(access & ACC_SYNTHETIC) == ACC_SYNTHETIC
);
}
final AbstractMethodMirror methodMirror = _methodMirror;
final AbstractMethodMirror finalMethodMirror = methodMirror;
return new MethodVisitor(ASM5, super.visitMethod(access, name, desc, signature, exceptions)) {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
final AnnotationMirror annotationMirror = new AnnotationMirror(new ClassReferenceMirror<>(desc), visible);
return new AnnotationMirrorVisitor(super.visitAnnotation(desc, visible), annotationMirror) {
@Override
public void visitEnd() {
methodMirror.addAnnotation(annotationMirror);
finalMethodMirror.addAnnotation(annotationMirror);
}
};
}
@Override
public void visitEnd() {
classInfo.methods.add(methodMirror);
classInfo.methods.add(finalMethodMirror);
super.visitEnd();
}
};
@@ -20,13 +20,13 @@
*/
public FieldMirror(Field field) {
super(field);
Object _value = null;
Object value = null;
try {
_value = field.get(null);
value = field.get(null);
} catch (IllegalArgumentException | IllegalAccessException ex) {
//
}
this.value = _value;
this.value = value;
}
/**
@@ -19,7 +19,7 @@
/**
* This is the canonical order of modifiers, used in the toString method.
*/
private static final transient Object[] order = new Object[]{
private static final transient Object[] ORDER = new Object[]{
Modifier.PUBLIC, "public",
Modifier.PRIVATE, "private",
Modifier.PROTECTED, "protected",
@@ -246,9 +246,9 @@ public int getModifiers() {
@Override
public String toString() {
List<String> build = new ArrayList<String>();
for(int i = 0; i < order.length; i++) {
int type = (Integer) order[i];
String name = (String) order[++i];
for(int i = 0; i < ORDER.length; i++) {
int type = (Integer) ORDER[i];
String name = (String) ORDER[++i];
if((modifiers & type) > 0) {
build.add(name);
}
@@ -51,11 +51,9 @@ public void write(int next) throws IOException {
c.setSystemOut(os);
c.start();
c.waitFor();
Byte[] Bytes = new Byte[output.size()];
byte[] bytes = new byte[output.size()];
Bytes = output.toArray(Bytes);
for(int i = 0; i < Bytes.length; i++) {
bytes[i] = Bytes[i];
for(int i = 0; i < output.size(); i++) {
bytes[i] = output.get(i).byteValue();
}
return new String(bytes, "UTF-8");
@@ -32,12 +32,12 @@ public static void checkForTypeInTypeofClasses() throws Exception {
for(ClassMirror<?> clazz : classes) {
try {
// Make sure that TYPE has the same type as the typeof annotation
CClassType TYPE = (CClassType) ReflectionUtils.get(clazz.loadClass(), "TYPE");
if(TYPE == null) {
CClassType type = (CClassType) ReflectionUtils.get(clazz.loadClass(), "TYPE");
if(type == null) {
errors.add("TYPE is null? " + clazz.getClassName());
continue;
}
if(!TYPE.val().equals(clazz.getAnnotation(typeof.class).getValue("value"))) {
if(!type.val().equals(clazz.getAnnotation(typeof.class).getValue("value"))) {
errors.add(clazz.getClassName() + "'s TYPE value is different than the typeof annotation on it");
}
} catch (ReflectionUtils.ReflectionException ex) {
@@ -39,16 +39,16 @@
@SupportedSourceVersion(SourceVersion.RELEASE_7)
public class CheckOverrides extends AbstractProcessor {
private static final boolean enabled = true;
private static final boolean ENABLED = true;
private static Map<Class, Set<Method>> methods = null;
private static final Set<Class> interfacesWithMustUseOverride = new HashSet<>();
private static final Set<Class> INTERFACES_WITH_MUST_USE_OVERRIDE = new HashSet<>();
private static final Pattern METHOD_SIGNATURE = Pattern.compile("[a-zA-Z0-9_]+\\((.*)\\)");
private static final Pattern CLASS_TEMPLATES = Pattern.compile("^.*?<(.*)>?$");
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if(!enabled) {
if(!ENABLED) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "CheckOverrides processor is turned off!");
return false;
}
@@ -67,7 +67,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
"Only interfaces may be annotated with " + MustUseOverride.class.getName());
}
interfacesWithMustUseOverride.add(c);
INTERFACES_WITH_MUST_USE_OVERRIDE.add(c);
}
}
for(Element element : roundEnv.getElementsAnnotatedWith(Override.class)) {
@@ -262,7 +262,7 @@ private static void getAllSupers(Class c, Set<Class> building, boolean first) {
}
getAllSupers(c.getSuperclass(), building, false);
for(Class cc : c.getInterfaces()) {
if(interfacesWithMustUseOverride.contains(cc)) {
if(INTERFACES_WITH_MUST_USE_OVERRIDE.contains(cc)) {
building.add(cc);
}
}
@@ -26,8 +26,8 @@ private FileUtil() {
public static final int OVERWRITE = 0;
public static final int APPEND = 1;
private static final Map<String, Object> fileLocks = new HashMap<>();
private static final Map<String, Integer> fileLockCounter = new HashMap<>();
private static final Map<String, Object> FILE_LOCKS = new HashMap<>();
private static final Map<String, Integer> FILE_LOCK_COUNTER = new HashMap<>();
/**
* A more complicated mechanism is required to ensure global access across the JVM is synchronized, so file system
@@ -39,20 +39,20 @@ private FileUtil() {
*/
private static synchronized Object getLock(File file) throws IOException {
String canonical = file.getAbsoluteFile().getCanonicalPath();
if(!fileLocks.containsKey(canonical)) {
fileLocks.put(canonical, new Object());
fileLockCounter.put(canonical, 0);
if(!FILE_LOCKS.containsKey(canonical)) {
FILE_LOCKS.put(canonical, new Object());
FILE_LOCK_COUNTER.put(canonical, 0);
}
fileLockCounter.put(canonical, fileLockCounter.get(canonical) + 1);
return fileLocks.get(canonical);
FILE_LOCK_COUNTER.put(canonical, FILE_LOCK_COUNTER.get(canonical) + 1);
return FILE_LOCKS.get(canonical);
}
private static synchronized void freeLock(File file) throws IOException {
String canonical = file.getAbsoluteFile().getCanonicalPath();
fileLockCounter.put(canonical, fileLockCounter.get(canonical) - 1);
if(fileLockCounter.get(canonical) == 0) {
fileLockCounter.remove(canonical);
fileLocks.remove(canonical);
FILE_LOCK_COUNTER.put(canonical, FILE_LOCK_COUNTER.get(canonical) - 1);
if(FILE_LOCK_COUNTER.get(canonical) == 0) {
FILE_LOCK_COUNTER.remove(canonical);
FILE_LOCKS.remove(canonical);
}
}
@@ -80,14 +80,14 @@ public boolean isDecending() {
*/
public List<Integer> getRange() {
//Calculate the size once
double _size = Math.abs(leftBound - rightBound);
double size = Math.abs(leftBound - rightBound);
if(!leftInclusive) {
_size--;
size--;
}
if(rightInclusive) {
_size++;
size++;
}
final int size = (int) _size;
final int finalSize = (int) size;
return new AbstractList<Integer>() {
@Override
@@ -101,7 +101,7 @@ public Integer get(int index) {
@Override
public int size() {
return size;
return finalSize;
}
};
}
@@ -67,9 +67,9 @@ public static String GetString(InputStream in, String encoding) throws Unsupport
}
InputStreamReader input;
input = new InputStreamReader(new BufferedInputStream(in), encoding);
final int CHARS_PER_PAGE = 5000; //counting spaces
final char[] buffer = new char[CHARS_PER_PAGE];
StringBuilder output = new StringBuilder(CHARS_PER_PAGE);
final int charsPerPage = 5000; //counting spaces
final char[] buffer = new char[charsPerPage];
StringBuilder output = new StringBuilder(charsPerPage);
try {
for(int read = input.read(buffer, 0, buffer.length);
read != -1;
@@ -518,7 +518,7 @@ public static int LevenshteinDistance(CharSequence str1,
StringBuilder buf = new StringBuilder();
char escape = 0;
char quote = 0;
boolean was_quote = false;
boolean wasQuote = false;
for(int i = 0; i < args.length(); i++) {
char ch = args.charAt(i);
if(quote != 0) { // we're in a quote
@@ -534,7 +534,7 @@ public static int LevenshteinDistance(CharSequence str1,
continue;
} else if(ch == quote) { // Specifying the same quote again terminates the quote.
quote = 0;
was_quote = true;
wasQuote = true;
continue;
}
} else if(escape != 0) {
@@ -546,10 +546,10 @@ public static int LevenshteinDistance(CharSequence str1,
} else { // outside of quotes and escapes
switch(ch) {
case ' ': // we can tokenize
if(was_quote || buf.length() != 0) {
if(wasQuote || buf.length() != 0) {
arguments.add(buf.toString());
buf = new StringBuilder();
was_quote = false;
wasQuote = false;
}
continue;
case '"': // we can start quotes
@@ -570,7 +570,7 @@ public static int LevenshteinDistance(CharSequence str1,
if(escape != 0) { // makes trailing escapes be appended (erroneous string, though, IMO)
buf.append(escape);
}
if(was_quote || buf.length() != 0) { // add the final string
if(wasQuote || buf.length() != 0) { // add the final string
arguments.add(buf.toString());
}
return arguments;
Oops, something went wrong.

0 comments on commit 065ca39

Please sign in to comment.