Skip to content

Commit

Permalink
misc bugfixes
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7201 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Sep 28, 2010
1 parent 44874f2 commit be6b483
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
6 changes: 4 additions & 2 deletions source/net/yacy/cora/protocol/http/HTTPClient.java
Expand Up @@ -168,8 +168,10 @@ private static HttpClient initConnectionManager() {
// uncompress gzip
((AbstractHttpClient) httpClient).addResponseInterceptor(new GzipResponseInterceptor());

idledConnectionEvictor = new IdledConnectionEvictor(clientConnectionManager);
idledConnectionEvictor.start();
if (idledConnectionEvictor == null) {
idledConnectionEvictor = new IdledConnectionEvictor(clientConnectionManager);
idledConnectionEvictor.start();
}
return httpClient;
}

Expand Down
6 changes: 3 additions & 3 deletions source/net/yacy/kelondro/data/image/ImageReferenceVars.java
Expand Up @@ -53,7 +53,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefere
posinphrase, posofphrase,
urlcomps, urllength, virtualAge,
wordsintext, wordsintitle;
ArrayList<Integer> positions;
private final ArrayList<Integer> positions;
public double termFrequency;

public ImageReferenceVars(
Expand Down Expand Up @@ -309,7 +309,7 @@ public final void min(final ImageReferenceVars other) {
if (this.virtualAge > (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext > (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext > (v = other.phrasesintext)) this.phrasesintext = v;
this.positions = a(Math.min(min(this.positions), min(other.positions)));
if (other.positions != null) a(this.positions, Math.min(min(this.positions), min(other.positions)));
if (this.posinphrase > (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase > (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified > (w = other.lastModified)) this.lastModified = w;
Expand All @@ -331,7 +331,7 @@ public final void max(final ImageReferenceVars other) {
if (this.virtualAge < (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext < (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext < (v = other.phrasesintext)) this.phrasesintext = v;
this.positions = a(Math.max(max(this.positions), max(other.positions)));
if (other.positions != null) a(this.positions, Math.max(max(this.positions), max(other.positions)));
if (this.posinphrase < (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase < (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified < (w = other.lastModified)) this.lastModified = w;
Expand Down
6 changes: 3 additions & 3 deletions source/net/yacy/kelondro/data/word/WordReferenceVars.java
Expand Up @@ -60,7 +60,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferenc
posinphrase, posofphrase,
urlcomps, urllength, virtualAge,
wordsintext, wordsintitle;
ArrayList<Integer> positions;
private final ArrayList<Integer> positions;
public double termFrequency;

public WordReferenceVars(
Expand Down Expand Up @@ -317,7 +317,7 @@ public final void min(final WordReferenceVars other) {
if (this.virtualAge > (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext > (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext > (v = other.phrasesintext)) this.phrasesintext = v;
this.positions = this.positions == null ? other.positions : other.positions == null ? this.positions : a(Math.min(min(this.positions), min(other.positions)));
if (other.positions != null) a(this.positions, Math.min(min(this.positions), min(other.positions)));
if (this.posinphrase > (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase > (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified > (w = other.lastModified)) this.lastModified = w;
Expand All @@ -339,7 +339,7 @@ public final void max(final WordReferenceVars other) {
if (this.virtualAge < (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext < (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext < (v = other.phrasesintext)) this.phrasesintext = v;
this.positions = this.positions == null ? other.positions : other.positions == null ? this.positions : a(Math.max(max(this.positions), max(other.positions)));
if (other.positions != null) a(this.positions, Math.max(max(this.positions), max(other.positions)));
if (this.posinphrase < (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase < (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified < (w = other.lastModified)) this.lastModified = w;
Expand Down
10 changes: 6 additions & 4 deletions source/net/yacy/kelondro/rwi/AbstractReference.java
Expand Up @@ -31,12 +31,13 @@

public abstract class AbstractReference implements Reference {

protected static ArrayList<Integer> a(int i) {
ArrayList<Integer> l = new ArrayList<Integer>(1);
l.add(i);
return l;
protected static void a(ArrayList<Integer> a, int i) {
assert a != null;
a.clear();
a.add(i);
}
protected static int max(ArrayList<Integer> a) {
assert a != null;
assert !a.isEmpty();
if (a.size() == 1) return a.get(0);
if (a.size() == 2) return Math.max(a.get(0), a.get(1));
Expand All @@ -45,6 +46,7 @@ protected static int max(ArrayList<Integer> a) {
return r;
}
protected static int min(ArrayList<Integer> a) {
assert a != null;
assert !a.isEmpty();
if (a.size() == 1) return a.get(0);
if (a.size() == 2) return Math.min(a.get(0), a.get(1));
Expand Down

0 comments on commit be6b483

Please sign in to comment.