Removed debug statements from recent changes

This commit is contained in:
Brendan Robert 2015-12-20 14:18:50 -06:00
parent 4021af3ac6
commit 633b514b38
3 changed files with 17 additions and 37 deletions

View File

@ -157,7 +157,6 @@ public class DirectoryNode extends DiskNode implements FileFilter {
*/
@SuppressWarnings("static-access")
private void generateHeader(byte[] buffer) {
// System.out.println("Generating directory header");
// Previous block = 0
generateWord(buffer, 0, 0);
// Next block
@ -200,7 +199,6 @@ public class DirectoryNode extends DiskNode implements FileFilter {
* @param fileNumber number of file (indexed in Children array) to write
*/
private void generateFileEntry(byte[] buffer, int offset, int fileNumber) throws IOException {
// System.out.println("Generating entry for "+children.get(fileNumber).getName());
DiskNode child = children.get(fileNumber);
child.allocate();
// Entry Type and length
@ -242,11 +240,10 @@ public class DirectoryNode extends DiskNode implements FileFilter {
// yyyyyyym mmmddddd - Byte 0,1
// ---hhhhh --mmmmmm - Byte 2,3
buffer[offset+1] = (byte) (((c.get(Calendar.YEAR) - 2000) << 1) | ((c.get(Calendar.MONTH)+1)>> 3));
// buffer[offset+2] = (byte) ((c.get(Calendar.MONTH)>> 3) & 1);
buffer[offset+0] = (byte) (((((c.get(Calendar.MONTH)+1)&7)<<5) | c.get(Calendar.DAY_OF_MONTH)) & 0x0ff);
buffer[offset+3] = (byte) c.get(Calendar.HOUR_OF_DAY);
buffer[offset+2] = (byte) c.get(Calendar.MINUTE);
buffer[offset + 0] = (byte) (((((c.get(Calendar.MONTH) + 1) & 7) << 5) | c.get(Calendar.DAY_OF_MONTH)) & 0x0ff);
buffer[offset + 1] = (byte) (((c.get(Calendar.YEAR) - 2000) << 1) | ((c.get(Calendar.MONTH) + 1) >> 3));
buffer[offset + 2] = (byte) c.get(Calendar.MINUTE);
buffer[offset + 3] = (byte) c.get(Calendar.HOUR_OF_DAY);
}
private void generateWord(byte[] buffer, int i, int value) {

View File

@ -136,15 +136,11 @@ public class FileNode extends DiskNode {
@Override
public void doAllocate() throws IOException {
int dataBlocks = (int) ((getPhysicalFile().length()+ProdosVirtualDisk.BLOCK_SIZE-1) / ProdosVirtualDisk.BLOCK_SIZE);
int treeBlocks =(((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE-2)) / ProdosVirtualDisk.BLOCK_SIZE);
if (treeBlocks > 1) treeBlocks++;
// if (dataBlocks > 1 && (dataBlocks*2) < ProdosVirtualDisk.BLOCK_SIZE) {
// treeBlocks = 1;
// } else {
// treeBlocks = 1 + (dataBlocks * 2 / ProdosVirtualDisk.BLOCK_SIZE);
// }
System.out.println("Allocating "+(dataBlocks + treeBlocks)+" blocks for file "+getName()+"; data "+dataBlocks+"; tree "+treeBlocks);
int dataBlocks = (int) ((getPhysicalFile().length() + ProdosVirtualDisk.BLOCK_SIZE - 1) / ProdosVirtualDisk.BLOCK_SIZE);
int treeBlocks = (((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE - 2)) / ProdosVirtualDisk.BLOCK_SIZE);
if (treeBlocks > 1) {
treeBlocks++;
}
for (int i = 0; i < dataBlocks + treeBlocks; i++) {
new SubNode(i, this);
}
@ -157,10 +153,11 @@ public class FileNode extends DiskNode {
@Override
public void readBlock(int block, byte[] buffer) throws IOException {
// System.out.println("Read block "+block+" of file "+getName());
int dataBlocks = (int) ((getPhysicalFile().length()+ProdosVirtualDisk.BLOCK_SIZE-1) / ProdosVirtualDisk.BLOCK_SIZE);
int treeBlocks =(((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE-2)) / ProdosVirtualDisk.BLOCK_SIZE);
if (treeBlocks > 1) treeBlocks++;
int dataBlocks = (int) ((getPhysicalFile().length() + ProdosVirtualDisk.BLOCK_SIZE - 1) / ProdosVirtualDisk.BLOCK_SIZE);
int treeBlocks = (((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE - 2)) / ProdosVirtualDisk.BLOCK_SIZE);
if (treeBlocks > 1) {
treeBlocks++;
}
switch (this.getType()) {
case SEEDLING:
readFile(buffer, 0);
@ -175,10 +172,8 @@ public class FileNode extends DiskNode {
break;
case TREE:
if (block == 0) {
System.out.println("Reading index for "+getName());
generateIndex(buffer, 1, treeBlocks);
} else if (block <= treeBlocks) {
System.out.println("Reading tree block "+block+" for "+getName());
int start = treeBlocks + ((block - 1) * 256);
int end = treeBlocks + dataBlocks;
generateIndex(buffer, start, end);
@ -197,22 +192,11 @@ public class FileNode extends DiskNode {
}
private void generateIndex(byte[] buffer, int indexStart, int indexLimit) {
System.out.println("Index block contents:");
Arrays.fill(buffer, (byte) 0);
for (int i = indexStart, count=0; count < 256 && i < indexLimit && i < additionalNodes.size(); i++, count++) {
for (int i = indexStart, count = 0; count < 256 && i < indexLimit && i < additionalNodes.size(); i++, count++) {
int base = additionalNodes.get(i).baseBlock;
System.out.print(Integer.toHexString(base)+":");
buffer[count] = (byte) (base & 0x0ff);
buffer[count + 256] = (byte) (base >> 8);
}
System.out.println();
for (int i=0; i < 256; i++) {
System.out.printf("%02X ",buffer[i]&0x0ff);
}
System.out.println();
for (int i=256; i < 512; i++) {
System.out.printf("%02X ",buffer[i]&0x0ff);
}
System.out.println();
}
}

View File

@ -137,7 +137,6 @@ public class ProdosVirtualDisk implements IDisk {
for (DiskNode subnode : node.additionalNodes) {
int blockNum = getNextFreeBlock();
System.out.println("Allocating block " + Integer.toHexString(blockNum) + " for " + subnode.getName());
subnode.setBaseBlock(blockNum);
physicalMap.put(blockNum, subnode);
}