fix: checkstyle.

This commit is contained in:
huanghongxun
2021-10-06 17:44:51 +08:00
parent abae32fd70
commit fdbe38496a
4 changed files with 38 additions and 29 deletions

View File

@@ -54,12 +54,11 @@ public class JFXCheckBoxTreeTableCell<S, T> extends TreeTableCell<S, T> {
setConverter(converter); setConverter(converter);
} }
private ObjectProperty<StringConverter<T>> converter = private ObjectProperty<StringConverter<T>> converter = new SimpleObjectProperty<StringConverter<T>>(this, "converter") {
new SimpleObjectProperty<StringConverter<T>>(this, "converter") { protected void invalidated() {
protected void invalidated() { updateShowLabel();
updateShowLabel(); }
} };
};
public final ObjectProperty<StringConverter<T>> converterProperty() { public final ObjectProperty<StringConverter<T>> converterProperty() {
return converter; return converter;

View File

@@ -176,8 +176,8 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
} }
public void checkUpdates() { public void checkUpdates() {
Controllers.taskDialog( Controllers.taskDialog(Task
Task.composeAsync(() -> { .composeAsync(() -> {
Optional<String> gameVersion = profile.getRepository().getGameVersion(versionId); Optional<String> gameVersion = profile.getRepository().getGameVersion(versionId);
if (gameVersion.isPresent()) { if (gameVersion.isPresent()) {
return new ModCheckUpdatesTask(gameVersion.get(), modManager.getMods()); return new ModCheckUpdatesTask(gameVersion.get(), modManager.getMods());
@@ -191,8 +191,8 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
Controllers.navigate(new ModUpdatesPage(modManager, result)); Controllers.navigate(new ModUpdatesPage(modManager, result));
} }
}) })
.withStagesHint(Collections.singletonList("mods.check_updates")) .withStagesHint(Collections.singletonList("mods.check_updates")),
, i18n("update.checking"), pane -> { i18n("update.checking"), pane -> {
}); });
} }

View File

