mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-02 22:32:45 +00:00
adding new instanceof pattern
This commit is contained in:
parent
fb748df4ae
commit
6dfc72b2d2
@ -49,8 +49,8 @@ public class DefaultAppleFileSource implements AppleFileSource
|
||||
{
|
||||
this (title, file, owner);
|
||||
this.blocks = blocks;
|
||||
if (file instanceof DefaultDataSource)
|
||||
((DefaultDataSource) file).buffer = owner.getDisk ().readBlocks (blocks);
|
||||
if (file instanceof DefaultDataSource dds)
|
||||
dds.buffer = owner.getDisk ().readBlocks (blocks);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -58,8 +58,8 @@ public class DefaultAppleFileSource implements AppleFileSource
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.blocks = blocks;
|
||||
if (file instanceof DefaultDataSource)
|
||||
((DefaultDataSource) file).buffer = owner.getDisk ().readBlocks (blocks);
|
||||
if (file instanceof DefaultDataSource dds)
|
||||
dds.buffer = owner.getDisk ().readBlocks (blocks);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -173,13 +173,13 @@ public class DiskFactory
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// e.printStackTrace ();
|
||||
// e.printStackTrace ();
|
||||
if (e.getMessage () == null)
|
||||
System.out.println (e);
|
||||
else
|
||||
System.out.println (e.getMessage ());
|
||||
System.out.printf ("Error unpacking: %s%n", file.getAbsolutePath ());
|
||||
// System.out.println (nuFX);
|
||||
// System.out.println (nuFX);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -204,10 +204,10 @@ public class DiskFactory
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// e.printStackTrace ();
|
||||
// e.printStackTrace ();
|
||||
System.out.println (e.getMessage ());
|
||||
System.out.printf ("Error unpacking: %s%n", file.getAbsolutePath ());
|
||||
// System.out.println (binary2);
|
||||
// System.out.println (binary2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -419,7 +419,7 @@ public class DiskFactory
|
||||
|
||||
if (true)
|
||||
{
|
||||
// long checksum = appleDisk256.getBootChecksum ();
|
||||
// long checksum = appleDisk256.getBootChecksum ();
|
||||
long checksum = 0;
|
||||
|
||||
if (checksum == 227968344L) // empty boot sector
|
||||
@ -444,7 +444,7 @@ public class DiskFactory
|
||||
if (debug)
|
||||
System.out.println (" known DOS checksum : " + checksum);
|
||||
disk = checkDos (appleDisk256);
|
||||
// disk2 = checkProdos (appleDisk512); // no need for this
|
||||
// disk2 = checkProdos (appleDisk512); // no need for this
|
||||
if (disk2 != null && disk != null) // should be impossible
|
||||
{
|
||||
if (debug)
|
||||
@ -490,11 +490,11 @@ public class DiskFactory
|
||||
else if (debug)
|
||||
System.out.println (" unknown checksum : " + checksum);
|
||||
|
||||
// else if (checksum == 1212926910L || checksum == 1365043894L
|
||||
// || checksum == 2128073918L)
|
||||
// disk = checkCPMDisk (file);
|
||||
// else if (checksum == 1212926910L || checksum == 1365043894L
|
||||
// || checksum == 2128073918L)
|
||||
// disk = checkCPMDisk (file);
|
||||
|
||||
// System.out.println (checksum);
|
||||
// System.out.println (checksum);
|
||||
|
||||
if (disk != null)
|
||||
{
|
||||
@ -608,7 +608,7 @@ public class DiskFactory
|
||||
if (debug)
|
||||
System.out.println (" --> DOS");
|
||||
DosDisk dosDisk = new DosDisk (disk);
|
||||
// disk.setDosVersion (dosDisk.getVersion ());
|
||||
// disk.setDosVersion (dosDisk.getVersion ());
|
||||
|
||||
return dosDisk;
|
||||
}
|
||||
@ -701,10 +701,10 @@ public class DiskFactory
|
||||
System.out.println ("*** extended ***"); // System Addons.hdv
|
||||
}
|
||||
AppleDisk disk;
|
||||
// if (nuFX == null)
|
||||
// if (nuFX == null)
|
||||
disk = new AppleDisk (file, tracks, 8);
|
||||
// else
|
||||
// disk = new AppleDisk (file, tracks, 8, nuFX);
|
||||
// else
|
||||
// disk = new AppleDisk (file, tracks, 8, nuFX);
|
||||
|
||||
if (ProdosDisk.isCorrectFormat (disk))
|
||||
{
|
||||
@ -855,7 +855,7 @@ public class DiskFactory
|
||||
String fileName = file.getAbsolutePath ().toLowerCase ();
|
||||
int pos = file.getAbsolutePath ().indexOf ('.');
|
||||
char c = fileName.charAt (pos - 1);
|
||||
// String suffix = fileName.substring (pos + 1);
|
||||
// String suffix = fileName.substring (pos + 1);
|
||||
int requiredDisks = c == '1' ? 6 : c == 'a' ? 10 : 0;
|
||||
|
||||
if (requiredDisks > 0)
|
||||
|
@ -158,9 +158,9 @@ class AppleDiskTab extends AbstractTab
|
||||
|
||||
// check for multi-volume disk (only search the current branch)
|
||||
FormattedDisk fd = ((AppleFileSource) rootNode.getUserObject ()).getFormattedDisk ();
|
||||
if (fd instanceof HybridDisk)
|
||||
if (fd instanceof HybridDisk hd)
|
||||
{
|
||||
int volume = ((HybridDisk) fd).getCurrentDiskNo ();
|
||||
int volume = hd.getCurrentDiskNo ();
|
||||
rootNode = (DefaultMutableTreeNode) rootNode.getChildAt (volume);
|
||||
}
|
||||
|
||||
@ -169,8 +169,8 @@ class AppleDiskTab extends AbstractTab
|
||||
{
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement ();
|
||||
Object userObject = node.getUserObject ();
|
||||
if (userObject instanceof AppleFileSource
|
||||
&& nodeName.equals (((AppleFileSource) userObject).getUniqueName ()))
|
||||
if (userObject instanceof AppleFileSource afs
|
||||
&& nodeName.equals (afs.getUniqueName ()))
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
|
@ -212,7 +212,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||
addLauncherMenu ();
|
||||
|
||||
fileMenu.add (printItem);
|
||||
// fileMenu.addSeparator ();
|
||||
// fileMenu.addSeparator ();
|
||||
fileMenu.add (closeTabItem);
|
||||
|
||||
JMenuItem fontItem = new JMenuItem (fontAction);
|
||||
@ -271,13 +271,13 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||
applesoftMenu.add (splitRemarkItem);
|
||||
applesoftMenu.add (splitDimItem);
|
||||
applesoftMenu.add (alignAssignItem);
|
||||
// applesoftMenu.add (showBasicTargetsItem);
|
||||
// applesoftMenu.add (onlyShowTargetLinesItem);
|
||||
// applesoftMenu.add (showBasicTargetsItem);
|
||||
// applesoftMenu.add (onlyShowTargetLinesItem);
|
||||
applesoftMenu.add (showCaretItem);
|
||||
applesoftMenu.add (showThenItem);
|
||||
applesoftMenu.add (blankAfterReturnItem);
|
||||
applesoftMenu.add (formatRemItem);
|
||||
// applesoftMenu.add (deleteExtraRemSpace);
|
||||
// applesoftMenu.add (deleteExtraRemSpace);
|
||||
applesoftMenu.add (deleteExtraDataSpace);
|
||||
applesoftMenu.addSeparator ();
|
||||
applesoftMenu.add (showXrefItem);
|
||||
@ -285,7 +285,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||
applesoftMenu.add (showSymbolsItem);
|
||||
applesoftMenu.add (showFunctionsItem);
|
||||
applesoftMenu.add (showConstantsItem);
|
||||
// applesoftMenu.add (listStringsItem);
|
||||
// applesoftMenu.add (listStringsItem);
|
||||
applesoftMenu.add (showDuplicateSymbolsItem);
|
||||
|
||||
assemblerMenu.add (showAssemblerHeaderItem);
|
||||
@ -738,7 +738,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||
interleave3Item.setSelected (disk.getDisk ().getInterleave () == 3);
|
||||
}
|
||||
|
||||
boolean isDataDisk = (disk instanceof DataDisk);
|
||||
boolean isDataDisk = disk instanceof DataDisk;
|
||||
|
||||
sector256Item.setEnabled (isDataDisk);
|
||||
sector512Item.setEnabled (isDataDisk);
|
||||
|
@ -364,9 +364,9 @@ public class OutputPanel extends JTabbedPane
|
||||
removeImage ();
|
||||
else
|
||||
{
|
||||
if (dataSource instanceof HiResImage)
|
||||
if (dataSource instanceof HiResImage hri)
|
||||
{
|
||||
((HiResImage) dataSource).checkPalette ();
|
||||
hri.checkPalette ();
|
||||
image = dataSource.getImage ();
|
||||
if (((HiResImage) dataSource).isAnimation ())
|
||||
{
|
||||
|
@ -202,11 +202,6 @@ public final class Utility
|
||||
public static int signedShort (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// if (ptr >= buffer.length)
|
||||
// {
|
||||
// System.out.println ("Index out of range (signed short): " + ptr);
|
||||
// return 0;
|
||||
// }
|
||||
try
|
||||
{
|
||||
return (short) ((buffer[ptr] & 0xFF) | ((buffer[ptr + 1] & 0xFF) << 8));
|
||||
|
Loading…
Reference in New Issue
Block a user