From e7554f7856399e51bfe8dee0eaefa2e3ad24f972 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Fri, 8 Jan 2021 17:52:47 +1000 Subject: [PATCH] use ApplesoftConstants as interface --- .../applefile/ApplesoftBasicProgram.java | 15 +----------- .../diskbrowser/applefile/SourceLine.java | 6 +---- .../diskbrowser/applefile/SubLine.java | 24 +++---------------- 3 files changed, 5 insertions(+), 40 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java index 807b6db..2c3d162 100644 --- a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java +++ b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java @@ -1,18 +1,5 @@ package com.bytezone.diskbrowser.applefile; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_DATA; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_DIM; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_FOR; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_GOSUB; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_GOTO; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_IF; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_INPUT; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_NEXT; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_ON; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_PRINT; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_REM; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_RETURN; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -25,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.Utility; // -----------------------------------------------------------------------------------// -public class ApplesoftBasicProgram extends BasicProgram +public class ApplesoftBasicProgram extends BasicProgram implements ApplesoftConstants // -----------------------------------------------------------------------------------// { static final String underline = "----------------------------------------------------" diff --git a/src/com/bytezone/diskbrowser/applefile/SourceLine.java b/src/com/bytezone/diskbrowser/applefile/SourceLine.java index 2b7ffa6..ab82a49 100644 --- a/src/com/bytezone/diskbrowser/applefile/SourceLine.java +++ b/src/com/bytezone/diskbrowser/applefile/SourceLine.java @@ -1,16 +1,12 @@ package com.bytezone.diskbrowser.applefile; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_GOTO; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_REM; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_THEN; - import java.util.ArrayList; import java.util.List; import com.bytezone.diskbrowser.utilities.Utility; // -----------------------------------------------------------------------------------// -public class SourceLine +public class SourceLine implements ApplesoftConstants // -----------------------------------------------------------------------------------// { ApplesoftBasicProgram parent; diff --git a/src/com/bytezone/diskbrowser/applefile/SubLine.java b/src/com/bytezone/diskbrowser/applefile/SubLine.java index 843bd8e..561acd6 100644 --- a/src/com/bytezone/diskbrowser/applefile/SubLine.java +++ b/src/com/bytezone/diskbrowser/applefile/SubLine.java @@ -1,32 +1,17 @@ package com.bytezone.diskbrowser.applefile; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_CALL; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_DATA; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_DEF; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_EQUALS; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_FN; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_FOR; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_GOSUB; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_GOTO; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_LET; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_MINUS; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_NEXT; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_ON; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_ONERR; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_REM; -import static com.bytezone.diskbrowser.applefile.ApplesoftConstants.TOKEN_THEN; - import java.util.ArrayList; import java.util.List; import com.bytezone.diskbrowser.utilities.Utility;; // -----------------------------------------------------------------------------------// -public class SubLine +public class SubLine implements ApplesoftConstants // -----------------------------------------------------------------------------------// { SourceLine parent; + byte[] buffer; int startPtr; int length; @@ -39,7 +24,6 @@ public class SubLine String functionName; String callTarget; - byte[] buffer; private final List gotoLines = new ArrayList<> (); private final List gosubLines = new ArrayList<> (); @@ -171,10 +155,8 @@ public class SubLine { if (!arrays.contains (var)) arrays.add (var); - return; } - - if (!symbols.contains (var)) + else if (!symbols.contains (var)) symbols.add (var); }