mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-20 04:29:02 +00:00
added contains() to AppleFileSource
This commit is contained in:
parent
922956086c
commit
1b1726a5e0
@ -29,4 +29,6 @@ public interface AppleFileSource
|
|||||||
* Returns the actual FormattedDisk that owns this object.
|
* Returns the actual FormattedDisk that owns this object.
|
||||||
*/
|
*/
|
||||||
public FormattedDisk getFormattedDisk ();
|
public FormattedDisk getFormattedDisk ();
|
||||||
|
|
||||||
|
public boolean contains (DiskAddress diskAddress);
|
||||||
}
|
}
|
@ -81,6 +81,15 @@ public class DirectoryEntry implements AppleFileSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains (DiskAddress da)
|
||||||
|
{
|
||||||
|
for (DiskAddress sector : blocks)
|
||||||
|
if (sector.compareTo (da) == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public String line ()
|
public String line ()
|
||||||
{
|
{
|
||||||
int blocks = ((rc & 0xF0) >> 3) + (((rc & 0x0F) + 7) / 8);
|
int blocks = ((rc & 0xF0) >> 3) + (((rc & 0x0F) + 7) / 8);
|
||||||
|
@ -29,7 +29,6 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
|||||||
protected ActionListener actionListenerList;
|
protected ActionListener actionListenerList;
|
||||||
protected JTree catalogTree;
|
protected JTree catalogTree;
|
||||||
protected Path originalPath;
|
protected Path originalPath;
|
||||||
// protected String originalName;
|
|
||||||
|
|
||||||
protected List<SectorType> sectorTypesList = new ArrayList<SectorType> ();
|
protected List<SectorType> sectorTypesList = new ArrayList<SectorType> ();
|
||||||
protected List<AppleFileSource> fileEntries = new ArrayList<AppleFileSource> ();
|
protected List<AppleFileSource> fileEntries = new ArrayList<AppleFileSource> ();
|
||||||
@ -40,7 +39,6 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
|||||||
|
|
||||||
public final SectorType emptySector = new SectorType ("Unused (empty)", Color.white);
|
public final SectorType emptySector = new SectorType ("Unused (empty)", Color.white);
|
||||||
public final SectorType usedSector = new SectorType ("Unused (data)", Color.yellow);
|
public final SectorType usedSector = new SectorType ("Unused (data)", Color.yellow);
|
||||||
// public final SectorType dosSector = new SectorType ("DOS", Color.lightGray);
|
|
||||||
|
|
||||||
protected int falsePositives;
|
protected int falsePositives;
|
||||||
protected int falseNegatives;
|
protected int falseNegatives;
|
||||||
@ -304,6 +302,10 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
|||||||
@Override
|
@Override
|
||||||
public String getSectorFilename (DiskAddress da)
|
public String getSectorFilename (DiskAddress da)
|
||||||
{
|
{
|
||||||
|
for (AppleFileSource entry : fileEntries)
|
||||||
|
if (entry.contains (da))
|
||||||
|
return (entry).getUniqueName ();
|
||||||
|
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,16 +50,19 @@ public class DefaultAppleFileSource implements AppleFileSource
|
|||||||
((DefaultDataSource) file).buffer = owner.getDisk ().readSectors (blocks);
|
((DefaultDataSource) file).buffer = owner.getDisk ().readSectors (blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DataSource getDataSource ()
|
public DataSource getDataSource ()
|
||||||
{
|
{
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public FormattedDisk getFormattedDisk ()
|
public FormattedDisk getFormattedDisk ()
|
||||||
{
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<DiskAddress> getSectors ()
|
public List<DiskAddress> getSectors ()
|
||||||
{
|
{
|
||||||
return blocks;
|
return blocks;
|
||||||
@ -81,8 +84,18 @@ public class DefaultAppleFileSource implements AppleFileSource
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getUniqueName ()
|
public String getUniqueName ()
|
||||||
{
|
{
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains (DiskAddress diskAddress)
|
||||||
|
{
|
||||||
|
for (DiskAddress da : blocks)
|
||||||
|
if (da.compareTo (diskAddress) == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
@ -257,7 +257,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
return appleFile;
|
return appleFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean contains (DiskAddress da)
|
@Override
|
||||||
|
public boolean contains (DiskAddress da)
|
||||||
{
|
{
|
||||||
for (DiskAddress sector : tsSectors)
|
for (DiskAddress sector : tsSectors)
|
||||||
if (sector.compareTo (da) == 0)
|
if (sector.compareTo (da) == 0)
|
||||||
|
@ -337,14 +337,14 @@ public class DosDisk extends AbstractFormattedDisk
|
|||||||
return super.getFormattedSector (da);
|
return super.getFormattedSector (da);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public String getSectorFilename (DiskAddress da)
|
// public String getSectorFilename (DiskAddress da)
|
||||||
{
|
// {
|
||||||
for (AppleFileSource ce : fileEntries)
|
// for (AppleFileSource ce : fileEntries)
|
||||||
if (((CatalogEntry) ce).contains (da))
|
// if (((CatalogEntry) ce).contains (da))
|
||||||
return ((CatalogEntry) ce).name;
|
// return ((CatalogEntry) ce).name;
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DiskAddress> getFileSectors (int fileNo)
|
public List<DiskAddress> getFileSectors (int fileNo)
|
||||||
|
@ -37,7 +37,8 @@ abstract class CatalogEntry implements AppleFileSource
|
|||||||
blocks.add (disk.getDiskAddress (i));
|
blocks.add (disk.getDiskAddress (i));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean contains (DiskAddress da)
|
@Override
|
||||||
|
public boolean contains (DiskAddress da)
|
||||||
{
|
{
|
||||||
for (DiskAddress sector : blocks)
|
for (DiskAddress sector : blocks)
|
||||||
if (sector.compareTo (da) == 0)
|
if (sector.compareTo (da) == 0)
|
||||||
|
@ -48,6 +48,15 @@ class PascalCodeObject implements AppleFileSource
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains (DiskAddress da)
|
||||||
|
{
|
||||||
|
for (DiskAddress sector : blocks)
|
||||||
|
if (sector.compareTo (da) == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUniqueName ()
|
public String getUniqueName ()
|
||||||
{
|
{
|
||||||
|
@ -48,4 +48,13 @@ abstract class CatalogEntry implements AppleFileSource
|
|||||||
{
|
{
|
||||||
return parentDisk;
|
return parentDisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains (DiskAddress da)
|
||||||
|
{
|
||||||
|
for (DiskAddress sector : dataBlocks)
|
||||||
|
if (sector.compareTo (da) == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
@ -234,14 +234,14 @@ public class ProdosDisk extends AbstractFormattedDisk
|
|||||||
return super.getFormattedSector (da);
|
return super.getFormattedSector (da);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public String getSectorFilename (DiskAddress da)
|
// public String getSectorFilename (DiskAddress da)
|
||||||
{
|
// {
|
||||||
for (AppleFileSource fe : fileEntries)
|
// for (AppleFileSource fe : fileEntries)
|
||||||
if (((FileEntry) fe).contains (da))
|
// if (((FileEntry) fe).contains (da))
|
||||||
return ((FileEntry) fe).getUniqueName ();
|
// return ((FileEntry) fe).getUniqueName ();
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DiskAddress> getFileSectors (int fileNo)
|
public List<DiskAddress> getFileSectors (int fileNo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user