fixes to web structure reference collection and url construction

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

@ -259,34 +259,42 @@ public class plasmaWebStructure {
}
public structureEntry incomingReferences(final String domhash) {
String host = resolveDomHash2DomString(domhash);
if (host == null) return null;
// collect the references
final Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
plasmaWebStructure.structureEntry sentry;
HashMap<String, Integer> domhashes = new HashMap<String, Integer>();
Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
while (i.hasNext()) {
sentry = i.next();
if (sentry.references.containsKey(domhash)) {
domhashes.put(sentry.domhash, sentry.references.get(domhash));
}
if (sentry.references.containsKey(domhash)) domhashes.put(sentry.domhash, sentry.references.get(domhash));
}
i = structureEntryIterator(true);
while (i.hasNext()) {
sentry = i.next();
if (sentry.references.containsKey(domhash)) domhashes.put(sentry.domhash, sentry.references.get(domhash));
}
// construct a new structureEntry Object
return new structureEntry(
domhash,
resolveDomHash2DomString(domhash),
host,
DateFormatter.formatShortDay(new Date()),
domhashes);
}
public HashMap<String, Integer> incomingDomains(final String domhash) {
// collect the references
final Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
plasmaWebStructure.structureEntry sentry;
HashMap<String, Integer> domains = new HashMap<String, Integer>();
Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
while (i.hasNext()) {
sentry = i.next();
if (sentry.references.containsKey(domhash)) {
domains.put(sentry.domain, sentry.references.get(domhash));
}
if (sentry.references.containsKey(domhash)) domains.put(sentry.domain, sentry.references.get(domhash));
}
i = structureEntryIterator(true);
while (i.hasNext()) {
sentry = i.next();
if (sentry.references.containsKey(domhash)) domains.put(sentry.domain, sentry.references.get(domhash));
}
return domains;
}

@ -227,12 +227,12 @@ public class Transmission {
}
public boolean isFinished() {
System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
//System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
return this.hit >= seeds.redundancy();
}
public boolean canFinish() {
System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
//System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
return this.targets.size() >= seeds.redundancy() - this.hit;
}

@ -79,12 +79,8 @@ public class yacyURL implements Serializable {
url = url.trim();
int p = url.indexOf(':');
if (p < 0) {
if (url.startsWith("www.")) {
url = "http://" + url;
p = 4;
} else {
throw new MalformedURLException("protocol is not given in '" + url + "'");
}
url = "http://" + url;
p = 4;
}
this.protocol = url.substring(0, p).toLowerCase().trim();
if (url.length() < p + 4) throw new MalformedURLException("URL not parseable: '" + url + "'");

Loading…
Cancel
Save