@@ -1113,7 +1113,7 @@ public abstract class Task<T> {
} }
} }
public class CountTask extends Task<T> { public final class CountTask extends Task<T> {
private final String countStage; private final String countStage;
private CountTask(String countStage) { private CountTask(String countStage) {

View File

@@ -48,7 +48,7 @@ import java.nio.charset.StandardCharsets;
* Original MurmurHash2 c++ code</a> * Original MurmurHash2 c++ code</a>
* @since 1.13 * @since 1.13
*/ */
public class MurmurHash2 { public final class MurmurHash2 {
// Constants for 32-bit variant // Constants for 32-bit variant
private static final int M32 = 0x5bd1e995; private static final int M32 = 0x5bd1e995;
@@ -58,16 +58,18 @@ public class MurmurHash2 {
private static final long M64 = 0xc6a4a7935bd1e995L; private static final long M64 = 0xc6a4a7935bd1e995L;
private static final int R64 = 47; private static final int R64 = 47;
/** No instance methods. */ /**
* No instance methods.
*/
private MurmurHash2() { private MurmurHash2() {
} }
/** /**
* Generates a 32-bit hash from byte array with the given length and seed. * Generates a 32-bit hash from byte array with the given length and seed.
* *
* @param data The input byte array * @param data The input byte array
* @param length The length of the array * @param length The length of the array
* @param seed The initial seed value * @param seed The initial seed value
* @return The 32-bit hash * @return The 32-bit hash
*/ */
public static int hash32(final byte[] data, final int length, final int seed) { public static int hash32(final byte[] data, final int length, final int seed) {
@@ -93,8 +95,10 @@ public class MurmurHash2 {
switch (length - index) { switch (length - index) {
case 3: case 3:
h ^= (data[index + 2] & 0xff) << 16; h ^= (data[index + 2] & 0xff) << 16;
// fallthrough
case 2: case 2:
h ^= (data[index + 1] & 0xff) << 8; h ^= (data[index + 1] & 0xff) << 8;
// fallthrough
case 1: case 1:
h ^= (data[index] & 0xff); h ^= (data[index] & 0xff);
h *= M32; h *= M32;
@@ -118,7 +122,7 @@ public class MurmurHash2 {
* int hash = MurmurHash2.hash32(data, length, seed); * int hash = MurmurHash2.hash32(data, length, seed);
* </pre> * </pre>
* *
* @param data The input byte array * @param data The input byte array
* @param length The length of the array * @param length The length of the array
* @return The 32-bit hash * @return The 32-bit hash
* @see #hash32(byte[], int, int) * @see #hash32(byte[], int, int)
@@ -161,8 +165,8 @@ public class MurmurHash2 {
* int hash = MurmurHash2.hash32(bytes, bytes.length, seed); * int hash = MurmurHash2.hash32(bytes, bytes.length, seed);
* </pre> * </pre>
* *
* @param text The input string * @param text The input string
* @param from The starting index * @param from The starting index
* @param length The length of the substring * @param length The length of the substring
* @return The 32-bit hash * @return The 32-bit hash
* @see #hash32(byte[], int, int) * @see #hash32(byte[], int, int)
@@ -174,9 +178,9 @@ public class MurmurHash2 {
/** /**
* Generates a 64-bit hash from byte array of the given length and seed. * Generates a 64-bit hash from byte array of the given length and seed.
* *
* @param data The input byte array * @param data The input byte array
* @param length The length of the array * @param length The length of the array
* @param seed The initial seed value * @param seed The initial seed value
* @return The 64-bit hash of the given array * @return The 64-bit hash of the given array
*/ */
public static long hash64(final byte[] data, final int length, final int seed) { public static long hash64(final byte[] data, final int length, final int seed) {
@@ -201,16 +205,22 @@ public class MurmurHash2 {
switch (length - index) { switch (length - index) {
case 7: case 7:
h ^= ((long) data[index + 6] & 0xff) << 48; h ^= ((long) data[index + 6] & 0xff) << 48;
// fallthrough
case 6: case 6:
h ^= ((long) data[index + 5] & 0xff) << 40; h ^= ((long) data[index + 5] & 0xff) << 40;
// fallthrough
case 5: case 5:
h ^= ((long) data[index + 4] & 0xff) << 32; h ^= ((long) data[index + 4] & 0xff) << 32;
// fallthrough
case 4: case 4:
h ^= ((long) data[index + 3] & 0xff) << 24; h ^= ((long) data[index + 3] & 0xff) << 24;
// fallthrough
case 3: case 3:
h ^= ((long) data[index + 2] & 0xff) << 16; h ^= ((long) data[index + 2] & 0xff) << 16;
// fallthrough
case 2: case 2:
h ^= ((long) data[index + 1] & 0xff) << 8; h ^= ((long) data[index + 1] & 0xff) << 8;
// fallthrough
case 1: case 1:
h ^= ((long) data[index] & 0xff); h ^= ((long) data[index] & 0xff);
h *= M64; h *= M64;
@@ -232,7 +242,7 @@ public class MurmurHash2 {
* int hash = MurmurHash2.hash64(data, length, seed); * int hash = MurmurHash2.hash64(data, length, seed);
* </pre> * </pre>
* *
* @param data The input byte array * @param data The input byte array
* @param length The length of the array * @param length The length of the array
* @return The 64-bit hash * @return The 64-bit hash
* @see #hash64(byte[], int, int) * @see #hash64(byte[], int, int)
@@ -275,8 +285,8 @@ public class MurmurHash2 {
* int hash = MurmurHash2.hash64(bytes, bytes.length, seed); * int hash = MurmurHash2.hash64(bytes, bytes.length, seed);
* </pre> * </pre>
* *
* @param text The The input string * @param text The The input string
* @param from The starting index * @param from The starting index
* @param length The length of the substring * @param length The length of the substring
* @return The 64-bit hash * @return The 64-bit hash
* @see #hash64(byte[], int, int) * @see #hash64(byte[], int, int)
@@ -288,13 +298,13 @@ public class MurmurHash2 {
/** /**
* Gets the little-endian int from 4 bytes starting at the specified index. * Gets the little-endian int from 4 bytes starting at the specified index.
* *
* @param data The data * @param data The data
* @param index The index * @param index The index
* @return The little-endian int * @return The little-endian int
*/ */
private static int getLittleEndianInt(final byte[] data, final int index) { private static int getLittleEndianInt(final byte[] data, final int index) {
return ((data[index ] & 0xff) ) | return ((data[index] & 0xff)) |
((data[index + 1] & 0xff) << 8) | ((data[index + 1] & 0xff) << 8) |
((data[index + 2] & 0xff) << 16) | ((data[index + 2] & 0xff) << 16) |
((data[index + 3] & 0xff) << 24); ((data[index + 3] & 0xff) << 24);
} }
@@ -302,13 +312,13 @@ public class MurmurHash2 {
/** /**
* Gets the little-endian long from 8 bytes starting at the specified index. * Gets the little-endian long from 8 bytes starting at the specified index.
* *
* @param data The data * @param data The data
* @param index The index * @param index The index
* @return The little-endian long * @return The little-endian long
*/ */
private static long getLittleEndianLong(final byte[] data, final int index) { private static long getLittleEndianLong(final byte[] data, final int index) {
return (((long) data[index ] & 0xff) ) | return (((long) data[index] & 0xff)) |
(((long) data[index + 1] & 0xff) << 8) | (((long) data[index + 1] & 0xff) << 8) |
(((long) data[index + 2] & 0xff) << 16) | (((long) data[index + 2] & 0xff) << 16) |
(((long) data[index + 3] & 0xff) << 24) | (((long) data[index + 3] & 0xff) << 24) |
(((long) data[index + 4] & 0xff) << 32) | (((long) data[index + 4] & 0xff) << 32) |