Author: orbiter
Date: 2008-01-17 19:43:01 +0100 (Thu, 17 Jan 2008)
New Revision: 4338
Modified:
trunk/source/de/anomic/plasma/plasmaSearchEvent.java
trunk/source/de/anomic/yacy/yacyClient.java
trunk/source/de/anomic/yacy/yacyCore.java
trunk/source/de/anomic/yacy/yacySearch.java
Log:
some more generics
Modified: trunk/source/de/anomic/plasma/plasmaSearchEvent.java
===================================================================
--- trunk/source/de/anomic/plasma/plasmaSearchEvent.java 2008-01-17
12:12:52 UTC (rev 4337)
+++ trunk/source/de/anomic/plasma/plasmaSearchEvent.java 2008-01-17
18:43:01 UTC (rev 4338)
@@ -67,12 +67,12 @@
private plasmaSearchQuery query;
private plasmaWordIndex wordIndex;
private plasmaSearchRankingProcess rankedCache; // ordered search results,
grows dynamically as all the query threads enrich this container
- private Map rcAbstracts; // cache for index abstracts; word:TreeMap
mapping where the embedded TreeMap is a urlhash:peerlist relation
+ private Map<String, TreeMap<String, String>> rcAbstracts; // cache for
index abstracts; word:TreeMap mapping where the embedded TreeMap is a
urlhash:peerlist relation
private yacySearch[] primarySearchThreads, secondarySearchThreads;
private Thread localSearchThread;
private TreeMap preselectedPeerHashes;
//private Object[] references;
- public TreeMap IAResults;
+ public TreeMap<String, String> IAResults;
public TreeMap<String, Integer> IACount;
public String IAmaxcounthash, IAneardhthash;
private int localcount;
@@ -92,12 +92,12 @@
this.eventTime = System.currentTimeMillis(); // for lifetime check
this.wordIndex = wordIndex;
this.query = query;
- this.rcAbstracts = (query.queryHashes.size() > 1) ? new TreeMap() :
null; // generate abstracts only for combined searches
+ this.rcAbstracts = (query.queryHashes.size() > 1) ? new
TreeMap<String, TreeMap<String, String>>() : null; // generate abstracts only
for combined searches
this.primarySearchThreads = null;
this.secondarySearchThreads = null;
this.preselectedPeerHashes = preselectedPeerHashes;
- this.IAResults = new TreeMap();
- this.IACount = new TreeMap();
+ this.IAResults = new TreeMap<String, String>();
+ this.IACount = new TreeMap<String, Integer>();
this.IAmaxcounthash = null;
this.IAneardhthash = null;
this.localcount = 0;
Modified: trunk/source/de/anomic/yacy/yacyClient.java
===================================================================
--- trunk/source/de/anomic/yacy/yacyClient.java 2008-01-17 12:12:52 UTC (rev
4337)
+++ trunk/source/de/anomic/yacy/yacyClient.java 2008-01-17 18:43:01 UTC (rev
4338)
@@ -95,7 +95,7 @@
// but they appear to be another peer by comparisment of the other
peer's hash
// this works of course only if we know the other peer's hash.
- HashMap result = null;
+ HashMap<String, String> result = null;
final serverObjects post =
yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null);
for (int retry = 0; retry < 3; retry++) try {
// generate request
@@ -244,7 +244,7 @@
// send request
try {
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" +
target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
8000,
@@ -274,7 +274,7 @@
// send request
try {
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" +
target.getClusterAddress() + "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
8000,
@@ -306,7 +306,7 @@
// send request
try {
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress()
+ "/yacy/query.html", null),
target.getHexHash() + ".yacyh",
6000,
@@ -386,7 +386,7 @@
yacySeed target,
plasmaWordIndex wordIndex,
plasmaSearchRankingProcess containerCache,
- Map abstractCache,
+ Map<String, TreeMap<String, String>> abstractCache,
plasmaURLPattern blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint
@@ -426,7 +426,7 @@
final long timestamp = System.currentTimeMillis();
// send request
- HashMap result = null;
+ HashMap<String, String> result = null;
try {
result = nxTools.table(
httpc.wput(new yacyURL("http://" + target.getClusterAddress()
+ "/yacy/search.html", null),
@@ -585,7 +585,7 @@
if (((String)
entry.getKey()).startsWith("indexabstract.")) {
wordhash = ((String)
entry.getKey()).substring(14);
synchronized (abstractCache) {
- singleAbstract = (TreeMap)
abstractCache.get(wordhash); // a mapping from url-hashes to a string of
peer-hashes
+ singleAbstract =
(TreeMap<String, String>) abstractCache.get(wordhash); // a mapping from
url-hashes to a string of peer-hashes
if (singleAbstract == null)
singleAbstract = new TreeMap();
ci = new
serverByteBuffer(((String) entry.getValue()).getBytes());
//System.out.println("DEBUG-ABSTRACTFETCH: for word hash " + wordhash + "
received " + ci.toString());
@@ -632,7 +632,7 @@
// send request
try {
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + targetAddress(targetHash) +
"/yacy/message.html", null),
yacySeed.b64Hash2hexHash(targetHash)+ ".yacyh",
8000,
@@ -667,7 +667,7 @@
// send request
try {
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(new yacyURL("http://" + targetAddress(targetHash) +
"/yacy/message.html", null),
yacySeed.b64Hash2hexHash(targetHash)+ ".yacyh",
20000,
@@ -712,7 +712,7 @@
// send request
try {
final yacyURL url = new yacyURL("http://" + targetAddress +
"/yacy/transfer.html", null);
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(url,
url.getHost(),
6000,
@@ -747,7 +747,7 @@
// send request
try {
final yacyURL url = new yacyURL("http://" + targetAddress +
"/yacy/transfer.html", null);
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wput(url,
url.getHost(),
20000,
@@ -790,7 +790,7 @@
return "wrong protocol: " + protocol;
}
- public static HashMap crawlReceipt(yacySeed target, String process, String
result, String reason, indexURLEntry entry, String wordhashes) {
+ public static HashMap<String, String> crawlReceipt(yacySeed target, String
process, String result, String reason, indexURLEntry entry, String wordhashes) {
assert (target != null);
assert (yacyCore.seedDB.mySeed() != null);
assert (yacyCore.seedDB.mySeed() != target);
@@ -868,14 +868,14 @@
}
// transfer the RWI without the URLs
- HashMap in = transferRWI(targetSeed, indexes, gzipBody, timeout);
+ HashMap<String, String> in = transferRWI(targetSeed, indexes,
gzipBody, timeout);
resultObj.put("resultTransferRWI", in);
if (in == null) {
resultObj.put("result", "no_connection_1");
return resultObj;
}
- if (in.containsKey("indexPayloadSize")) payloadSize +=
((Integer)in.get("indexPayloadSize")).intValue();
+ if (in.containsKey("indexPayloadSize")) payloadSize +=
Integer.parseInt(in.get("indexPayloadSize"));
String result = (String) in.get("result");
if (result == null) {
@@ -916,7 +916,7 @@
resultObj.put("result","no_connection_2");
return resultObj;
}
- if (in.containsKey("urlPayloadSize")) payloadSize +=
((Integer)in.get("urlPayloadSize")).intValue();
+ if (in.containsKey("urlPayloadSize")) payloadSize +=
Integer.parseInt(in.get("urlPayloadSize"));
result = (String) in.get("result");
if (result == null) {
@@ -975,9 +975,9 @@
}
post.put("entryc", indexcount);
- post.put("indexes", entrypost.toString());
+ post.put("indexes", entrypost.toString());
try {
- final ArrayList v = nxTools.strings(
+ final ArrayList<String> v = nxTools.strings(
httpc.wput(
new yacyURL("http://" + address +
"/yacy/transferRWI.html", null),
targetSeed.getHexHash() + ".yacyh",
@@ -993,9 +993,9 @@
yacyCore.seedDB.mySeed().incSI(indexcount);
}
- final HashMap result = nxTools.table(v);
+ final HashMap<String, String> result = nxTools.table(v);
// return the transfered index data in bytes (for debugging only)
- result.put("indexPayloadSize", new Integer(entrypost.length()));
+ result.put("indexPayloadSize",
Integer.toString(entrypost.length()));
return result;
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.transferRWI error:" +
e.getMessage());
@@ -1003,7 +1003,7 @@
}
}
- private static HashMap transferURL(yacySeed targetSeed, indexURLEntry[]
urls, boolean gzipBody, int timeout) {
+ private static HashMap<String, String> transferURL(yacySeed targetSeed,
indexURLEntry[] urls, boolean gzipBody, int timeout) {
// this post a message to the remote message board
final String address = targetSeed.getPublicAddress();
if (address == null) { return null; }
@@ -1031,7 +1031,7 @@
}
post.put("urlc", urlc);
try {
- final ArrayList v = nxTools.strings(
+ final ArrayList<String> v = nxTools.strings(
httpc.wput(
new yacyURL("http://" + address +
"/yacy/transferURL.html", null),
targetSeed.getHexHash() + ".yacyh",
@@ -1047,9 +1047,9 @@
yacyCore.seedDB.mySeed().incSU(urlc);
}
- HashMap result = nxTools.table(v);
+ HashMap<String, String> result = nxTools.table(v);
// return the transfered url data in bytes (for debugging only)
- result.put("urlPayloadSize", new Integer(urlPayloadSize));
+ result.put("urlPayloadSize", Integer.toString(urlPayloadSize));
return result;
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.transferURL error:" +
e.getMessage());
@@ -1057,7 +1057,7 @@
}
}
- public static HashMap getProfile(yacySeed targetSeed) {
+ public static HashMap<String, String> getProfile(yacySeed targetSeed) {
// this post a message to the remote message board
final serverObjects post =
yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(),
targetSeed.hash);
@@ -1102,7 +1102,7 @@
(sb.remoteProxyConfig.useProxy()) &&
(sb.remoteProxyConfig.useProxy4Yacy());
- final HashMap result = nxTools.table(
+ final HashMap<String, String> result = nxTools.table(
httpc.wget(
new yacyURL("http://" + target.getPublicAddress()
+ "/yacy/search.html" +
"?myseed=" +
yacyCore.seedDB.mySeed().genSeedStr(null) +
Modified: trunk/source/de/anomic/yacy/yacyCore.java
===================================================================
--- trunk/source/de/anomic/yacy/yacyCore.java 2008-01-17 12:12:52 UTC (rev
4337)
+++ trunk/source/de/anomic/yacy/yacyCore.java 2008-01-17 18:43:01 UTC (rev
4338)
@@ -91,7 +91,7 @@
/** pseudo-random key derived from a time-interval while YaCy startup*/
public static long speedKey = 0;
public static File yacyDBPath;
- public static final Map amIAccessibleDB = Collections.synchronizedMap(new
HashMap()); // Holds PeerHash / yacyAccessible Relations
+ public static final Map<String, yacyAccessible> amIAccessibleDB =
Collections.synchronizedMap(new HashMap<String, yacyAccessible>()); // Holds
PeerHash / yacyAccessible Relations
// constants for PeerPing behaviour
private static final int PING_INITIAL = 10;
private static final int PING_MAX_RUNNING = 3;
Modified: trunk/source/de/anomic/yacy/yacySearch.java
===================================================================
--- trunk/source/de/anomic/yacy/yacySearch.java 2008-01-17 12:12:52 UTC (rev
4337)
+++ trunk/source/de/anomic/yacy/yacySearch.java 2008-01-17 18:43:01 UTC (rev
4338)
@@ -66,7 +66,7 @@
final private int partitions;
final private plasmaWordIndex wordIndex;
final private plasmaSearchRankingProcess containerCache;
- final private Map abstractCache;
+ final private Map<String, TreeMap<String, String>> abstractCache;
final private plasmaURLPattern blacklist;
final private yacySeed targetPeer;
private String[] urls;
@@ -77,7 +77,8 @@
public yacySearch(String wordhashes, String excludehashes, String
urlhashes, String prefer, String filter, int count, int maxDistance,
boolean global, int partitions, yacySeed targetPeer,
plasmaWordIndex wordIndex,
- plasmaSearchRankingProcess containerCache, Map
abstractCache,
+ plasmaSearchRankingProcess containerCache,
+ Map<String, TreeMap<String, String>> abstractCache,
plasmaURLPattern blacklist,
plasmaSearchRankingProfile rankingProfile,
kelondroBitfield constraint) {
@@ -247,10 +248,13 @@
String wordhashes, String excludehashes, String urlhashes,
String prefer, String filter, int count, int maxDist,
plasmaWordIndex wordIndex,
- plasmaSearchRankingProcess containerCache, Map abstractCache,
- int targets, plasmaURLPattern blacklist,
+ plasmaSearchRankingProcess containerCache,
+ Map<String, TreeMap<String, String>> abstractCache,
+ int targets,
+ plasmaURLPattern blacklist,
plasmaSearchRankingProfile rankingProfile,
- kelondroBitfield constraint, TreeMap clusterselection) {
+ kelondroBitfield constraint,
+ TreeMap clusterselection) {
// check own peer status
if (yacyCore.seedDB.mySeed() == null ||
yacyCore.seedDB.mySeed().getPublicAddress() == null) { return null; }
@@ -283,7 +287,7 @@
if (targetPeer == null) return null;
if (clusterselection != null)
targetPeer.setAlternativeAddress((String)
clusterselection.get(targetPeer.hash));
yacySearch searchThread = new yacySearch(wordhashes, excludehashes,
urlhashes, "", "", 0, 9999, true, 0, targetPeer,
- wordIndex, containerCache, new
TreeMap(), blacklist, rankingProfile, constraint);
+ wordIndex, containerCache, new
TreeMap<String, TreeMap<String, String>>(), blacklist, rankingProfile,
constraint);
searchThread.start();
return searchThread;
}
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn