renamed Chunk to Batch

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@909 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-09-11 15:59:15 +00:00
parent 0799000704
commit c095be6b54
4 changed files with 15 additions and 15 deletions

View File

@ -9,7 +9,7 @@ import net.jini.core.entry.Entry;
import java.util.List;
public class Chunk implements Entry {
public class Batch implements Entry {
// routing information
public static final Integer DONE = new Integer( 1 );
@ -21,9 +21,9 @@ public class Chunk implements Entry {
public Integer jobID;
public Integer sequenceID;
public Chunk() {}
public Batch() {}
public Chunk(Integer jobID, List tileWrappers, Integer isDone, Integer sequenceID) {
public Batch(Integer jobID, List tileWrappers, Integer isDone, Integer sequenceID) {
this.jobID = jobID;
this.tileWrappers = tileWrappers;
this.isDone = isDone;

View File

@ -28,15 +28,15 @@ public class TileExpander {
}
public void expandAvailableTiles() throws RemoteException, UnusableEntryException, TransactionException, InterruptedException{
Entry twQuery = space.snapshot(new Chunk(tsw.jobID, null, Chunk.NOT_DONE, null));
Entry twQuery = space.snapshot(new Batch(tsw.jobID, null, Batch.NOT_DONE, null));
Chunk chunk = null;
Batch batch = null;
int total = 0;
while ((chunk = (Chunk)space.take(twQuery, null, 10)) != null) {
while ((batch = (Batch)space.take(twQuery, null, 10)) != null) {
total++;
List wrappers = new ArrayList();
for (int j=0; j<chunk.tileWrappers.size(); j++) {
TileWrapper tileWrapperToExpand = (TileWrapper)chunk.tileWrappers.get(j);
for (int j=0; j<batch.tileWrappers.size(); j++) {
TileWrapper tileWrapperToExpand = (TileWrapper)batch.tileWrappers.get(j);
//System.out.println("Expanding " + tileWrapperToExpand.tile.getImage());
Occurrences results = expand(tileWrapperToExpand, j);
int expansionIndex = 0;
@ -48,8 +48,8 @@ public class TileExpander {
expansionIndex++;
}
}
Chunk chunkToWrite = new Chunk(tsw.jobID, wrappers, Chunk.DONE, chunk.sequenceID);
space.write(chunkToWrite, null, Lease.FOREVER);
Batch batchToWrite = new Batch(tsw.jobID, wrappers, Batch.DONE, batch.sequenceID);
space.write(batchToWrite, null, Lease.FOREVER);
}
if (total>0) System.out.println("Expanded " + total + " tiles");
}

View File

@ -29,9 +29,9 @@ public class TileHarvester {
public Occurrences harvest(int originalOccurrencesCount) throws RemoteException, UnusableEntryException, TransactionException, InterruptedException {
Occurrences occ = new Occurrences(new CPDNullListener());
for (int i=0;i<originalOccurrencesCount; i++) {
Chunk chunk = (Chunk)space.take(new Chunk(job.id, null, Chunk.DONE, new Integer(i)), null, Lease.FOREVER);
for (int j=0; j<chunk.tileWrappers.size(); j++) {
addTileWrapperToOccurrences((TileWrapper)chunk.tileWrappers.get(j), occ);
Batch batch = (Batch)space.take(new Batch(job.id, null, Batch.DONE, new Integer(i)), null, Lease.FOREVER);
for (int j=0; j<batch.tileWrappers.size(); j++) {
addTileWrapperToOccurrences((TileWrapper)batch.tileWrappers.get(j), occ);
}
}
return occ;

View File

@ -33,8 +33,8 @@ public class TilePlanter {
TileWrapper tw = new TileWrapper(tile, occ.getOccurrencesList(tile), null, null);
List wrappers = new ArrayList();
wrappers.add(tw);
Chunk chunk = new Chunk(job.id, wrappers, Chunk.NOT_DONE, new Integer(tilesSoFar));
space.write(chunk, null, Lease.FOREVER);
Batch batch = new Batch(job.id, wrappers, Batch.NOT_DONE, new Integer(tilesSoFar));
space.write(batch, null, Lease.FOREVER);
//System.out.println("Scattering " + tw.tile.getImage() + "->" + tw.occurrences.size());
tilesSoFar++;
if (tilesSoFar % 100 == 0) {