Formatting and code readability cleanup (#5467)

* First pass reformatting code to be more readable (common still not done)

* Replace google common collect calls with Java calls where possible

* Remove a bunch of unnecessary parenthesis leaving clarifying ones

* Add some missing @Nonnull annotations

* Fix checking wrong type

* Remove unnecessary continue/return statements and simplify comparision check

* Pass exception instead of directly printing stack trace

* Work on cleaning up common, through config so far

* Work on cleaning up common, through integration so far

* Work on cleaning up common, through network so far

* Work on cleaning up common, through tier so far

* Remove empty constructors that get created by default anyways

* Work on cleaning up common, through transmitters so far

* Work on cleaning up common, through utils so far

* Finish cleaning up spacing for common
This commit is contained in:
Richard Freimer authored and GitHub committed 2019-05-11 14:13:24 -04:00
1 parent 91ef2a5c3d
commit 0d4b50908f
909 files changed
+6234 -15623

No files matched your search

+5 -14
View File
@@ -39,15 +39,14 @@ public class Version {
* Gets a version object from a string.
*
* @param s - string object
*
* @return version if applicable, otherwise null
*/
public static Version get(String s) {
String[] split = s.replace('.', ':').split(":");
if (split.length != 3) {
return null;
}
for (String i : split) {
for (Character c : i.toCharArray()) {
if (!Character.isDigit(c)) {
@@ -57,11 +56,9 @@ public class Version {
}
int[] digits = new int[3];
for (int i = 0; i < 3; i++) {
digits[i] = Integer.parseInt(split[i]);
}
return new Version(digits[0], digits[1], digits[2]);
}
@@ -76,6 +73,7 @@ public class Version {
/**
* @param version Version to check against
*
* @return 1: greater than, 0: equal to, -1: less than
*/
public byte comparedState(Version version) {
@@ -86,31 +84,26 @@ public class Version {
return -1;
} else if (version.minor == minor) {
return (byte) Integer.compare(build, version.build);
} else {
return 1;
}
} else {
return 1;
}
return 1;
}
@Override
public String toString() {
if (major == 0 && minor == 0 && build == 0) {
return "";
} else {
return major + "." + minor + "." + build;
}
return major + "." + minor + "." + build;
}
@Override
public int hashCode() {
int result = 1;
result = 31 * result + build;
result = 31 * result + major;
result = 31 * result + minor;
return result;
}
@@ -119,9 +112,7 @@ public class Version {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Version other = (Version) obj;
return build == other.build && major == other.major && minor == other.minor;
}
}
}