From 6c8dad1ea7e477c3dbd2cbe4a7f5867ba928e36e Mon Sep 17 00:00:00 2001 From: Robert Greene Date: Tue, 11 Feb 2003 04:35:04 +0000 Subject: [PATCH] Added getFiletypes (all possible filetypes) and needsAddress. --- .../applecommander/storage/DosFormatDisk.java | 22 +++++++++++++++ .../applecommander/storage/FormattedDisk.java | 11 ++++++++ .../storage/PascalFormatDisk.java | 28 +++++++++++++++++++ .../storage/RdosFormatDisk.java | 21 ++++++++++++++ 4 files changed, 82 insertions(+) diff --git a/src/com/webcodepro/applecommander/storage/DosFormatDisk.java b/src/com/webcodepro/applecommander/storage/DosFormatDisk.java index 846f420..538bbd2 100644 --- a/src/com/webcodepro/applecommander/storage/DosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/DosFormatDisk.java @@ -49,6 +49,12 @@ public class DosFormatDisk extends FormattedDisk { * The standard track/sector pairs in a track/sector list. */ public static final int TRACK_SECTOR_PAIRS = 122; + /** + * The list of filetypes available. + */ + private static final String[] filetypes = { + "T", "A", "I", "B", "S", "R", "a", "b" + }; /** * Use this inner interface for managing the disk usage data. @@ -637,4 +643,20 @@ public class DosFormatDisk extends FormattedDisk { int len = Math.min(filename.length(), 30); return filename.toUpperCase().substring(0, len).trim(); } + + /** + * Returns a list of possible file types. Since the filetype is + * specific to each operating system, a simple String is used. + */ + public String[] getFiletypes() { + return filetypes; + } + + /** + * Indicates if this filetype requires an address component. + * For DOS, only the Binary type needs an address. + */ + public boolean needsAddress(String filetype) { + return "B".equals(filetype); + } } diff --git a/src/com/webcodepro/applecommander/storage/FormattedDisk.java b/src/com/webcodepro/applecommander/storage/FormattedDisk.java index f89c26b..83bd92d 100644 --- a/src/com/webcodepro/applecommander/storage/FormattedDisk.java +++ b/src/com/webcodepro/applecommander/storage/FormattedDisk.java @@ -342,4 +342,15 @@ public abstract class FormattedDisk extends Disk { * the filename. */ public abstract String getSuggestedFilename(String filename); + + /** + * Returns a list of possible file types. Since the filetype is + * specific to each operating system, a simple String is used. + */ + public abstract String[] getFiletypes(); + + /** + * Indicates if this filetype requires an address component. + */ + public abstract boolean needsAddress(String filetype); } diff --git a/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java b/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java index dafb473..2019f6f 100644 --- a/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java @@ -40,6 +40,18 @@ public class PascalFormatDisk extends FormattedDisk { * The number of Pascal blocks on a 140K disk. */ public static final int PASCAL_BLOCKS_ON_140K_DISK = 280; + /** + * The know filetypes for a Pascal disk. + */ + private static final String[] filetypes = { + "xdskfile", + "codefile", + "textfile", + "infofile", + "datafile", + "graffile", + "fotofile", + "securedir" }; /** * Use this inner interface for managing the disk usage data. @@ -455,4 +467,20 @@ public class PascalFormatDisk extends FormattedDisk { } return newName.toString().toUpperCase().trim(); } + + /** + * Returns a list of possible file types. Since the filetype is + * specific to each operating system, a simple String is used. + */ + public String[] getFiletypes() { + return filetypes; + } + + /** + * Indicates if this filetype requires an address component. + * No Pascal filetypes require or support an address. + */ + public boolean needsAddress(String filetype) { + return false; + } } diff --git a/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java index 7fe8bfe..5efbb12 100644 --- a/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java @@ -60,6 +60,10 @@ public class RdosFormatDisk extends FormattedDisk { * RDOS apparantly only worked on 5.25" disks. */ public static final int BLOCKS_ON_DISK = 455; + /** + * The known filetypes for a RDOS disk. + */ + public static final String[] filetypes = { "B", "A", "T" }; /** * Use this inner interface for managing the disk usage data. @@ -416,4 +420,21 @@ public class RdosFormatDisk extends FormattedDisk { int len = Math.min(filename.length(), 24); return filename.toUpperCase().substring(0, len).trim(); } + + /** + * Returns a list of possible file types. Since the filetype is + * specific to each operating system, a simple String is used. + */ + public String[] getFiletypes() { + return filetypes; + } + + /** + * Indicates if this filetype requires an address component. + * Presumably, the "B" filetype is binary and will need an + * address. + */ + public boolean needsAddress(String filetype) { + return "B".equals(filetype); + } }