- start first with threads that run more loops

- join first with threads that run less loops

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6067 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 6cde7ebf16
commit 3130334932

@ -52,14 +52,14 @@ public class DidYouMean {
this.ChangingOneLetter.start(); this.ChangingOneLetter.start();
this.AddingOneLetter.start(); this.AddingOneLetter.start();
this.DeletingOneLetter.start();
this.ReversingTwoConsecutiveLetters.start(); this.ReversingTwoConsecutiveLetters.start();
this.DeletingOneLetter.start();
try { try {
this.ChangingOneLetter.join(TIMEOUT);
this.AddingOneLetter.join(TIMEOUT);
this.DeletingOneLetter.join(TIMEOUT); this.DeletingOneLetter.join(TIMEOUT);
this.ReversingTwoConsecutiveLetters.join(TIMEOUT); this.ReversingTwoConsecutiveLetters.join(TIMEOUT);
this.ChangingOneLetter.join(TIMEOUT);
this.AddingOneLetter.join(TIMEOUT);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
@ -70,7 +70,8 @@ public class DidYouMean {
} }
private class ChangingOneLetter extends Thread { private class ChangingOneLetter extends Thread {
// tests: alphabet.length * len
public void run() { public void run() {
String s; String s;
int count = 0; int count = 0;
@ -87,6 +88,7 @@ public class DidYouMean {
} }
private class DeletingOneLetter extends Thread { private class DeletingOneLetter extends Thread {
// tests: len
public void run() { public void run() {
String s; String s;
int count = 0; int count = 0;
@ -101,6 +103,7 @@ public class DidYouMean {
} }
private class AddingOneLetter extends Thread { private class AddingOneLetter extends Thread {
// tests: alphabet.length * len
public void run() { public void run() {
String s; String s;
int count = 0; int count = 0;
@ -117,10 +120,11 @@ public class DidYouMean {
} }
private class ReversingTwoConsecutiveLetters extends Thread { private class ReversingTwoConsecutiveLetters extends Thread {
// tests: alphabet.length * (len - 1)
public void run() { public void run() {
String s; String s;
int count = 0; int count = 0;
for(int i=0; i<word.length()-1; i++) { for(int i=0; i<len-1; i++) {
s = word.substring(0,i)+word.charAt(i+1)+word.charAt(i)+word.substring(i+2); s = word.substring(0,i)+word.charAt(i+1)+word.charAt(i)+word.substring(i+2);
if (index.has(Word.word2hash(s))) { if (index.has(Word.word2hash(s))) {
set.add(s); set.add(s);

Loading…
Cancel
Save