renaming
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@863 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -41,7 +41,7 @@ public class DCPD {
|
||||
space.write(tokenSetWrapper, null, Lease.FOREVER);
|
||||
|
||||
System.out.println("Crunching");
|
||||
DGST dgst = new DGST(space, job, tokenSetWrapper.tokenSets, 2);
|
||||
DGST dgst = new DGST(space, job, tokenSetWrapper.tokenSets, 30);
|
||||
Results results = dgst.crunch(new CPDListenerImpl());
|
||||
|
||||
System.out.println("Cleaning up");
|
||||
|
@ -49,11 +49,9 @@ public class DCPDWorker {
|
||||
System.out.println("Read a TokenSetsWrapper with " + tsw.tokenSets.size() + " token lists");
|
||||
|
||||
while (true) {
|
||||
System.out.println("Starting expansion");
|
||||
TileExpander te = new TileExpander(space, tsw);
|
||||
te.expandAvailableTiles();
|
||||
System.out.println("Done, sleeping");
|
||||
Thread.currentThread().sleep(1000);
|
||||
Thread.currentThread().yield();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -32,7 +32,7 @@ public class DGST {
|
||||
public Results crunch(CPDListener listener) {
|
||||
Occurrences occ = new Occurrences(tokenSets, listener);
|
||||
try {
|
||||
TileScatterer scatterer = new TileScatterer(space, job);
|
||||
TilePlanter scatterer = new TilePlanter(space, job);
|
||||
scatterer.scatter(occ);
|
||||
space.write(job, null, Lease.FOREVER);
|
||||
expand(occ);
|
||||
@ -45,11 +45,11 @@ public class DGST {
|
||||
|
||||
private void expand(Occurrences occ) throws RemoteException, UnusableEntryException, TransactionException, InterruptedException {
|
||||
while (!occ.isEmpty()) {
|
||||
TileGatherer tg = new TileGatherer(space, job);
|
||||
TileHarvester tg = new TileHarvester(space, job);
|
||||
occ = tg.gather(occ.size());
|
||||
addToResults(occ);
|
||||
System.out.println("************* Scatter..gather complete; tile count now " + occ.size());
|
||||
TileScatterer scatterer = new TileScatterer(space, job);
|
||||
TilePlanter scatterer = new TilePlanter(space, job);
|
||||
scatterer.scatter(occ);
|
||||
}
|
||||
}
|
||||
@ -58,6 +58,7 @@ public class DGST {
|
||||
for (Iterator i = occ.getTiles(); i.hasNext();) {
|
||||
Tile tile = (Tile)i.next();
|
||||
if (tile.getTokenCount() > this.minimumTileSize) {
|
||||
//System.out.println("Adding " + tile.getImage());
|
||||
for (Iterator j = occ.getOccurrences(tile); j.hasNext();) {
|
||||
TokenEntry te = (TokenEntry)j.next();
|
||||
results.addTile(tile, te);
|
||||
|
@ -31,7 +31,9 @@ public class TileExpander {
|
||||
Entry twQuery = space.snapshot(new TileWrapper(null, null, tsw.jobID, TileWrapper.NOT_DONE, null, null, null));
|
||||
|
||||
TileWrapper tileWrapperToExpand = null;
|
||||
int total = 0;
|
||||
while ((tileWrapperToExpand = (TileWrapper)space.take(twQuery, null, 10)) != null) {
|
||||
total++;
|
||||
//System.out.println("Expanding " + tileWrapperToExpand.tile.getImage());
|
||||
Occurrences results = expand(tileWrapperToExpand);
|
||||
int expansionIndex = 0;
|
||||
@ -45,10 +47,11 @@ public class TileExpander {
|
||||
new Integer(expansionIndex),
|
||||
new Integer(results.size()));
|
||||
space.write(tileWrapperToWrite, null, Lease.FOREVER);
|
||||
System.out.println("Wrote " + tileWrapperToWrite + "; occurrences = " + tileWrapperToWrite.occurrences.size());
|
||||
//System.out.println("Wrote " + tileWrapperToWrite + "; occurrences = " + tileWrapperToWrite.occurrences.size());
|
||||
expansionIndex++;
|
||||
}
|
||||
}
|
||||
if (total>0) System.out.println("Expanded " + total + " tiles");
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,12 +16,12 @@ import net.jini.space.JavaSpace;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
public class TileGatherer {
|
||||
public class TileHarvester {
|
||||
|
||||
private JavaSpace space;
|
||||
private Job job;
|
||||
|
||||
public TileGatherer(JavaSpace space, Job job) {
|
||||
public TileHarvester(JavaSpace space, Job job) {
|
||||
this.space = space;
|
||||
this.job = job;
|
||||
}
|
||||
@ -39,17 +39,17 @@ public class TileGatherer {
|
||||
return occ;
|
||||
}
|
||||
|
||||
private void addAllExpansions(int originalPosition, TileWrapper firstTileWrapper, Occurrences occ) throws RemoteException, UnusableEntryException, TransactionException, InterruptedException {
|
||||
TileWrapper nextExpansion = firstTileWrapper;
|
||||
for (int i=0; i<firstTileWrapper.expansionsTotal.intValue(); i++) {
|
||||
private void addAllExpansions(int originalPosition, TileWrapper firstExpansion, Occurrences occ) throws RemoteException, UnusableEntryException, TransactionException, InterruptedException {
|
||||
TileWrapper nextExpansion = firstExpansion;
|
||||
for (int i=0; i<firstExpansion.expansionsTotal.intValue(); i++) {
|
||||
if (i>0) {
|
||||
nextExpansion = (TileWrapper)space.take(new TileWrapper(null,
|
||||
null,
|
||||
firstTileWrapper.jobID,
|
||||
firstExpansion.jobID,
|
||||
TileWrapper.DONE,
|
||||
new Integer(originalPosition),
|
||||
new Integer(i),
|
||||
firstTileWrapper.expansionsTotal), null, Lease.FOREVER);
|
||||
firstExpansion.expansionsTotal), null, Lease.FOREVER);
|
||||
}
|
||||
//System.out.println("Gathered " + nextExpansion + "; occurrences = " + nextExpansion.occurrences.size());
|
||||
// here's where we discard solo tiles
|
||||
@ -60,8 +60,8 @@ public class TileGatherer {
|
||||
}
|
||||
|
||||
private void addTileWrapperToOccurrences(TileWrapper tw, Occurrences occ) {
|
||||
for (int i=0; i<tw.occurrences.size(); i++) {
|
||||
if (!occ.containsAnyTokensIn(tw.tile)) {
|
||||
if (!occ.containsAnyTokensIn(tw.tile)) {
|
||||
for (int i=0; i<tw.occurrences.size(); i++) {
|
||||
occ.addTile(tw.tile, (TokenEntry)tw.occurrences.get(i));
|
||||
}
|
||||
}
|
@ -16,12 +16,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileScatterer {
|
||||
public class TilePlanter {
|
||||
|
||||
private Job job;
|
||||
private JavaSpace space;
|
||||
|
||||
public TileScatterer(JavaSpace space, Job job) {
|
||||
public TilePlanter(JavaSpace space, Job job) {
|
||||
this.job = job;
|
||||
this.space = space;
|
||||
}
|
||||
@ -37,7 +37,7 @@ public class TileScatterer {
|
||||
new Integer(tilesSoFar),
|
||||
null, null);
|
||||
space.write(tw, null, Lease.FOREVER);
|
||||
System.out.println("Scattering " + tw.tile.getImage() + "->" + tw.occurrences.size());
|
||||
//System.out.println("Scattering " + tw.tile.getImage() + "->" + tw.occurrences.size());
|
||||
if (tilesSoFar++ % 25 == 0) {
|
||||
System.out.println("Written " + tilesSoFar + " tiles so far");
|
||||
}
|
Reference in New Issue
Block a user