pass Disk first

This commit is contained in:
Denis Molony 2016-07-18 08:35:18 +10:00
parent 06b4a4cfea
commit f33f3f52c0
3 changed files with 9 additions and 9 deletions

View File

@ -72,7 +72,7 @@ public class DirectoryEntry implements AppleFileSource
blockNumber = (b & 0x7F) * 4;
for (int i = 0; i < 4; i++)
blocks.add (new AppleDiskAddress (blockNumber + i, disk));
blocks.add (new AppleDiskAddress (disk, blockNumber + i));
}
}
@ -99,7 +99,7 @@ public class DirectoryEntry implements AppleFileSource
int blockNumber = b * 4 + 48;
for (int i = 0; i < 4; i++)
blocks.add (new AppleDiskAddress (blockNumber + i, disk));
blocks.add (new AppleDiskAddress (disk, blockNumber + i));
}
}

View File

@ -372,9 +372,9 @@ public class AppleDisk implements Disk
{
System.out.println ("Invalid block : " + block);
// return null;
return new AppleDiskAddress (0, this);
return new AppleDiskAddress (this, 0);
}
return new AppleDiskAddress (block, this);
return new AppleDiskAddress (this, block);
}
@Override
@ -385,7 +385,7 @@ public class AppleDisk implements Disk
for (int block : blocks)
{
assert (isValidAddress (block)) : "Invalid block : " + block;
addressList.add (new AppleDiskAddress (block, this));
addressList.add (new AppleDiskAddress (this, block));
}
return addressList;
}
@ -396,7 +396,7 @@ public class AppleDisk implements Disk
// should this return null for invalid addresses?
assert (isValidAddress (track, sector)) : "Invalid address : " + track + ", "
+ sector;
return new AppleDiskAddress (track, sector, this);
return new AppleDiskAddress (this, track, sector);
}
@Override
@ -505,7 +505,7 @@ public class AppleDisk implements Disk
{
blockList = new ArrayList<DiskAddress> (blocks);
for (int block = 0; block < blocks; block++)
blockList.add (new AppleDiskAddress (block, this));
blockList.add (new AppleDiskAddress (this, block));
}
return blockList.iterator ();

View File

@ -7,7 +7,7 @@ public class AppleDiskAddress implements DiskAddress
private final int sector;
public final Disk owner;
public AppleDiskAddress (int block, Disk owner)
public AppleDiskAddress (Disk owner, int block)
{
this.owner = owner;
this.block = block;
@ -16,7 +16,7 @@ public class AppleDiskAddress implements DiskAddress
this.sector = block % sectorsPerTrack;
}
public AppleDiskAddress (int track, int sector, Disk owner)
public AppleDiskAddress (Disk owner, int track, int sector)
{
this.owner = owner;
this.track = track;