| 1 |
package assemble; |
| 2 |
|
| 3 |
import shared.KillSwitch; |
| 4 |
import structures.ByteBuilder; |
| 5 |
import ukmer.Kmer; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
abstract class AbstractExploreThread extends ShaveObject implements Runnable { |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
public AbstractExploreThread(int id_, int kbig_){ |
| 19 |
id=id_; |
| 20 |
myKmer=new Kmer(kbig_); |
| 21 |
myKmer2=new Kmer(kbig_); |
| 22 |
thread=new Thread(this); |
| 23 |
} |
| 24 |
|
| 25 |
@Override |
| 26 |
public final void run(){ |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
while(processNextTable(myKmer, myKmer2)){} |
| 39 |
while(processNextVictims(myKmer, myKmer2)){} |
| 40 |
|
| 41 |
for(int i=0; i<removeMatrixT.length; i++){ |
| 42 |
for(int j=0; j<removeMatrixT.length; j++){ |
| 43 |
if((i==F_BRANCH || i==B_BRANCH) && (j==F_BRANCH || j==B_BRANCH)){ |
| 44 |
bubblesFoundT+=removeMatrixT[i][j]; |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
boolean processNextTable(){return processNextTable(myKmer, myKmer2);} |
| 51 |
abstract boolean processNextTable(final Kmer kmer, Kmer temp); |
| 52 |
|
| 53 |
boolean processNextVictims(){return processNextVictims(myKmer, myKmer);} |
| 54 |
abstract boolean processNextVictims(final Kmer kmer, Kmer temp); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public final void start(){thread.start();} |
| 59 |
public final Thread.State getState(){return thread.getState();} |
| 60 |
public final void join() throws InterruptedException{thread.join();} |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
long kmersTestedT=0; |
| 65 |
long deadEndsFoundT=0; |
| 66 |
long bubblesFoundT=0; |
| 67 |
|
| 68 |
final int id; |
| 69 |
final Kmer myKmer, myKmer2; |
| 70 |
|
| 71 |
final int[] leftCounts=KillSwitch.allocInt1D(4); |
| 72 |
final int[] rightCounts=KillSwitch.allocInt1D(4); |
| 73 |
final ByteBuilder builderT=new ByteBuilder(); |
| 74 |
|
| 75 |
long[][] countMatrixT=new long[MAX_CODE+1][MAX_CODE+1]; |
| 76 |
long[][] removeMatrixT=new long[MAX_CODE+1][MAX_CODE+1]; |
| 77 |
|
| 78 |
public final Thread thread; |
| 79 |
|
| 80 |
} |