From 3bf972a761d14e6b9825e4e10a40a4805ef154c0 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Sat, 16 Sep 2023 06:51:31 +1000 Subject: [PATCH] tidying --- .../applefile/SHRPictureFile1.java | 2 +- .../diskbrowser/applefile/SubLine.java | 2 +- .../diskbrowser/utilities/Utility.java | 29 +++++++++++-------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java index c3c9fc7..a77bfaf 100644 --- a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java +++ b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java @@ -243,7 +243,7 @@ public class SHRPictureFile1 extends HiResImage colorTables[i] = new ColorTable (i, data, ptr); else colorTables[i] = new ColorTable (i, 0x00); // default empty table !! not - // finished + // finished ptr += 32; } } diff --git a/src/com/bytezone/diskbrowser/applefile/SubLine.java b/src/com/bytezone/diskbrowser/applefile/SubLine.java index 5586c34..55cee91 100644 --- a/src/com/bytezone/diskbrowser/applefile/SubLine.java +++ b/src/com/bytezone/diskbrowser/applefile/SubLine.java @@ -202,7 +202,7 @@ public class SubLine implements ApplesoftConstants private void checkFunction (String var, byte terminator) // ---------------------------------------------------------------------------------// { - assert terminator == ASCII_LEFT_BRACKET; + // assert terminator == ASCII_LEFT_BRACKET; if (!functions.contains (var)) functions.add (var); diff --git a/src/com/bytezone/diskbrowser/utilities/Utility.java b/src/com/bytezone/diskbrowser/utilities/Utility.java index 46a207e..c658ae8 100644 --- a/src/com/bytezone/diskbrowser/utilities/Utility.java +++ b/src/com/bytezone/diskbrowser/utilities/Utility.java @@ -40,8 +40,8 @@ public final class Utility private static MathContext mathContext4 = new MathContext (6); private static MathContext mathContext8 = new MathContext (15); - private static final List suffixes = Arrays.asList ("po", "dsk", "do", "hdv", "2mg", - "d13", "sdk", "shk", "bxy", "bny", "bqy", "woz", "img", "dimg"); + private static final List suffixes = Arrays.asList ("po", "dsk", "do", "hdv", + "2mg", "d13", "sdk", "shk", "bxy", "bny", "bqy", "woz", "img", "dimg"); // ---------------------------------------------------------------------------------// private Utility () @@ -255,7 +255,8 @@ public final class Utility } catch (DateTimeException e) { - System.out.printf ("Bad date/time: %d %d %d %d %d %n", year, month, day, hour, minute); + System.out.printf ("Bad date/time: %d %d %d %d %d %n", year, month, day, hour, + minute); } } @@ -315,7 +316,8 @@ public final class Utility public static int readTriple (byte[] buffer, int ptr) // ---------------------------------------------------------------------------------// { - return (buffer[ptr] & 0xFF) | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr + 2] & 0xFF) << 16; + return (buffer[ptr] & 0xFF) | (buffer[ptr + 1] & 0xFF) << 8 + | (buffer[ptr + 2] & 0xFF) << 16; } // ---------------------------------------------------------------------------------// @@ -384,8 +386,8 @@ public final class Utility if (exponent == 0) return 0.0; - int mantissa = - (buffer[ptr + 2] & 0x7F) << 16 | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr] & 0xFF); + int mantissa = (buffer[ptr + 2] & 0x7F) << 16 | (buffer[ptr + 1] & 0xFF) << 8 + | (buffer[ptr] & 0xFF); boolean negative = (buffer[ptr + 2] & 0x80) != 0; double value = 0.5; @@ -408,9 +410,10 @@ public final class Utility if (exponent == 0) return 0.0; - long mantissa = (long) (buffer[ptr + 6] & 0x7F) << 48 | (long) (buffer[ptr + 5] & 0xFF) << 40 - | (long) (buffer[ptr + 4] & 0xFF) << 32 | (long) (buffer[ptr + 3] & 0xFF) << 24 - | (buffer[ptr + 2] & 0xFF) << 16 | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr] & 0xFF); + long mantissa = (long) (buffer[ptr + 6] & 0x7F) << 48 + | (long) (buffer[ptr + 5] & 0xFF) << 40 | (long) (buffer[ptr + 4] & 0xFF) << 32 + | (long) (buffer[ptr + 3] & 0xFF) << 24 | (buffer[ptr + 2] & 0xFF) << 16 + | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr] & 0xFF); boolean negative = (buffer[ptr + 6] & 0x80) != 0; double value = 0.5; @@ -519,10 +522,11 @@ public final class Utility { int[] val = new int[6]; for (int i = 0; i < 6; i++) - // val[i] = Integer.parseInt (String.format ("%02X", buffer[ptr + i] & 0xFF)); + // val[i] = Integer.parseInt (String.format ("%02X", buffer[ptr + i] & 0xFF)); val[i] = buffer[ptr + i] & 0xFF; - LocalDateTime date = LocalDateTime.of (val[3] + 2000, val[5], val[4], val[2], val[1], val[0]); + LocalDateTime date = + LocalDateTime.of (val[3] + 2000, val[5], val[4], val[2], val[1], val[0]); return date; } catch (DateTimeException e) @@ -630,7 +634,8 @@ public final class Utility public static boolean isPossibleVariable (byte value) // ---------------------------------------------------------------------------------// { - return isDigit (value) || isLetter (value) || value == ASCII_DOLLAR || value == ASCII_PERCENT; + return isDigit (value) || isLetter (value) || value == ASCII_DOLLAR + || value == ASCII_PERCENT; } // ---------------------------------------------------------------------------------//