From ecf6f16a83c580fafc47a2f07f756cdcf7cd6b8d Mon Sep 17 00:00:00 2001 From: Robert Greene Date: Tue, 11 Feb 2003 04:34:28 +0000 Subject: [PATCH] Added needsAddress and setAddress. --- .../applecommander/storage/DosFileEntry.java | 17 ++++++++++++ .../applecommander/storage/FileEntry.java | 13 +++++++++ .../storage/PascalFileEntry.java | 27 ++++++++++++------- .../applecommander/storage/RdosFileEntry.java | 17 ++++++++++++ 4 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/com/webcodepro/applecommander/storage/DosFileEntry.java b/src/com/webcodepro/applecommander/storage/DosFileEntry.java index 38de396..92be26b 100644 --- a/src/com/webcodepro/applecommander/storage/DosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/DosFileEntry.java @@ -430,4 +430,21 @@ public class DosFileEntry implements FileEntry { public FormattedDisk getFormattedDisk() { return disk; } + + /** + * Indicates if this filetype requires an address component. + * Note that the FormattedDisk also has this method - normally, + * this will defer to the method on FormattedDisk, as it will be + * more generic. + */ + public boolean needsAddress() { + return disk.needsAddress(getFiletype()); + } + + /** + * Set the address that this file loads at. + */ + public void setAddress(int address) { + // FIXME - need to implement + } } diff --git a/src/com/webcodepro/applecommander/storage/FileEntry.java b/src/com/webcodepro/applecommander/storage/FileEntry.java index bc93bce..8a479b4 100644 --- a/src/com/webcodepro/applecommander/storage/FileEntry.java +++ b/src/com/webcodepro/applecommander/storage/FileEntry.java @@ -126,4 +126,17 @@ public interface FileEntry { * Return the maximum filename length. */ public int getMaximumFilenameLength(); + + /** + * Indicates if this filetype requires an address component. + * Note that the FormattedDisk also has this method - normally, + * this will defer to the method on FormattedDisk, as it will be + * more generic. + */ + public abstract boolean needsAddress(); + + /** + * Set the address that this file loads at. + */ + public abstract void setAddress(int address); } diff --git a/src/com/webcodepro/applecommander/storage/PascalFileEntry.java b/src/com/webcodepro/applecommander/storage/PascalFileEntry.java index 06ae0f2..ca6d5c4 100644 --- a/src/com/webcodepro/applecommander/storage/PascalFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/PascalFileEntry.java @@ -83,15 +83,7 @@ public class PascalFileEntry implements FileEntry { * Return the filetype of this file. */ public String getFiletype() { - String filetypes[] = { - "xdskfile (for bad blocks)", - "codefile", - "textfile", - "infofile", - "datafile", - "graffile", - "fotofile", - "securedir" }; + String[] filetypes = disk.getFiletypes(); int filetype = fileEntry[4] & 0x0f; if (filetype == 0 || filetype > filetypes.length) { return "unknown (" + filetype + ")"; @@ -257,4 +249,21 @@ public class PascalFileEntry implements FileEntry { public FormattedDisk getFormattedDisk() { return disk; } + + /** + * Indicates if this filetype requires an address component. + * Note that the FormattedDisk also has this method - normally, + * this will defer to the method on FormattedDisk, as it will be + * more generic. + */ + public boolean needsAddress() { + return false; + } + + /** + * Set the address that this file loads at. + */ + public void setAddress(int address) { + // Does not apply. + } } diff --git a/src/com/webcodepro/applecommander/storage/RdosFileEntry.java b/src/com/webcodepro/applecommander/storage/RdosFileEntry.java index 666b7b4..a72dc85 100644 --- a/src/com/webcodepro/applecommander/storage/RdosFileEntry.java +++ b/src/com/webcodepro/applecommander/storage/RdosFileEntry.java @@ -288,4 +288,21 @@ public class RdosFileEntry implements FileEntry { public FormattedDisk getFormattedDisk() { return disk; } + + /** + * Indicates if this filetype requires an address component. + * Note that the FormattedDisk also has this method - normally, + * this will defer to the method on FormattedDisk, as it will be + * more generic. + */ + public boolean needsAddress() { + return disk.needsAddress(getFiletype()); + } + + /** + * Set the address that this file loads at. + */ + public void setAddress(int address) { + // FIXME - need to implement + } }