From adbd14eaeed47a8762e90976f7531fcc6c262277 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 23 Jul 2017 11:30:52 +0200 Subject: [PATCH] Refactored OsType -> OSType --- src/dorkbox/util/OS.java | 42 +++++++-------- src/dorkbox/util/{OsType.java => OSType.java} | 52 +++++++++---------- 2 files changed, 47 insertions(+), 47 deletions(-) rename src/dorkbox/util/{OsType.java => OSType.java} (59%) diff --git a/src/dorkbox/util/OS.java b/src/dorkbox/util/OS.java index a6a6da0..dbaeb48 100644 --- a/src/dorkbox/util/OS.java +++ b/src/dorkbox/util/OS.java @@ -42,7 +42,7 @@ class OS { public static final int javaVersion = _getJavaVersion(); - private static final OsType osType; + private static final OSType osType; private static final String originalTimeZone = TimeZone.getDefault() .getID(); @@ -89,31 +89,31 @@ class OS { // android check from https://stackoverflow.com/questions/14859954/android-os-arch-output-for-arm-mips-x86 if (osArch.equals("armeabi")) { // really old/low-end non-hf 32bit cpu - osType = OsType.AndroidArm56; + osType = OSType.AndroidArm56; } else if (osArch.equals("armeabi-v7a")) { // 32bit hf cpu - osType = OsType.AndroidArm7; + osType = OSType.AndroidArm7; } else if (osArch.equals("arm64-v8a")) { // 64bit hf cpu - osType = OsType.AndroidArm8; + osType = OSType.AndroidArm8; } else if (osArch.equals("x86")) { // 32bit x86 (usually emulator) - osType = OsType.AndroidX86; + osType = OSType.AndroidX86; } else if (osArch.equals("x86_64")) { // 64bit x86 (usually emulator) - osType = OsType.AndroidX86_64; + osType = OSType.AndroidX86_64; } else if (osArch.equals("mips")) { // 32bit mips - osType = OsType.AndroidMips; + osType = OSType.AndroidMips; } else if (osArch.equals("mips64")) { // 64bit mips - osType = OsType.AndroidMips64; + osType = OSType.AndroidMips64; } else { // who knows? osType = null; @@ -122,52 +122,52 @@ class OS { else { // normal linux 32/64/arm32/arm64 if ("amd64".equals(osArch)) { - osType = OsType.Linux64; + osType = OSType.Linux64; } else { if (osArch.startsWith("arm")) { if (osArch.contains("v8")) { - osType = OsType.LinuxArm64; + osType = OSType.LinuxArm64; } else { - osType = OsType.LinuxArm32; + osType = OSType.LinuxArm32; } } else { - osType = OsType.Linux32; + osType = OSType.Linux32; } } } } else if (osName.startsWith("windows")) { if ("amd64".equals(osArch)) { - osType = OsType.Windows64; + osType = OSType.Windows64; } else { - osType = OsType.Windows32; + osType = OSType.Windows32; } } else if (osName.startsWith("mac") || osName.startsWith("darwin")) { if ("x86_64".equals(osArch)) { - osType = OsType.MacOsX64; + osType = OSType.MacOsX64; } else { - osType = OsType.MacOsX32; + osType = OSType.MacOsX32; } } else if (osName.startsWith("freebsd") || osName.contains("nix") || osName.contains("nux") || osName.startsWith("aix")) { if ("x86".equals(osArch) || "i386".equals(osArch)) { - osType = OsType.Unix32; + osType = OSType.Unix32; } else if ("arm".equals(osArch)) { - osType = OsType.UnixArm; + osType = OSType.UnixArm; } else { - osType = OsType.Unix64; + osType = OSType.Unix64; } } else if (osName.startsWith("solaris") || osName.startsWith("sunos")) { - osType = OsType.Solaris; + osType = OSType.Solaris; } else { osType = null; @@ -179,7 +179,7 @@ class OS { } public static - OsType get() { + OSType get() { return osType; } diff --git a/src/dorkbox/util/OsType.java b/src/dorkbox/util/OSType.java similarity index 59% rename from src/dorkbox/util/OsType.java rename to src/dorkbox/util/OSType.java index 29ac6af..fc9c175 100644 --- a/src/dorkbox/util/OsType.java +++ b/src/dorkbox/util/OSType.java @@ -15,7 +15,7 @@ */ package dorkbox.util; -public enum OsType { +public enum OSType { Windows32("windows_32", ".dll"), Windows64("windows_64", ".dll"), Linux32("linux_32", ".so"), @@ -50,7 +50,7 @@ public enum OsType { private final String name; private final String[] libraryNames; - OsType(String name, String... libraryNames) { + OSType(String name, String... libraryNames) { this.name = name; this.libraryNames = libraryNames; } @@ -65,23 +65,23 @@ public enum OsType { public boolean is64bit() { - return this == OsType.Linux64 || this == OsType.LinuxArm64 || - this == OsType.Windows64 || this == OsType.MacOsX64 || - this == OsType.AndroidArm8 || this == OsType.AndroidX86_64 || this == OsType.AndroidMips64 || - this == OsType.Unix64; + return this == OSType.Linux64 || this == OSType.LinuxArm64 || + this == OSType.Windows64 || this == OSType.MacOsX64 || + this == OSType.AndroidArm8 || this == OSType.AndroidX86_64 || this == OSType.AndroidMips64 || + this == OSType.Unix64; } public boolean is32bit() { - return this == OsType.Linux32 || this == OsType.LinuxArm32 || - this == OsType.Windows32 || this == OsType.MacOsX32 || - this == OsType.AndroidArm56 || this == OsType.AndroidArm7 || this == OsType.AndroidX86 || this == OsType.AndroidMips || - this == OsType.UnixArm || this == OsType.Unix32; + return this == OSType.Linux32 || this == OSType.LinuxArm32 || + this == OSType.Windows32 || this == OSType.MacOsX32 || + this == OSType.AndroidArm56 || this == OSType.AndroidArm7 || this == OSType.AndroidX86 || this == OSType.AndroidMips || + this == OSType.UnixArm || this == OSType.Unix32; } public boolean isMips() { - return this == OsType.AndroidMips || this == OsType.AndroidMips64; + return this == OSType.AndroidMips || this == OSType.AndroidMips64; } /** @@ -89,48 +89,48 @@ public enum OsType { */ public boolean isX86() { - return this == OsType.Linux64 || this == OsType.LinuxArm64 || - this == OsType.Windows64 || this == OsType.MacOsX64 || - this == OsType.Linux32 || this == OsType.LinuxArm32 || - this == OsType.Windows32 || this == OsType.MacOsX32 || - this == OsType.Unix32 || this == OsType.Unix64 || - this == OsType.AndroidX86 || this == OsType.AndroidX86_64; + return this == OSType.Linux64 || this == OSType.LinuxArm64 || + this == OSType.Windows64 || this == OSType.MacOsX64 || + this == OSType.Linux32 || this == OSType.LinuxArm32 || + this == OSType.Windows32 || this == OSType.MacOsX32 || + this == OSType.Unix32 || this == OSType.Unix64 || + this == OSType.AndroidX86 || this == OSType.AndroidX86_64; } public boolean isArm() { - return this == OsType.LinuxArm32 || this == OsType.LinuxArm64 || - this == OsType.AndroidArm56 || this == OsType.AndroidArm7 || this == OsType.AndroidArm8; + return this == OSType.LinuxArm32 || this == OSType.LinuxArm64 || + this == OSType.AndroidArm56 || this == OSType.AndroidArm7 || this == OSType.AndroidArm8; } public boolean isLinux() { - return this == OsType.Linux32 || this == OsType.Linux64 || this == OsType.LinuxArm64 || this == OsType.LinuxArm32; + return this == OSType.Linux32 || this == OSType.Linux64 || this == OSType.LinuxArm64 || this == OSType.LinuxArm32; } public boolean isUnix() { - return this == OsType.Unix32 || this == OsType.Unix64 || this == OsType.UnixArm; + return this == OSType.Unix32 || this == OSType.Unix64 || this == OSType.UnixArm; } public boolean isSolaris() { - return this == OsType.Solaris; + return this == OSType.Solaris; } public boolean isWindows() { - return this == OsType.Windows64 || this == OsType.Windows32; + return this == OSType.Windows64 || this == OSType.Windows32; } public boolean isMacOsX() { - return this == OsType.MacOsX64 || this == OsType.MacOsX32; + return this == OSType.MacOsX64 || this == OSType.MacOsX32; } public boolean isAndroid() { - return this == OsType.AndroidArm56 || this == OsType.AndroidArm7 || this == OsType.AndroidX86 || this == OsType.AndroidMips || - this == OsType.AndroidArm8 || this == OsType.AndroidX86_64 || this == OsType.AndroidMips64; + return this == OSType.AndroidArm56 || this == OSType.AndroidArm7 || this == OSType.AndroidX86 || this == OSType.AndroidMips || + this == OSType.AndroidArm8 || this == OSType.AndroidX86_64 || this == OSType.AndroidMips64; } }