mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-13 21:29:31 +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);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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