Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

more generics

orbiter9d693ee635f6
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.java
index a07e21c00..259089238 100644
--- a/htroot/AccessTracker_p.java
+++ b/htroot/AccessTracker_p.java
@@ -47,14 +47,15 @@ import de.anomic.yacy.yacySeed;
public class AccessTracker_p {
- private static final TreeMap treemapclone(TreeMap m) {
- TreeMap accessClone = new TreeMap();
+ private static final TreeMap<Long, String> treemapclone(TreeMap<Long, String> m) {
+ TreeMap<Long, String> accessClone = new TreeMap<Long, String>();
try {
accessClone.putAll(m);
} catch (ConcurrentModificationException e) {}
return accessClone;
}
+ @SuppressWarnings("unchecked")
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch sb) {
plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
@@ -68,9 +69,9 @@ public class AccessTracker_p {
int maxCount = 1000;
boolean dark = true;
if (page == 0) {
- Iterator i = switchboard.accessHosts();
+ Iterator<String> i = switchboard.accessHosts();
String host;
- TreeMap access;
+ TreeMap<Long, String> access;
int entCount = 0;
try {
while ((entCount < maxCount) && (i.hasNext())) {
@@ -90,15 +91,15 @@ public class AccessTracker_p {
if (page == 1) {
String host = post.get("host", "");
int entCount = 0;
- TreeMap access;
- Map.Entry entry;
+ TreeMap<Long, String> access;
+ Map.Entry<Long, String> entry;
if (host.length() > 0) {
access = switchboard.accessTrack(host);
if (access != null) {
try {
- Iterator ii = treemapclone(access).entrySet().iterator();
+ Iterator<Map.Entry<Long, String>> ii = treemapclone(access).entrySet().iterator();
while (ii.hasNext()) {
- entry = (Map.Entry) ii.next();
+ entry = ii.next();
prop.putHTML("page_list_" + entCount + "_host", host);
prop.put("page_list_" + entCount + "_date", serverDate.formatShortSecond(new Date(((Long) entry.getKey()).longValue())));
prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());
@@ -108,13 +109,13 @@ public class AccessTracker_p {
}
} else {
try {
- Iterator i = switchboard.accessHosts();
+ Iterator<String> i = switchboard.accessHosts();
while ((entCount < maxCount) && (i.hasNext())) {
host = (String) i.next();
access = switchboard.accessTrack(host);
- Iterator ii = treemapclone(access).entrySet().iterator();
+ Iterator<Map.Entry<Long, String>> ii = treemapclone(access).entrySet().iterator();
while (ii.hasNext()) {
- entry = (Map.Entry) ii.next();
+ entry = ii.next();
prop.putHTML("page_list_" + entCount + "_host", host);
prop.put("page_list_" + entCount + "_date", serverDate.formatShortSecond(new Date(((Long) entry.getKey()).longValue())));
prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());
@@ -189,12 +190,12 @@ public class AccessTracker_p {
TreeSet<Long> handles;
int entCount = 0;
int qphSum = 0;
- Map.Entry entry;
+ Map.Entry<String, TreeSet<Long>> entry;
try {
while ((entCount < maxCount) && (i.hasNext())) {
entry = i.next();
- host = (String) entry.getKey();
- handles = (TreeSet<Long>) entry.getValue();
+ host = entry.getKey();
+ handles = entry.getValue();
int dateCount = 0;
Iterator<Long> ii = handles.iterator();
diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.java
index 8939789ac..76c38d7eb 100644
--- a/htroot/BlacklistCleaner_p.java
+++ b/htroot/BlacklistCleaner_p.java
@@ -57,7 +57,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map.Entry;
+import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -85,7 +85,7 @@ public class BlacklistCleaner_p {
private static final int ERR_HOST_WRONG_CHARS = 4;
private static final int ERR_DOUBLE_OCCURANCE = 5;
- public static final Class[] supportedBLEngines = {
+ public static final Class<?>[] supportedBLEngines = {
defaultURLPattern.class
};
@@ -127,18 +127,18 @@ public class BlacklistCleaner_p {
}
// list illegal entries
- HashMap ies = getIllegalEntries(blacklistToUse, supportedBlacklistTypes, plasmaSwitchboard.urlBlacklist);
+ HashMap<String, Integer> ies = getIllegalEntries(blacklistToUse, supportedBlacklistTypes, plasmaSwitchboard.urlBlacklist);
prop.put(RESULTS + "entries", ies.size());
prop.putHTML(RESULTS + "blEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
prop.put(RESULTS + "disabled", (ies.size() == 0) ? "1" : "0");
if (ies.size() > 0) {
prop.put(RESULTS + DISABLED + "entries", ies.size());
- Iterator it = ies.keySet().iterator();
+ Iterator<String> it = ies.keySet().iterator();
int i = 0;
String s;
while (it.hasNext()) {
- s = (String)it.next();
- prop.put(RESULTS + DISABLED + ENTRIES + i + "_error", ((Integer)ies.get(s)).longValue());
+ s = it.next();
+ prop.put(RESULTS + DISABLED + ENTRIES + i + "_error", ies.get(s).longValue());
prop.putHTML(RESULTS + DISABLED + ENTRIES + i + "_entry", s);
i++;
}
@@ -173,38 +173,37 @@ public class BlacklistCleaner_p {
}
private static String[] getByPrefix(serverObjects post, String prefix, boolean useKeys, boolean useHashSet) {
- Collection r;
+ Collection<String> r;
if (useHashSet) {
- r = new HashSet();
+ r = new HashSet<String>();
} else {
- r = new ArrayList();
+ r = new ArrayList<String>();
}
- Iterator it;
+
String s;
if (useKeys) {
- it = post.keySet().iterator();
+ Iterator<String> it = post.keySet().iterator();
while (it.hasNext())
if ((s = (String)it.next()).indexOf(prefix) == 0)
r.add(s.substring(prefix.length()));
} else {
- it = post.entrySet().iterator();
- Entry entry;
+ Iterator<Map.Entry<String, String>> it = post.entrySet().iterator();
+ Map.Entry<String, String> entry;
while (it.hasNext()) {
- entry = (Entry)it.next();
- if (((String)entry.getKey()).indexOf(prefix) == 0)
- r.add(entry.getValue());
+ entry = it.next();
+ if (entry.getKey().indexOf(prefix) == 0) r.add((String) entry.getValue());
}
}
- return (String[])r.toArray(new String[r.size()]);
+ return r.toArray(new String[r.size()]);
}
- private static HashMap /* entry, error-code */ getIllegalEntries(String blacklistToUse, String[] supportedBlacklistTypes, plasmaURLPattern blEngine) {
- HashMap r = new HashMap();
- HashSet ok = new HashSet();
+ private static HashMap<String, Integer>/* entry, error-code */ getIllegalEntries(String blacklistToUse, String[] supportedBlacklistTypes, plasmaURLPattern blEngine) {
+ HashMap<String, Integer> r = new HashMap<String, Integer>();
+ HashSet<String> ok = new HashSet<String>();
- ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
- Iterator it = list.iterator();
+ ArrayList<String> list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
+ Iterator<String> it = list.iterator();
String s, host, path;
if (blEngine instanceof defaultURLPattern) {
@@ -273,7 +272,7 @@ public class BlacklistCleaner_p {
private static int removeEntries(String blacklistToUse, String[] supportedBlacklistTypes, String[] entries) {
// load blacklist data from file
- ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
+ ArrayList<String> list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
// delete the old entry from file
String s;
diff --git a/htroot/Blog.java b/htroot/Blog.java
index e9447a5af..06598635a 100644
--- a/htroot/Blog.java
+++ b/htroot/Blog.java
@@ -141,9 +141,9 @@ public class Blog {
if(hasRights && post.containsKey("delete") && post.get("delete").equals("sure")) {
page = switchboard.blogDB.read(pagename);
- final Iterator i = page.comments().iterator();
+ final Iterator<String> i = page.comments().iterator();
while(i.hasNext()) {
- switchboard.blogCommentDB.delete((String) i.next());
+ switchboard.blogCommentDB.delete(i.next());
}
switchboard.blogDB.delete(pagename);
pagename = DEFAULT_PAGE;
@@ -163,7 +163,7 @@ public class Blog {
}
Date date = null;
- ArrayList comments = null;
+ ArrayList<String> comments = null;
//set name for new entry or date for old entry
if(pagename.equals(DEFAULT_PAGE)) {
@@ -185,7 +185,7 @@ public class Blog {
switchboard.blogDB.write(switchboard.blogDB.newEntry(pagename, subject, author, ip, date, content, comments, commentMode));
// create a news message
- final HashMap map = new HashMap();
+ final HashMap<String, String> map = new HashMap<String, String>();
map.put("page", pagename);
map.put("subject", StrSubject.replace(',', ' '));
map.put("author", StrAuthor.replace(',', ' '));
@@ -292,7 +292,7 @@ public class Blog {
final boolean xml)
{
try {
- final Iterator i = switchboard.blogDB.keys(false);
+ final Iterator<String> i = switchboard.blogDB.keys(false);
String pageid;
int count = 0; //counts how many entries are shown to the user
if(xml) num = 0;
@@ -301,7 +301,7 @@ public class Blog {
boolean prev = false; //indicates if there were previous comments to the ones that are dispalyed
if (start > 0) prev = true;
while(i.hasNext() && (num == 0 || num > count)) {
- pageid = (String) i.next();
+ pageid = i.next();
if(0 < start--) continue;
putBlogEntry(
prop,
diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java
index f15d3aa5f..6796ec62f 100644
--- a/htroot/BlogComments.java
+++ b/htroot/BlogComments.java
@@ -259,7 +259,7 @@ public class BlogComments {
}
//show all commments
try {
- Iterator i = page.comments().iterator();
+ Iterator<String> i = page.comments().iterator();
int commentMode = page.getCommentMode();
String pageid;
blogBoardComments.CommentEntry entry;
@@ -278,7 +278,7 @@ public class BlogComments {
int prevstart = start-num; //indicates the starting offset for previous results
while(i.hasNext() && count < num) {
- pageid = (String) i.next();
+ pageid = i.next();
if(start > 0) {
start--;
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java
index 0cd0f8916..9402a8814 100644
--- a/htroot/Bookmarks.java
+++ b/htroot/Bookmarks.java
@@ -54,6 +54,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
+
import de.anomic.data.bookmarksDB;
import de.anomic.data.listManager;
import de.anomic.data.userDB;
@@ -155,7 +156,7 @@ public class Bookmarks {
if(tagsString.equals("")){
tagsString="unsorted"; //default tag
}
- Set tags=listManager.string2set(bookmarksDB.cleanTagsString(tagsString));
+ Set<String> tags=listManager.string2set(bookmarksDB.cleanTagsString(tagsString));
bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.createBookmark(url, username);
if(bookmark != null){
bookmark.setProperty(bookmarksDB.Bookmark.BOOKMARK_TITLE, title);
@@ -278,8 +279,7 @@ public class Bookmarks {
// create bookmark list
//-----------------------
int count=0;
- bookmarksDB.Tag tag;
- Iterator it = null;
+ Iterator<String> it = null;
bookmarksDB.Bookmark bookmark;
Set<String> tags;
Iterator<String> tagsIt;
@@ -369,7 +369,7 @@ public class Bookmarks {
private static void printTagList(String id, String tagName, int comp, int max, boolean opt){
int count=0;
bookmarksDB.Tag tag;
- Iterator it = null;
+ Iterator<Tag> it = null;
if (tagName.equals("")) {
it = switchboard.bookmarksDB.getTagIterator(isAdmin, comp, max);
@@ -398,11 +398,11 @@ public class Bookmarks {
prop.put(id, count);
}
- private static int recurseFolders(Iterator it, String root, int count, boolean next, String prev){
+ private static int recurseFolders(Iterator<String> it, String root, int count, boolean next, String prev){
String fn="";
bookmarksDB.Bookmark bookmark;
- if(next) fn = it.next().toString();
+ if (next) fn = it.next().toString();
else fn = prev;
if(fn.equals("\uffff")) {
@@ -418,7 +418,7 @@ public class Bookmarks {
if(fn.startsWith(root)){
prop.put("folderlist_"+count+"_folder", "<li>"+fn.replaceFirst(root+"/*","")+"<ul class=\"folder\">");
count++;
- Iterator bit=switchboard.bookmarksDB.getBookmarksIterator(fn, isAdmin);
+ Iterator<String> bit=switchboard.bookmarksDB.getBookmarksIterator(fn, isAdmin);
while(bit.hasNext()){
bookmark=switchboard.bookmarksDB.getBookmark((String)bit.next());
prop.put("folderlist_"+count+"_folder", "<li><a href=\""+bookmark.getUrl()+"\" title=\""+bookmark.getDescription()+"\">"+ bookmark.getTitle()+"</a></li>");
diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.java
index 6ec250d27..d140221bd 100644
--- a/htroot/ConfigLanguage_p.java
+++ b/htroot/ConfigLanguage_p.java
@@ -95,7 +95,7 @@ public class ConfigLanguage_p {
//load language file from URL
} else if (post.containsKey("url")){
String url = (String)post.get("url");
- ArrayList langVector;
+ ArrayList<String> langVector;
try{
yacyURL u = new yacyURL(url, null);
langVector = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, switchboard.remoteProxyConfig, null, null), "UTF-8");
@@ -105,11 +105,11 @@ public class ConfigLanguage_p {
return prop;
}
try{
- Iterator it = langVector.iterator();
+ Iterator<String> it = langVector.iterator();
File langFile = new File(langPath, url.substring(url.lastIndexOf("/"), url.length()));
BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(langFile)));
- while(it.hasNext()){
+ while (it.hasNext()) {
bw.write(it.next() + "\n");
}
bw.close();
@@ -126,7 +126,7 @@ public class ConfigLanguage_p {
//reread language files
langFiles = listManager.getDirListing(langPath);
int i;
- HashMap langNames = translator.langMap(env);
+ HashMap<String, String> langNames = translator.langMap(env);
String langKey, langName;
//virtual entry
diff --git a/htroot/ConfigProperties_p.java b/htroot/ConfigProperties_p.java
index 46d03b2fa..f0816171b 100644
--- a/htroot/ConfigProperties_p.java
+++ b/htroot/ConfigProperties_p.java
@@ -72,9 +72,9 @@ public class ConfigProperties_p {
env.setConfig(key, value);
}
}
- Iterator keys = env.configKeys();
+ Iterator<String> keys = env.configKeys();
- final List list = new ArrayList(250);
+ final List<String> list = new ArrayList<String>(250);
while(keys.hasNext()){
list.add(keys.next());
}
diff --git a/htroot/ConfigSkins_p.java b/htroot/ConfigSkins_p.java
index 4f5196b33..4791b939a 100644
--- a/htroot/ConfigSkins_p.java
+++ b/htroot/ConfigSkins_p.java
@@ -124,17 +124,17 @@ public class ConfigSkins_p {
//load skin from URL
} else if (post.containsKey("url")){
String url = (String)post.get("url");
- ArrayList skinVector;
- try{
+ ArrayList<String> skinVector;
+ try {
yacyURL u = new yacyURL(url, null);
skinVector = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, switchboard.remoteProxyConfig, null, null), "UTF-8");
- }catch(IOException e){
+ } catch(IOException e) {
prop.put("status", "1");//unable to get URL
prop.put("status_url", url);
return prop;
}
- try{
- Iterator it = skinVector.iterator();
+ try {
+ Iterator<String> it = skinVector.iterator();
File skinFile = new File(skinPath, url.substring(url.lastIndexOf("/"), url.length()));
BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(skinFile)));
@@ -142,11 +142,11 @@ public class ConfigSkins_p {
bw.write(it.next() + "\n");
}
bw.close();
- }catch(IOException e){
+ } catch(IOException e){
prop.put("status", "2");//error saving the skin
return prop;
}
- if(post.containsKey("use_skin") && ((String)post.get("use_skin")).equals("on")){
+ if (post.containsKey("use_skin") && ((String)post.get("use_skin")).equals("on")){
changeSkin(switchboard, skinPath, url.substring(url.lastIndexOf("/"), url.length()));
}
}
diff --git a/htroot/Config_p.java b/htroot/Config_p.java
index 1d9824cca..af3dfe1a6 100644
--- a/htroot/Config_p.java
+++ b/htroot/Config_p.java
@@ -62,7 +62,7 @@ public class Config_p {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
int count=0;
- Iterator keys = env.configKeys();
+ Iterator<String> keys = env.configKeys();
String key="";
//change a Key
@@ -74,7 +74,7 @@ public class Config_p {
}
}
- final List list = new ArrayList(250);
+ final List<String> list = new ArrayList<String>(250);
while(keys.hasNext()){
list.add(keys.next());
}
diff --git a/htroot/CookieMonitorIncoming_p.java b/htroot/CookieMonitorIncoming_p.java
index 8d7b87222..1053834dd 100644
--- a/htroot/CookieMonitorIncoming_p.java
+++ b/htroot/CookieMonitorIncoming_p.java
@@ -65,17 +65,17 @@ public class CookieMonitorIncoming_p {
int entCount = 0;
int tmpCount = 0;
boolean dark = true;
- Iterator i = switchboard.incomingCookies.entrySet().iterator();
- Map.Entry entry;
+ Iterator<Map.Entry<String, Object[]>> i = switchboard.incomingCookies.entrySet().iterator();
+ Map.Entry<String, Object[]> entry;
String host, client;
Object[] cookies;
Date date;
Object[] oa;
while ((entCount < maxCount) && (i.hasNext())) {
// get out values
- entry = (Map.Entry) i.next();
- host = (String) entry.getKey();
- oa = (Object[]) entry.getValue();
+ entry = i.next();
+ host = entry.getKey();
+ oa = entry.getValue();
date = (Date) oa[0];
client = (String) oa[1];
cookies = (Object[]) oa[2];
diff --git a/htroot/CookieTest.java b/htroot/CookieTest.java
index 42adbe504..3b59bfd81 100644
--- a/htroot/CookieTest.java
+++ b/htroot/CookieTest.java
@@ -47,7 +47,7 @@
// if the shell's current path is HTROOT
import java.util.Iterator;
-import java.util.Map.Entry;
+import java.util.Map;
import de.anomic.http.httpHeader;
import de.anomic.server.serverObjects;
@@ -68,15 +68,13 @@ public class CookieTest {
}
final servletProperties prop = new servletProperties();
- if(post.containsKey("act")&&post.get("act").equals("clear_cookie"))
- {
- httpHeader outgoingHeader=new httpHeader();
- Iterator it = header.entrySet().iterator();
- while(it.hasNext())
- {
- java.util.Map.Entry e = (Entry) it.next();
- if(e.getKey().equals("Cookie"))
- {
+ if(post.containsKey("act")&&post.get("act").equals("clear_cookie")) {
+ httpHeader outgoingHeader = new httpHeader();
+ Iterator<Map.Entry<String, String>> it = header.entrySet().iterator();
+ Map.Entry<String, String> e;
+ while (it.hasNext()) {
+ e = it.next();
+ if (e.getKey().equals("Cookie")) {
String coockie[]=e.getValue().toString().split(";");
for(int i=0;i<coockie.length;i++)
{
diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.java
index c34bc6bce..06a1651ec 100644
--- a/htroot/CrawlProfileEditor_p.java
+++ b/htroot/CrawlProfileEditor_p.java
@@ -29,9 +29,9 @@ import java.util.ArrayList;
import java.util.Iterator;
import de.anomic.http.httpHeader;
-import de.anomic.plasma.plasmaCrawlProfile.entry;
import de.anomic.plasma.plasmaCrawlProfile;
import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.plasma.plasmaCrawlProfile.entry;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -56,7 +56,7 @@ public class CrawlProfileEditor_p {
}
}
- private static final ArrayList /*<eentry>*/ labels = new ArrayList();
+ private static final ArrayList <eentry> labels = new ArrayList<eentry>();
static {
labels.add(new eentry(entry.NAME, "Name", true, eentry.STRING));
labels.add(new eentry(entry.START_URL, "Start URL", true, eentry.STRING));
@@ -100,7 +100,7 @@ public class CrawlProfileEditor_p {
// generate handle list
int count = 0;
- Iterator it = sb.profilesActiveCrawls.profiles(true);
+ Iterator<plasmaCrawlProfile.entry> it = sb.profilesActiveCrawls.profiles(true);
entry selentry;
while (it.hasNext()) {
selentry = (entry)it.next();
@@ -122,10 +122,10 @@ public class CrawlProfileEditor_p {
if ((post != null) && (selentry != null)) {
if (post.containsKey("submit")) {
try {
- it = labels.iterator();
+ Iterator<eentry> lit = labels.iterator();
eentry tee;
- while (it.hasNext()) {
- tee = (eentry) it.next();
+ while (lit.hasNext()) {
+ tee = lit.next();
String cval = (String) selentry.map().get(tee.name);
String val = (tee.type == eentry.BOOLEAN) ? Boolean.toString(post.containsKey(tee.name)) : post.get(tee.name, cval);
if (!cval.equals(val)) sb.profilesActiveCrawls.changeEntry(selentry, tee.name, val);
@@ -167,10 +167,10 @@ public class CrawlProfileEditor_p {
prop.put("edit", "1");
prop.put("edit_name", selentry.name());
prop.put("edit_handle", selentry.handle());
- it = labels.iterator();
+ Iterator<eentry> lit = labels.iterator();
count = 0;
- while (it.hasNext()) {
- eentry ee = (eentry) it.next();
+ while (lit.hasNext()) {
+ eentry ee = lit.next();
String val = selentry.map().get(ee.name);
prop.put("edit_entries_" + count + "_readonly", ee.readonly ? "1" : "0");
prop.put("edit_entries_" + count + "_readonly_name", ee.name);
diff --git a/htroot/CrawlStartSimple_p.java b/htroot/CrawlStartSimple_p.java
index 5d7f27d68..38786fec2 100644
--- a/htroot/CrawlStartSimple_p.java
+++ b/htroot/CrawlStartSimple_p.java
@@ -100,13 +100,13 @@ public class CrawlStartSimple_p {
boolean dark = true;
// create other peer crawl table using YaCyNews
- Iterator recordIterator = yacyCore.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);
+ Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);
int showedCrawl = 0;
yacyNewsRecord record;
yacySeed peer;
String peername;
while (recordIterator.hasNext()) {
- record = (yacyNewsRecord) recordIterator.next();
+ record = recordIterator.next();
if (record == null) continue;
if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {
peer = yacyCore.seedDB.get(record.originator());
@@ -151,8 +151,8 @@ public class CrawlStartSimple_p {
if ((yacyCore.seedDB == null) || (yacyCore.seedDB.mySeed().isVirgin()) || (yacyCore.seedDB.mySeed().isJunior())) {
prop.put("remoteCrawlPeers", "0");
} else {
- Iterator crawlavail = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(yacyURL.dummyHash, true);
- Iterator crawlpendi = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(yacyURL.dummyHash, false);
+ Iterator<yacySeed> crawlavail = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(yacyURL.dummyHash, true);
+ Iterator<yacySeed> crawlpendi = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(yacyURL.dummyHash, false);
if ((!(crawlavail.hasNext())) && (!(crawlpendi.hasNext()))) {
prop.put("remoteCrawlPeers", "0"); //no peers availible
} else {
@@ -161,7 +161,7 @@ public class CrawlStartSimple_p {
int availcount = 0;
yacySeed seed;
while ((availcount < maxcount) && (crawlavail.hasNext())) {
- seed = (yacySeed) crawlavail.next();
+ seed = crawlavail.next();
prop.put("remoteCrawlPeers_available_" + availcount + "_name", seed.getName());
prop.put("remoteCrawlPeers_available_" + availcount + "_due", (yacyCore.yacyTime() - seed.available));
availcount++;
@@ -169,7 +169,7 @@ public class CrawlStartSimple_p {
prop.put("remoteCrawlPeers_available", availcount);
int pendicount = 0;
while ((pendicount < maxcount) && (crawlpendi.hasNext())) {
- seed = (yacySeed) crawlpendi.next();
+ seed = crawlpendi.next();
prop.put("remoteCrawlPeers_busy_" + pendicount + "_name", seed.getName());
prop.put("remoteCrawlPeers_busy_" + pendicount + "_due", (yacyCore.yacyTime() - seed.available));
pendicount++;
diff --git a/htroot/IndexControlRWIs_p.html b/htroot/IndexControlRWIs_p.html
index 7dc8a0c37..aae4e0171 100644
--- a/htroot/IndexControlRWIs_p.html
+++ b/htroot/IndexControlRWIs_p.html
@@ -38,6 +38,7 @@
<td colspan="6">appearance in</td>
<td colspan="4">in link type</td>
<td colspan="1">document type</td>
+ </tr>
<tr class="TableCellDark">
<td style="background-color:#FFFFFF">&nbsp;</td>
<td>description</td>
@@ -87,8 +88,8 @@
<fieldset><legend>Display URL List</legend>
<dl>
<dt class="TableCellDark">Number of lines:</dt>
- <dd><input type="radio" name="lines" value="all" checked="checked" />all lines&nbsp;&nbsp;
- <input type="radio" name="lines" value="100" />100&nbsp;&nbsp;
+ <dd><input type="radio" name="lines" value="all" />all lines&nbsp;&nbsp;
+ <input type="radio" name="lines" value="100" checked="checked" />100&nbsp;&nbsp;
<input type="radio" name="lines" value="1000" />1000&nbsp;&nbsp;
</dd>
<dt class="TableCellDark">Ordering of list:</dt>
@@ -138,6 +139,7 @@
<td colspan="3">Resource</td>
<td colspan="8">Negative Ranking Factors</td>
<td colspan="8">Positive Ranking Factors</td>
+ <td rowspan="2">props</td>
<td rowspan="2">Reverse Normalized Weighted Ranking Sum</td>
</tr>
<tr class="TableHeader">
@@ -160,7 +162,6 @@
<td>local links</td>
<td>remote links</td>
<td>hitcount</td>
- <td>props</td>
</tr>
#{urlList}#
<tr class="TableCellLight">
diff --git a/htroot/IndexCreateIndexingQueue_p.java b/htroot/IndexCreateIndexingQueue_p.java
index 11ca95878..e3ce0ae29 100644
--- a/htroot/IndexCreateIndexingQueue_p.java
+++ b/htroot/IndexCreateIndexingQueue_p.java
@@ -115,7 +115,7 @@ public class IndexCreateIndexingQueue_p {
plasmaSwitchboardQueue.Entry pcentry;
int inProcessCount = 0, entryCount = 0, totalCount = 0;
long totalSize = 0;
- ArrayList entryList = new ArrayList();
+ ArrayList<plasmaSwitchboardQueue.Entry> entryList = new ArrayList<plasmaSwitchboardQueue.Entry>();
// getting all entries that are currently in process
synchronized (switchboard.indexingTasksInProcess) {
@@ -125,8 +125,8 @@ public class IndexCreateIndexingQueue_p {
// getting all enqueued entries
if ((switchboard.sbQueue.size() > 0)) {
- Iterator i = switchboard.sbQueue.entryIterator(false);
- while (i.hasNext()) entryList.add((plasmaSwitchboardQueue.Entry) i.next());
+ Iterator<plasmaSwitchboardQueue.Entry> i = switchboard.sbQueue.entryIterator(false);
+ while (i.hasNext()) entryList.add(i.next());
}
int count=entryList.size();
diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.java
index 5a6504717..ea1745c47 100644
--- a/htroot/IndexCreateWWWLocalQueue_p.java
+++ b/htroot/IndexCreateWWWLocalQueue_p.java
@@ -108,10 +108,10 @@ public class IndexCreateWWWLocalQueue_p {
if (option == PROFILE) {
// search and delete the crawl profile (_much_ faster, independant of queue size)
// XXX: what to do about the annoying LOST PROFILE messages in the log?
- Iterator it = sb.profilesActiveCrawls.profiles(true);
+ Iterator<plasmaCrawlProfile.entry> it = sb.profilesActiveCrawls.profiles(true);
plasmaCrawlProfile.entry entry;
while (it.hasNext()) {
- entry = (plasmaCrawlProfile.entry)it.next();
+ entry = it.next();
final String name = entry.name();
if (name.equals(plasmaSwitchboard.CRAWL_PROFILE_PROXY) ||
name.equals(plasmaSwitchboard.CRAWL_PROFILE_REMOTE) ||
@@ -124,10 +124,10 @@ public class IndexCreateWWWLocalQueue_p {
}
} else {
// iterating through the list of URLs
- Iterator iter = sb.crawlQueues.noticeURL.iterator(plasmaCrawlNURL.STACK_TYPE_CORE);
+ Iterator<plasmaCrawlEntry> iter = sb.crawlQueues.noticeURL.iterator(plasmaCrawlNURL.STACK_TYPE_CORE);
plasmaCrawlEntry entry;
while (iter.hasNext()) {
- if ((entry = (plasmaCrawlEntry) iter.next()) == null) continue;
+ if ((entry = iter.next()) == null) continue;
String value = null;
switch (option) {
diff --git a/htroot/IndexImport_p.java b/htroot/IndexImport_p.java
index ea3ef74a0..fa4e693ff 100644
--- a/htroot/IndexImport_p.java
+++ b/htroot/IndexImport_p.java
@@ -80,7 +80,7 @@ public final class IndexImport_p {
String cacheSizeStr = (String) post.get("cacheSize");
boolean startImport = true;
- HashMap initParams = new HashMap();
+ HashMap<String, String> initParams = new HashMap<String, String>();
initParams.put("plasmaPath",importPlasmaPath);
initParams.put("cacheSize",cacheSizeStr);
initParams.put("preloadTime","100");
diff --git a/htroot/IndexTransfer_p.java b/htroot/IndexTransfer_p.java
index 61b7895a7..c30df8d15 100644
--- a/htroot/IndexTransfer_p.java
+++ b/htroot/IndexTransfer_p.java
@@ -131,10 +131,10 @@ public final class IndexTransfer_p {
yacySeed seed;
int hc = 0;
if ((yacyCore.seedDB != null) && (yacyCore.seedDB.sizeConnected() > 0)) {
- Iterator e = yacyCore.dhtAgent.getAcceptRemoteIndexSeeds("------------");
+ Iterator<yacySeed> e = yacyCore.dhtAgent.getAcceptRemoteIndexSeeds("------------");
TreeMap<String, String> hostList = new TreeMap<String, String>();
while (e.hasNext()) {
- seed = (yacySeed) e.next();
+ seed = e.next();
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"), seed.hash);
}
diff --git a/htroot/LogStatistics_p.java b/htroot/LogStatistics_p.java
index 98915c0ac..28b663c90 100644
--- a/htroot/LogStatistics_p.java
+++ b/htroot/LogStatistics_p.java
@@ -60,6 +60,7 @@ public class LogStatistics_p {
private static final String RESULTS = "results_";
+ @SuppressWarnings("unchecked")
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
final serverObjects prop = new serverObjects();
diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.java
index fc8ea5150..af9e144c3 100644
--- a/htroot/MessageSend_p.java
+++ b/htroot/MessageSend_p.java
@@ -85,7 +85,7 @@ public class MessageSend_p {
// open an editor page for the message
// first ask if the other peer is online, and also what kind of document it accepts
- HashMap result = yacyClient.permissionMessage(hash);
+ HashMap<String, String> result = yacyClient.permissionMessage(hash);
//System.out.println("DEBUG: permission request result = " + result.toString());
String peerName;
yacySeed targetPeer = null;
@@ -149,7 +149,7 @@ public class MessageSend_p {
} catch (UnsupportedEncodingException e) {
mb = message.getBytes();
}
- HashMap result = yacyClient.postMessage(hash, subject, mb);
+ HashMap<String, String> result = yacyClient.postMessage(hash, subject, mb);
//message has been sent
prop.put("mode_status_response", (String) result.get("response"));
diff --git a/htroot/Messages_p.java b/htroot/Messages_p.java
index 00b4d7721..1e048245a 100644
--- a/htroot/Messages_p.java
+++ b/htroot/Messages_p.java
@@ -85,16 +85,16 @@ public class Messages_p {
prop.put("peersKnown", "1");
int peerCount = 0;
try {
- TreeMap hostList = new TreeMap();
- final Iterator e = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.0);
+ TreeMap<String, String> hostList = new TreeMap<String, String>();
+ final Iterator<yacySeed> e = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.0);
while (e.hasNext()) {
- yacySeed seed = (yacySeed) e.next();
+ yacySeed seed = e.next();
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);
}
String peername;
- while ((peername = (String) hostList.firstKey()) != null) {
- final String Hash = (String) hostList.get(peername);
+ while ((peername = hostList.firstKey()) != null) {
+ final String Hash = hostList.get(peername);
prop.put(PEERSKNOWN + "peers_" + peerCount + "_hash", Hash);
prop.putHTML(PEERSKNOWN + "peers_" + peerCount + "_name", peername, true);
hostList.remove(peername);
@@ -129,13 +129,13 @@ public class Messages_p {
if (action.equals("list")) {
prop.put("mode", "0"); //list
try {
- Iterator i = switchboard.messageDB.keys(null, true);
+ Iterator<String> i = switchboard.messageDB.keys(null, true);
String key;
boolean dark = true;
int count=0;
while (i.hasNext()) {
- key = (String) i.next();
+ key = i.next();
message = switchboard.messageDB.read(key);
prop.put("mode_messages_"+count+"_dark", ((dark) ? "1" : "0") );
prop.put("mode_messages_"+count+"_date", dateString(message.date()));
diff --git a/htroot/Network.java b/htroot/Network.java
index 05d6499f3..dfca48987 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -210,10 +210,10 @@ public class Network {
return prop;
}
- final HashMap map = new HashMap();
+ final HashMap<String, String> map = new HashMap<String, String>();
map.put(yacySeed.IP,post.get("peerIP"));
map.put(yacySeed.PORT,post.get("peerPort"));
- yacySeed peer = new yacySeed((String) post.get("peerHash"),map);
+ yacySeed peer = new yacySeed(post.get("peerHash"),map);
yacyCore.peerActions.updateMySeed();
final int added = yacyClient.publishMySeed(peer.getPublicAddress(), peer.hash);
@@ -233,9 +233,9 @@ public class Network {
}
}
- prop.put("table_peerHash",(String) post.get("peerHash"));
- prop.put("table_peerIP",(String)post.get("peerIP"));
- prop.put("table_peerPort",(String) post.get("peerPort"));
+ prop.put("table_peerHash",post.get("peerHash"));
+ prop.put("table_peerIP",post.get("peerIP"));
+ prop.put("table_peerPort",post.get("peerPort"));
} else {
prop.put("table_peerHash","");
prop.put("table_peerIP","");
@@ -268,14 +268,14 @@ public class Network {
}
// find updated Information using YaCyNews
- final HashSet updatedProfile = new HashSet();
- final HashMap updatedWiki = new HashMap();
- final HashMap updatedBlog = new HashMap();
- final HashMap isCrawling = new HashMap();
+ final HashSet<String> updatedProfile = new HashSet<String>();
+ final HashMap<String, Map<String, String>> updatedWiki = new HashMap<String, Map<String, String>>();
+ final HashMap<String, Map<String, String>> updatedBlog = new HashMap<String, Map<String, String>>();
+ final HashMap<String, String> isCrawling = new HashMap<String, String>();
yacyNewsRecord record;
- Iterator recordIterator = yacyCore.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);
+ Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);
while (recordIterator.hasNext()) {
- record = (yacyNewsRecord) recordIterator.next();
+ record = recordIterator.next();
if (record == null) {
continue;
} else if (record.category().equals(yacyNewsPool.CATEGORY_PROFILE_UPDATE)) {
@@ -292,7 +292,7 @@ public class Network {
boolean dark = true;
yacySeed seed;
final boolean complete = post.containsKey("ip");
- Iterator e = null;
+ Iterator<yacySeed> e = null;
switch (page) {
case 1 : e = yacyCore.seedDB.seedsSortedConnected(post.get("order", "down").equals("up"), post.get("sort", yacySeed.LCOUNT)); break;
case 2 : e = yacyCore.seedDB.seedsSortedDisconnected(post.get("order", "down").equals("up"), post.get("sort", yacySeed.LASTSEEN)); break;
@@ -301,8 +301,8 @@ public class Network {
}
int p;
String startURL;
- Map wikiMap;
- Map blogMap;
+ Map<String, String> wikiMap;
+ Map<String, String> blogMap;
String userAgent, location;
int PPM;
double QPM;
@@ -310,7 +310,7 @@ public class Network {
String wrongregex = null;
prop.put("regexerror", 0);
prop.put("regexerror_wrongregex", (String)null);
- if(post.containsKey("search")) {
+ if (post.containsKey("search")) {
try {
peerSearchPattern = Pattern.compile(post.get("match", ""), Pattern.CASE_INSENSITIVE);
} catch (PatternSyntaxException pse){
@@ -348,14 +348,14 @@ public class Network {
prop.put(STR_TABLE_LIST + conCount + "_updatedProfile", 1);
prop.put(STR_TABLE_LIST + conCount + "_updatedProfile_hash", seed.hash);
}
- if ((wikiMap = (Map) updatedWiki.get(seed.hash)) == null) {
+ if ((wikiMap = updatedWiki.get(seed.hash)) == null) {
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 0);
} else {
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 1);
prop.putHTML(STR_TABLE_LIST + conCount + "_updatedWiki_page", (String) wikiMap.get("page"));
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki_address", seed.getPublicAddress());
}
- if ((blogMap = (Map) updatedBlog.get(seed.hash)) == null) {
+ if ((blogMap = updatedBlog.get(seed.hash)) == null) {
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
} else {
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 1);
diff --git a/htroot/PeerLoadPicture.java b/htroot/PeerLoadPicture.java
index 82cd880db..e144a2566 100644
--- a/htroot/PeerLoadPicture.java
+++ b/htroot/PeerLoadPicture.java
@@ -27,14 +27,14 @@ public class PeerLoadPicture {
final CircleThreadPiece idle = new CircleThreadPiece("Idle", new Color(170, 255, 170));
final CircleThreadPiece misc = new CircleThreadPiece("Misc.", new Color(190, 50, 180));
- final HashMap /* <String,CircleThreadPiece> */ pieces = new HashMap();
+ final HashMap<String, CircleThreadPiece> pieces = new HashMap<String, CircleThreadPiece>();
pieces.put(null, idle);
pieces.put(plasmaSwitchboard.CRAWLSTACK, new CircleThreadPiece("Stacking", new Color(115, 200, 210)));
pieces.put(plasmaSwitchboard.INDEXER, new CircleThreadPiece("Parsing/Indexing", new Color(255, 130, 0)));
pieces.put(plasmaSwitchboard.INDEX_DIST, new CircleThreadPiece("DHT-Distribution", new Color(119, 136, 153)));
pieces.put(plasmaSwitchboard.PEER_PING, new CircleThreadPiece("YaCy Core", new Color(255, 230, 160)));
- Iterator threads = env.threadNames();
+ Iterator<String> threads = env.threadNames();
String threadname;
serverThread thread;
@@ -42,7 +42,7 @@ public class PeerLoadPicture {
//Iterate over threads
while (threads.hasNext()) {
- threadname = (String)threads.next();
+ threadname = threads.next();
thread = env.getThread(threadname);
//count total times
@@ -51,7 +51,7 @@ public class PeerLoadPicture {
if (showidle) idle.addExecTime(thread.getSleepTime());
//count threadgroup-specific times
- CircleThreadPiece piece = (CircleThreadPiece)pieces.get(threadname);
+ CircleThreadPiece piece = pieces.get(threadname);
if (piece == null) {
misc.addExecTime(thread.getBlockTime()+thread.getExecTime());
} else {
@@ -61,10 +61,10 @@ public class PeerLoadPicture {
busy_time += idle.getExecTime();
// set respective angles
- Iterator it = pieces.values().iterator();
+ Iterator<CircleThreadPiece> it = pieces.values().iterator();
CircleThreadPiece current;
while (it.hasNext()) {
- current = (CircleThreadPiece)it.next();
+ current = it.next();
current.setFraction(busy_time);
//remove unneccessary elements
if(current.getAngle() == 0) it.remove();
@@ -81,7 +81,7 @@ public class PeerLoadPicture {
5000,
width,
height,
- (CircleThreadPiece[])pieces.values().toArray(new CircleThreadPiece[pieces.size()]),
+ pieces.values().toArray(new CircleThreadPiece[pieces.size()]),
misc
);
}
diff --git a/htroot/PerformanceSearch_p.java b/htroot/PerformanceSearch_p.java
index bd5681852..54b921f19 100644
--- a/htroot/PerformanceSearch_p.java
+++ b/htroot/PerformanceSearch_p.java
@@ -39,12 +39,12 @@ public class PerformanceSearch_p {
// return variable that accumulates replacements
serverObjects prop = new serverObjects();
- Iterator events = serverProfiling.history("SEARCH");
+ Iterator<serverProfiling.Event> events = serverProfiling.history("SEARCH");
int c = 0;
serverProfiling.Event event;
plasmaProfiling.searchEvent search;
while (events.hasNext()) {
- event = (serverProfiling.Event) events.next();
+ event = events.next();
search = (plasmaProfiling.searchEvent) event.payload;
prop.put("table_" + c + "_query", search.queryID);
prop.put("table_" + c + "_event", search.processName);
diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java
index 7e12e5948..cd5a64084 100644
--- a/htroot/SettingsAck_p.java
+++ b/htroot/SettingsAck_p.java
@@ -483,11 +483,11 @@ public class SettingsAck_p {
* Loop through the available seed uploaders to see if the
* configuration of one of them has changed
*/
- HashMap uploaders = yacyCore.getSeedUploadMethods();
- Iterator uploaderKeys = uploaders.keySet().iterator();
+ HashMap<String, String> uploaders = yacyCore.getSeedUploadMethods();
+ Iterator<String> uploaderKeys = uploaders.keySet().iterator();
while (uploaderKeys.hasNext()) {
// getting the uploader module name
- String uploaderName = (String) uploaderKeys.next();
+ String uploaderName = uploaderKeys.next();
// determining if the user has reconfigured the settings of this uploader
@@ -556,11 +556,11 @@ public class SettingsAck_p {
post.remove("parserSettings");
Set<String> parserModes = plasmaParser.getParserConfigList().keySet();
- HashMap<String, HashSet> newConfigList = new HashMap<String, HashSet>();
+ HashMap<String, HashSet<String>> newConfigList = new HashMap<String, HashSet<String>>();
Iterator<String> parserModeIter = parserModes.iterator();
while (parserModeIter.hasNext()) {
String currParserMode = parserModeIter.next();
- newConfigList.put(currParserMode, new HashSet());
+ newConfigList.put(currParserMode, new HashSet<String>());
}
// looping through all received settings
diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java
index 4c28e3d3d..bb215f721 100644
--- a/htroot/Settings_p.java
+++ b/htroot/Settings_p.java
@@ -229,17 +229,17 @@ public final class Settings_p {
env.setConfig("seedUploadMethod",enabledUploader);
}
- HashMap uploaders = yacyCore.getSeedUploadMethods();
+ HashMap<String, String> uploaders = yacyCore.getSeedUploadMethods();
prop.put("seedUploadMethods", uploaders.size() + 1);
prop.put("seedUploadMethods_0_name", "none");
prop.put("seedUploadMethods_0_selected", enabledUploader.equals("none") ? "1" : "0");
prop.put("seedUploadMethods_0_file", "");
int count = 0;
- Iterator uploaderKeys = uploaders.keySet().iterator();
+ Iterator<String> uploaderKeys = uploaders.keySet().iterator();
while (uploaderKeys.hasNext()) {
count++;
- String uploaderName = (String) uploaderKeys.next();
+ String uploaderName = uploaderKeys.next();
prop.put("seedUploadMethods_" +count+ "_name", uploaderName);
prop.put("seedUploadMethods_" +count+ "_selected", uploaderName.equals(enabledUploader) ? "1" : "0");
prop.put("seedUploadMethods_" +count+ "_file", "Settings_Seed_Upload" + uploaderName + ".inc");
@@ -269,7 +269,7 @@ public final class Settings_p {
*/
plasmaSwitchboard sb = (plasmaSwitchboard)env;
- HashMap configList = plasmaParser.getParserConfigList();
+ HashMap<String, plasmaParserConfig> configList = plasmaParser.getParserConfigList();
plasmaParserConfig[] configArray = (plasmaParserConfig[]) configList.values().toArray(new plasmaParserConfig[configList.size()]);
HashSet<ParserInfo> parserInfos = new HashSet<ParserInfo>(sb.parser.getAvailableParserList().values());
@@ -286,9 +286,9 @@ public final class Settings_p {
allParsersEnabled[i] = true;
int parserIdx = 0;
- Iterator availableParserIter = parserInfos.iterator();
+ Iterator<ParserInfo> availableParserIter = parserInfos.iterator();
while (availableParserIter.hasNext()) {
- ParserInfo parserInfo = (ParserInfo) availableParserIter.next();
+ ParserInfo parserInfo = availableParserIter.next();
prop.put("parser_" + parserIdx + "_name", parserInfo.parserName);
prop.putHTML("parser_" + parserIdx + "_version", parserInfo.parserVersionNr, true);
prop.put("parser_" + parserIdx + "_usage", parserInfo.usageCount);
@@ -303,7 +303,7 @@ public final class Settings_p {
//prop.put("parser_" + parserIdx + "_name", parserName);
//prop.put("parser_" + parserIdx + "_shortname", parserName.substring(parserName.lastIndexOf(".")+1));
for (int i=0; i<configArray.length; i++) {
- HashSet enabledParsers = configArray[i].getEnabledParserList();
+ HashSet<String> enabledParsers = configArray[i].getEnabledParserList();
prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode_" + i + "_optionName", configArray[i].parserMode + "." + mimeType);
prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode_" + i + "_status", enabledParsers.contains(mimeType) ? "1" : "0");
allParsersEnabled[i] &= enabledParsers.contains(mimeType);
diff --git a/htroot/Supporter.java b/htroot/Supporter.java
index f066c52eb..96b7a2c64 100644
--- a/htroot/Supporter.java
+++ b/htroot/Supporter.java
@@ -33,8 +33,9 @@ import java.util.Iterator;
import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroMScoreCluster;
-import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroNaturalOrder;
+import de.anomic.kelondro.kelondroRow;
+import de.anomic.kelondro.kelondroRow.Entry;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverDate;
@@ -74,7 +75,7 @@ public class Supporter {
return prop;
}
// make new news message with voting
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("urlhash", hash);
map.put("vote", "negative");
map.put("refid", post.get("refid", ""));
@@ -86,7 +87,7 @@ public class Supporter {
return prop;
}
// make new news message with voting
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("urlhash", hash);
map.put("url", crypt.simpleDecode(post.get("url", ""), null));
map.put("title", crypt.simpleDecode(post.get("title", ""), null));
@@ -98,29 +99,29 @@ public class Supporter {
}
// create Supporter
- HashMap negativeHashes = new HashMap(); // a mapping from an url hash to Integer (count of votes)
- HashMap positiveHashes = new HashMap(); // a mapping from an url hash to Integer (count of votes)
+ HashMap<String, Integer> negativeHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)
+ HashMap<String, Integer> positiveHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)
accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);
//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);
//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);
kelondroMScoreCluster<String> ranking = new kelondroMScoreCluster<String>(); // score cluster for url hashes
kelondroRow rowdef = new kelondroRow("String url-255, String title-120, String description-120, String refid-" + (serverDate.PATTERN_SHORT_SECOND.length() + 12), kelondroNaturalOrder.naturalOrder, 0);
- HashMap Supporter = new HashMap(); // a mapping from an url hash to a kelondroRow.Entry with display properties
+ HashMap<String, Entry> Supporter = new HashMap<String, Entry>(); // a mapping from an url hash to a kelondroRow.Entry with display properties
accumulateSupporter(Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);
//accumulateSupporter(Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);
//accumulateSupporter(Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);
// read out surftipp array and create property entries
- Iterator k = ranking.scores(false);
+ Iterator<String> k = ranking.scores(false);
int i = 0;
kelondroRow.Entry row;
String url, urlhash, refid, title, description;
boolean voted;
while (k.hasNext()) {
- urlhash = (String) k.next();
+ urlhash = k.next();
if (urlhash == null) continue;
- row = (kelondroRow.Entry) Supporter.get(urlhash);
+ row = Supporter.get(urlhash);
if (row == null) continue;
url = row.getColString(0, null);
@@ -167,13 +168,13 @@ public class Supporter {
return (int) Math.max(0, 10 - ((System.currentTimeMillis() - created.getTime()) / 24 / 60 / 60 / 1000));
}
- private static void accumulateVotes(HashMap negativeHashes, HashMap positiveHashes, int dbtype) {
+ private static void accumulateVotes(HashMap<String, Integer> negativeHashes, HashMap<String, Integer> positiveHashes, int dbtype) {
int maxCount = Math.min(1000, yacyCore.newsPool.size(dbtype));
yacyNewsRecord record;
- Iterator recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
+ Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
int j = 0;
while ((recordIterator.hasNext()) && (j++ < maxCount)) {
- record = (yacyNewsRecord) recordIterator.next();
+ record = recordIterator.next();
if (record == null) continue;
if (record.category().equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {
@@ -181,12 +182,12 @@ public class Supporter {
String vote = record.attribute("vote", "");
int factor = ((dbtype == yacyNewsPool.OUTGOING_DB) || (dbtype == yacyNewsPool.PUBLISHED_DB)) ? 2 : 1;
if (vote.equals("negative")) {
- Integer i = (Integer) negativeHashes.get(urlhash);
+ Integer i = negativeHashes.get(urlhash);
if (i == null) negativeHashes.put(urlhash, new Integer(factor));
else negativeHashes.put(urlhash, new Integer(i.intValue() + factor));
}
if (vote.equals("positive")) {
- Integer i = (Integer) positiveHashes.get(urlhash);
+ Integer i = positiveHashes.get(urlhash);
if (i == null) positiveHashes.put(urlhash, new Integer(factor));
else positiveHashes.put(urlhash, new Integer(i.intValue() + factor));
}
@@ -195,11 +196,11 @@ public class Supporter {
}
private static void accumulateSupporter(
- HashMap Supporter, kelondroMScoreCluster ranking, kelondroRow rowdef,
- HashMap negativeHashes, HashMap positiveHashes, int dbtype) {
+ HashMap<String, Entry> Supporter, kelondroMScoreCluster<String> ranking, kelondroRow rowdef,
+ HashMap<String, Integer> negativeHashes, HashMap<String, Integer> positiveHashes, int dbtype) {
int maxCount = Math.min(1000, yacyCore.newsPool.size(dbtype));
yacyNewsRecord record;
- Iterator recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
+ Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
int j = 0;
String url = "", urlhash;
kelondroRow.Entry entry;
@@ -207,7 +208,7 @@ public class Supporter {
Integer vote;
yacySeed seed;
while ((recordIterator.hasNext()) && (j++ < maxCount)) {
- record = (yacyNewsRecord) recordIterator.next();
+ record = recordIterator.next();
if (record == null) continue;
entry = null;
@@ -254,10 +255,10 @@ public class Supporter {
System.out.println("Supporter: bad url '" + url + "' from news record " + record.toString());
continue;
}
- if ((vote = (Integer) negativeHashes.get(urlhash)) != null) {
+ if ((vote = negativeHashes.get(urlhash)) != null) {
score = Math.max(0, score - vote.intValue()); // do not go below zero
}
- if ((vote = (Integer) positiveHashes.get(urlhash)) != null) {
+ if ((vote = positiveHashes.get(urlhash)) != null) {
score += 2 * vote.intValue();
}
// consider double-entries
diff --git a/htroot/Surftips.java b/htroot/Surftips.java
index 6378636fb..13ff746dc 100644
--- a/htroot/Surftips.java
+++ b/htroot/Surftips.java
@@ -33,8 +33,9 @@ import java.util.Iterator;
import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroMScoreCluster;
-import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroNaturalOrder;
+import de.anomic.kelondro.kelondroRow;
+import de.anomic.kelondro.kelondroRow.Entry;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverDate;
@@ -82,7 +83,7 @@ public class Surftips {
return prop;
}
// make new news message with voting
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("urlhash", hash);
map.put("vote", "negative");
map.put("refid", post.get("refid", ""));
@@ -94,7 +95,7 @@ public class Surftips {
return prop;
}
// make new news message with voting
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("urlhash", hash);
map.put("url", crypt.simpleDecode(post.get("url", ""), null));
map.put("title", crypt.simpleDecode(post.get("title", ""), null));
@@ -106,29 +107,29 @@ public class Surftips {
}
// create surftips
- HashMap negativeHashes = new HashMap(); // a mapping from an url hash to Integer (count of votes)
- HashMap positiveHashes = new HashMap(); // a mapping from an url hash to Integer (count of votes)
+ HashMap<String, Integer> negativeHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)
+ HashMap<String, Integer> positiveHashes = new HashMap<String, Integer>(); // a mapping from an url hash to Integer (count of votes)
accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);
//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);
//accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);
kelondroMScoreCluster<String> ranking = new kelondroMScoreCluster<String>(); // score cluster for url hashes
kelondroRow rowdef = new kelondroRow("String url-255, String title-120, String description-120, String refid-" + (serverDate.PATTERN_SHORT_SECOND.length() + 12), kelondroNaturalOrder.naturalOrder, 0);
- HashMap surftips = new HashMap(); // a mapping from an url hash to a kelondroRow.Entry with display properties
+ HashMap<String, Entry> surftips = new HashMap<String, Entry>(); // a mapping from an url hash to a kelondroRow.Entry with display properties
accumulateSurftips(surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB);
//accumulateSurftips(surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB);
//accumulateSurftips(surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB);
// read out surftipp array and create property entries
- Iterator k = ranking.scores(false);
+ Iterator<String> k = ranking.scores(false);
int i = 0;
kelondroRow.Entry row;
String url, urlhash, refid, title, description;
boolean voted;
while (k.hasNext()) {
- urlhash = (String) k.next();
+ urlhash = k.next();
if (urlhash == null) continue;
- row = (kelondroRow.Entry) surftips.get(urlhash);
+ row = surftips.get(urlhash);
if (row == null) continue;
url = row.getColString(0, null);
@@ -176,13 +177,13 @@ public class Surftips {
return (int) Math.max(0, 10 - ((System.currentTimeMillis() - created.getTime()) / 24 / 60 / 60 / 1000));
}
- private static void accumulateVotes(HashMap negativeHashes, HashMap positiveHashes, int dbtype) {
+ private static void accumulateVotes(HashMap<String, Integer> negativeHashes, HashMap<String, Integer> positiveHashes, int dbtype) {
int maxCount = Math.min(1000, yacyCore.newsPool.size(dbtype));
yacyNewsRecord record;
- Iterator recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
+ Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
int j = 0;
while ((recordIterator.hasNext()) && (j++ < maxCount)) {
- record = (yacyNewsRecord) recordIterator.next();
+ record = recordIterator.next();
if (record == null) continue;
if (record.category().equals(yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {
@@ -190,12 +191,12 @@ public class Surftips {
String vote = record.attribute("vote", "");
int factor = ((dbtype == yacyNewsPool.OUTGOING_DB) || (dbtype == yacyNewsPool.PUBLISHED_DB)) ? 2 : 1;
if (vote.equals("negative")) {
- Integer i = (Integer) negativeHashes.get(urlhash);
+ Integer i = negativeHashes.get(urlhash);
if (i == null) negativeHashes.put(urlhash, new Integer(factor));
else negativeHashes.put(urlhash, new Integer(i.intValue() + factor));
}
if (vote.equals("positive")) {
- Integer i = (Integer) positiveHashes.get(urlhash);
+ Integer i = positiveHashes.get(urlhash);
if (i == null) positiveHashes.put(urlhash, new Integer(factor));
else positiveHashes.put(urlhash, new Integer(i.intValue() + factor));
}
@@ -204,18 +205,18 @@ public class Surftips {
}
private static void accumulateSurftips(
- HashMap surftips, kelondroMScoreCluster ranking, kelondroRow rowdef,
- HashMap negativeHashes, HashMap positiveHashes, int dbtype) {
+ HashMap<String, Entry> surftips, kelondroMScoreCluster<String> ranking, kelondroRow rowdef,
+ HashMap<String, Integer> negativeHashes, HashMap<String, Integer> positiveHashes, int dbtype) {
int maxCount = Math.min(1000, yacyCore.newsPool.size(dbtype));
yacyNewsRecord record;
- Iterator recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
+ Iterator<yacyNewsRecord> recordIterator = yacyCore.newsPool.recordIterator(dbtype, true);
int j = 0;
String url = "", urlhash;
kelondroRow.Entry entry;
int score = 0;
Integer vote;
while ((recordIterator.hasNext()) && (j++ < maxCount)) {
- record = (yacyNewsRecord) recordIterator.next();
+ record = recordIterator.next();
if (record == null) continue;
entry = null;
@@ -316,10 +317,10 @@ public class Surftips {
System.out.println("Surftips: bad url '" + url + "' from news record " + record.toString());
continue;
}
- if ((vote = (Integer) negativeHashes.get(urlhash)) != null) {
+ if ((vote = negativeHashes.get(urlhash)) != null) {
score = Math.max(0, score - vote.intValue()); // do not go below zero
}
- if ((vote = (Integer) positiveHashes.get(urlhash)) != null) {
+ if ((vote = positiveHashes.get(urlhash)) != null) {
score += 2 * vote.intValue();
}
// consider double-entries
diff --git a/htroot/TestApplet.java b/htroot/TestApplet.java
index d56babe3b..439f25e13 100644
--- a/htroot/TestApplet.java
+++ b/htroot/TestApplet.java
@@ -69,11 +69,11 @@ public class TestApplet {
prop.put("text", "");
return prop;
}
- Iterator it=tp.keySet().iterator();
- StringBuffer tmp=new StringBuffer();
- String key="";
+ Iterator<String> it = tp.keySet().iterator();
+ StringBuffer tmp = new StringBuffer();
+ String key = "";
while(it.hasNext()){
- key=(String)it.next();
+ key = it.next();
tmp.append(key).append("=").append(tp.get(key)).append("\n");
}
prop.put("mode_templates", tmp.toString());
diff --git a/htroot/User_p.java b/htroot/User_p.java
index d392ff148..d825bccd0 100644
--- a/htroot/User_p.java
+++ b/htroot/User_p.java
@@ -133,11 +133,11 @@ public class User_p {
String address=(String)post.get("address");
String timeLimit=(String)post.get("timelimit");
String timeUsed=(String)post.get("timeused");
- HashMap rightsSet=new HashMap();
+ HashMap<String, String> rightsSet=new HashMap<String, String>();
for(i=0;i<rights.length;i++){
rightsSet.put(rights[i], post.containsKey(rights[i])&&((String)post.get(rights[i])).equals("on") ? "true" : "false");
}
- HashMap mem=new HashMap();
+ HashMap<String, String> mem=new HashMap<String, String>();
if( post.get("current_user").equals("newuser")){ //new user
if(!pw.equals("")){ //change only if set
@@ -149,7 +149,7 @@ public class User_p {
mem.put(userDB.Entry.TIME_LIMIT, timeLimit);
mem.put(userDB.Entry.TIME_USED, timeUsed);
for(i=0;i<rights.length;i++)
- mem.put(rights[i], (String)rightsSet.get(rights[i]));
+ mem.put(rights[i], rightsSet.get(rights[i]));
try{
entry=sb.userDB.createEntry(username, mem);
@@ -175,7 +175,7 @@ public class User_p {
entry.setProperty(userDB.Entry.TIME_LIMIT, timeLimit);
entry.setProperty(userDB.Entry.TIME_USED, timeUsed);
for(i=0;i<rights.length;i++)
- entry.setProperty(rights[i], (String)rightsSet.get(rights[i]));
+ entry.setProperty(rights[i], rightsSet.get(rights[i]));
}catch (IOException e){
}
}else{
@@ -188,10 +188,10 @@ public class User_p {
}
//Generate Userlist
- Iterator it = sb.userDB.iterator(true);
+ Iterator<userDB.Entry> it = sb.userDB.iterator(true);
int numUsers=0;
while(it.hasNext()){
- entry = (userDB.Entry)it.next();
+ entry = it.next();
prop.putHTML("users_"+numUsers+"_user", entry.getUserName());
numUsers++;
}
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java
index d3cc0aab8..3178d6979 100644
--- a/htroot/ViewImage.java
+++ b/htroot/ViewImage.java
@@ -59,7 +59,7 @@ import de.anomic.ymage.ymageImageParser;
public class ViewImage {
- private static HashMap iconcache = new HashMap();
+ private static HashMap<String, Image> iconcache = new HashMap<String, Image>();
private static String defaulticon = "htroot/env/grafics/dfltfvcn.ico";
public static Image respond(httpHeader header, serverObjects post, serverSwitch env) {
@@ -96,7 +96,7 @@ public class ViewImage {
int timeout = post.getInt("timeout", 5000);
// getting the image as stream
- Image scaled = (Image) iconcache.get(urlString);
+ Image scaled = iconcache.get(urlString);
if (scaled == null) {
Object[] resource = plasmaSnippetCache.getResource(url, true, timeout, false);
byte[] imgb = null;
diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java
index ce78a56e1..e82ccad99 100644
--- a/htroot/ViewProfile.java
+++ b/htroot/ViewProfile.java
@@ -68,6 +68,7 @@ import de.anomic.yacy.yacySeed;
public class ViewProfile {
+ @SuppressWarnings("unchecked")
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
// listManager.switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
@@ -142,7 +143,7 @@ public class ViewProfile {
}
Map.Entry entry;
// all known keys which should be set as they are
- HashSet knownKeys = new HashSet();
+ HashSet<String> knownKeys = new HashSet<String>();
knownKeys.add("name");
knownKeys.add("nickname");
// knownKeys.add("homepage");//+http
@@ -155,9 +156,9 @@ public class ViewProfile {
knownKeys.add("comment");
//empty values
- Iterator it = knownKeys.iterator();
+ Iterator<String> it = knownKeys.iterator();
while (it.hasNext()) {
- prop.put("success_" + (String) it.next(), "0");
+ prop.put("success_" + it.next(), "0");
}
//number of not explicitly recognized but displayed items
diff --git a/htroot/WatchWebStructure_p.java b/htroot/WatchWebStructure_p.java
index ce1331d0f..693e126d1 100644
--- a/htroot/WatchWebStructure_p.java
+++ b/htroot/WatchWebStructure_p.java
@@ -31,10 +31,10 @@ public class WatchWebStructure_p {
if (host.equals("auto")) {
// try to find the host from the crawl profiles
- Iterator it = sb.profilesActiveCrawls.profiles(true);
+ Iterator<entry> it = sb.profilesActiveCrawls.profiles(true);
entry e;
while (it.hasNext()) {
- e = (entry)it.next();
+ e = it.next();
if (e.name().equals(plasmaSwitchboard.CRAWL_PROFILE_PROXY) ||
e.name().equals(plasmaSwitchboard.CRAWL_PROFILE_REMOTE) ||
e.name().equals(plasmaSwitchboard.CRAWL_PROFILE_SNIPPET_TEXT) ||
diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.java
index 392134241..36a55a243 100644
--- a/htroot/WebStructurePicture_p.java
+++ b/htroot/WebStructurePicture_p.java
@@ -124,21 +124,21 @@ public class WebStructurePicture_p {
if (nextlayer == maxlayer) return mynodes;
nextlayer++;
double radius = 1.0 / (1 << nextlayer);
- Map next = structure.references(centerhash);
- Map.Entry entry;
+ Map<String, Integer> next = structure.references(centerhash);
+ Map.Entry<String, Integer> entry;
String targethash, targethost;
// first set points to next hosts
- Iterator i = next.entrySet().iterator();
- ArrayList targets = new ArrayList();
+ Iterator<Map.Entry<String, Integer>> i = next.entrySet().iterator();
+ ArrayList<String[]> targets = new ArrayList<String[]>();
int maxtargetrefs = 8, maxthisrefs = 8;
int targetrefs, thisrefs;
double rr, re;
while ((i.hasNext()) && (maxnodes > 0) && (System.currentTimeMillis() < timeout)) {
- entry = (Map.Entry) i.next();
- targethash = (String) entry.getKey();
+ entry = i.next();
+ targethash = entry.getKey();
targethost = structure.resolveDomHash2DomString(targethash);
if (targethost == null) continue;
- thisrefs = ((Integer) entry.getValue()).intValue();
+ thisrefs = entry.getValue().intValue();
targetrefs = structure.referencesCount(targethash); // can be cpu/time-critical
maxtargetrefs = Math.max(targetrefs, maxtargetrefs);
maxthisrefs = Math.max(thisrefs, maxthisrefs);
@@ -154,11 +154,11 @@ public class WebStructurePicture_p {
mynodes++;
}
// recursively set next hosts
- i = targets.iterator();
+ Iterator<String[]> j = targets.iterator();
String[] target;
int nextnodes;
- while (i.hasNext()) {
- target = (String[]) i.next();
+ while (j.hasNext()) {
+ target = j.next();
targethash = target[0];
targethost = target[1];
ymageGraph.coordinate c = graph.getPoint(targethost);
diff --git a/htroot/Wiki.java b/htroot/Wiki.java
index f28058028..aed83eca7 100644
--- a/htroot/Wiki.java
+++ b/htroot/Wiki.java
@@ -132,7 +132,7 @@ public class Wiki {
wikiBoard.entry newEntry = switchboard.wikiDB.newEntry(pagename, author, ip, post.get("reason", "edit"), content);
switchboard.wikiDB.write(newEntry);
// create a news message
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("page", pagename);
map.put("author", author.replace(',', ' '));
if (post.get("content", "").trim().length() > 0 && !page.page().equals(content))
@@ -174,11 +174,11 @@ public class Wiki {
prop.put("mode", "3"); //Index
String subject;
try {
- Iterator i = switchboard.wikiDB.keys(true);
+ Iterator<String> i = switchboard.wikiDB.keys(true);
wikiBoard.entry entry;
int count=0;
while (i.hasNext()) {
- subject = (String) i.next();
+ subject = i.next();
entry = switchboard.wikiDB.read(subject);
prop.putHTML("mode_pages_"+count+"_name",wikiBoard.webalize(subject));
prop.putHTML("mode_pages_"+count+"_subject", subject);
@@ -201,14 +201,14 @@ public class Wiki {
prop.putHTML("mode_error_page", pagename);
try {
- Iterator it = switchboard.wikiDB.keysBkp(true);
+ Iterator<String> it = switchboard.wikiDB.keysBkp(true);
wikiBoard.entry entry;
wikiBoard.entry oentry = null;
wikiBoard.entry nentry = null;
int count = 0;
boolean oldselected = false, newselected = false;
while (it.hasNext()) {
- entry = switchboard.wikiDB.readBkp((String)it.next());
+ entry = switchboard.wikiDB.readBkp(it.next());
prop.put("mode_error_versions_" + count + "_date", wikiBoard.dateString(entry.date()));
prop.put("mode_error_versions_" + count + "_fdate", dateString(entry.date()));
if (wikiBoard.dateString(entry.date()).equals(post.get("old", null))) {
diff --git a/htroot/rct_p.java b/htroot/rct_p.java
index d0e29b557..0191d1bca 100644
--- a/htroot/rct_p.java
+++ b/htroot/rct_p.java
@@ -106,9 +106,9 @@ public class rct_p {
yacySeed seed;
int hc = 0;
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0) {
- Iterator e = yacyCore.dhtAgent.getProvidesRemoteCrawlURLs();
+ Iterator<yacySeed> e = yacyCore.dhtAgent.getProvidesRemoteCrawlURLs();
while (e.hasNext()) {
- seed = (yacySeed) e.next();
+ seed = e.next();
if (seed != null) {
prop.put("hosts_" + hc + "_hosthash", seed.hash);
prop.putHTML("hosts_" + hc + "_hostname", seed.hash + " " + seed.get(yacySeed.NAME, "nameless") + " (" + seed.getLong(yacySeed.RCOUNT, 0) + ")");
diff --git a/htroot/robots.java b/htroot/robots.java
index 054ef3988..69fbea406 100644
--- a/htroot/robots.java
+++ b/htroot/robots.java
@@ -48,6 +48,7 @@ public class robots {
return prop;
}
+ @SuppressWarnings("unchecked")
private static ArrayList<String>[] getFiles(String htrootPath) {
final File htroot = new File(htrootPath);
if (!htroot.exists()) return null;
diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.java
index 0205a9b6b..6418e841d 100644
--- a/htroot/sharedBlacklist_p.java
+++ b/htroot/sharedBlacklist_p.java
@@ -93,7 +93,7 @@ public class sharedBlacklist_p {
prop.put("page_target", selectedBlacklistName);
if (post != null) {
- ArrayList otherBlacklist = null;
+ ArrayList<String> otherBlacklist = null;
if (post.containsKey("hash")) {
/* ======================================================
@@ -232,7 +232,7 @@ public class sharedBlacklist_p {
// generate the html list
if (otherBlacklist != null) {
// loading the current blacklist content
- HashSet Blacklist = new HashSet(listManager.getListArray(new File(listManager.listsPath, selectedBlacklistName)));
+ HashSet<String> Blacklist = new HashSet<String>(listManager.getListArray(new File(listManager.listsPath, selectedBlacklistName)));
// sort the loaded blacklist
String[] sortedlist = (String[])otherBlacklist.toArray(new String[otherBlacklist.size()]);
diff --git a/htroot/xml/blacklists_p.java b/htroot/xml/blacklists_p.java
index 01fdf1f8c..ddc570b41 100644
--- a/htroot/xml/blacklists_p.java
+++ b/htroot/xml/blacklists_p.java
@@ -38,7 +38,7 @@ public class blacklists_p {
String[] dirlist = listManager.getDirListing(listManager.listsPath);
int blacklistCount=0;
- ArrayList list;
+ ArrayList<String> list;
int count;
if (dirlist != null) {
for (int i = 0; i <= dirlist.length - 1; i++) {
diff --git a/htroot/xml/bookmarks/posts/all.java b/htroot/xml/bookmarks/posts/all.java
index 780d41503..6396ac2cb 100644
--- a/htroot/xml/bookmarks/posts/all.java
+++ b/htroot/xml/bookmarks/posts/all.java
@@ -63,7 +63,7 @@ public class all {
boolean isAdmin=switchboard.verifyAuthentication(header, true);
serverObjects prop = new serverObjects();
- Iterator it;
+ Iterator<String> it;
if(post != null && post.containsKey("tag")){
it=switchboard.bookmarksDB.getBookmarksIterator((String) post.get("tag"), isAdmin);
}else{
diff --git a/htroot/xml/bookmarks/posts/get.java b/htroot/xml/bookmarks/posts/get.java
index 560e1c9a0..ceb5d6123 100644
--- a/htroot/xml/bookmarks/posts/get.java
+++ b/htroot/xml/bookmarks/posts/get.java
@@ -63,11 +63,11 @@ public class get {
parsedDate = new Date();
}
- ArrayList bookmark_hashes=switchboard.bookmarksDB.getDate(Long.toString(parsedDate.getTime())).getBookmarkList();
- Iterator it=bookmark_hashes.iterator();
+ ArrayList<String> bookmark_hashes=switchboard.bookmarksDB.getDate(Long.toString(parsedDate.getTime())).getBookmarkList();
+ Iterator<String> it=bookmark_hashes.iterator();
bookmarksDB.Bookmark bookmark=null;
while(it.hasNext()){
- bookmark=switchboard.bookmarksDB.getBookmark((String) it.next());
+ bookmark=switchboard.bookmarksDB.getBookmark(it.next());
if(serverDate.formatISO8601(new Date(bookmark.getTimeStamp())) == date &&
tag==null || bookmark.getTags().contains(tag) &&
isAdmin || bookmark.getPublic()){
diff --git a/htroot/xml/bookmarks/tags/get.java b/htroot/xml/bookmarks/tags/get.java
index 28377a527..27ced8ca6 100644
--- a/htroot/xml/bookmarks/tags/get.java
+++ b/htroot/xml/bookmarks/tags/get.java
@@ -62,11 +62,11 @@ public class get {
boolean isAdmin=switchboard.verifyAuthentication(header, true);
serverObjects prop = new serverObjects();
- Iterator it=switchboard.bookmarksDB.getTagIterator(isAdmin);
+ Iterator<bookmarksDB.Tag> it = switchboard.bookmarksDB.getTagIterator(isAdmin);
int count=0;
bookmarksDB.Tag tag;
- while(it.hasNext()){
- tag=(bookmarksDB.Tag)it.next();
+ while (it.hasNext()) {
+ tag = it.next();
prop.put("tags_"+count+"_name", tag.getTagName());
prop.put("tags_"+count+"_count", tag.size());
count++;
diff --git a/htroot/xml/bookmarks/xbel/xbel.java b/htroot/xml/bookmarks/xbel/xbel.java
index fcc6d85f2..3ce97e581 100644
--- a/htroot/xml/bookmarks/xbel/xbel.java
+++ b/htroot/xml/bookmarks/xbel/xbel.java
@@ -53,9 +53,9 @@ public class xbel {
count++;
prop.put("xbel_"+count+"_elements", "<title>"+fn.replaceFirst(root+"/*","")+"</title>");
count++;
- Iterator bit=switchboard.bookmarksDB.getBookmarksIterator(fn, isAdmin);
+ Iterator<String> bit=switchboard.bookmarksDB.getBookmarksIterator(fn, isAdmin);
while(bit.hasNext()){
- bookmark=switchboard.bookmarksDB.getBookmark((String)bit.next());
+ bookmark=switchboard.bookmarksDB.getBookmark(bit.next());
prop.put("xbel_"+count+"_elements", "<bookmark id=\""+bookmark.getUrlHash()+"\" href=\""+bookmark.getUrl()+"\">");
count++;
prop.put("xbel_"+count+"_elements", "<title>"+bookmark.getTitle()+"</title>");
diff --git a/htroot/xml/config_p.java b/htroot/xml/config_p.java
index c6b22c552..8a13659ed 100644
--- a/htroot/xml/config_p.java
+++ b/htroot/xml/config_p.java
@@ -49,9 +49,9 @@ public class config_p {
}
}
- Iterator keys = env.configKeys();
+ Iterator<String> keys = env.configKeys();
- List list = new ArrayList(250);
+ List<String> list = new ArrayList<String>(250);
while(keys.hasNext()){
list.add(keys.next());
}
diff --git a/htroot/xml/queues_p.java b/htroot/xml/queues_p.java
index 15e8e8321..14bff25a2 100644
--- a/htroot/xml/queues_p.java
+++ b/htroot/xml/queues_p.java
@@ -98,7 +98,7 @@ public class queues_p {
int inProcessCount = 0;
long totalSize = 0;
int i=0; //counter
- ArrayList entryList = new ArrayList();
+ ArrayList<plasmaSwitchboardQueue.Entry> entryList = new ArrayList<plasmaSwitchboardQueue.Entry>();
// getting all entries that are currently in process
synchronized (sb.indexingTasksInProcess) {
@@ -108,8 +108,8 @@ public class queues_p {
// getting all enqueued entries
if ((sb.sbQueue.size() > 0)) {
- Iterator i1 = sb.sbQueue.entryIterator(false);
- while (i1.hasNext()) entryList.add((plasmaSwitchboardQueue.Entry) i1.next());
+ Iterator<plasmaSwitchboardQueue.Entry> i1 = sb.sbQueue.entryIterator(false);
+ while (i1.hasNext()) entryList.add(i1.next());
}
int size = (post == null) ? entryList.size() : post.getInt("num", entryList.size());
diff --git a/htroot/xml/webstructure.java b/htroot/xml/webstructure.java
index a254d88c1..6b67e1672 100644
--- a/htroot/xml/webstructure.java
+++ b/htroot/xml/webstructure.java
@@ -41,28 +41,28 @@ public class webstructure {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
serverObjects prop = new serverObjects();
plasmaSwitchboard sb = (plasmaSwitchboard) env;
- Iterator i = sb.webStructure.structureEntryIterator();
+ Iterator<plasmaWebStructure.structureEntry> i = sb.webStructure.structureEntryIterator();
int c = 0, d;
plasmaWebStructure.structureEntry sentry;
- Map.Entry refentry;
+ Map.Entry<String, Integer> refentry;
String refdom, refhash;
Integer refcount;
- Iterator k;
+ Iterator<Map.Entry<String, Integer>> k;
while (i.hasNext()) {
- sentry = (plasmaWebStructure.structureEntry) i.next();
+ sentry = i.next();
prop.put("domains_" + c + "_hash", sentry.domhash);
prop.put("domains_" + c + "_domain", sentry.domain);
prop.put("domains_" + c + "_date", sentry.date);
k = sentry.references.entrySet().iterator();
d = 0;
refloop: while (k.hasNext()) {
- refentry = (Map.Entry) k.next();
- refhash = (String) refentry.getKey();
+ refentry = k.next();
+ refhash = refentry.getKey();
refdom = sb.webStructure.resolveDomHash2DomString(refhash);
if (refdom == null) continue refloop;
prop.put("domains_" + c + "_citations_" + d + "_refhash", refhash);
prop.put("domains_" + c + "_citations_" + d + "_refdom", refdom);
- refcount = (Integer) refentry.getValue();
+ refcount = refentry.getValue();
prop.put("domains_" + c + "_citations_" + d + "_refcount", refcount.intValue());
d++;
}
diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java
index 85b084eb8..308fb1201 100644
--- a/source/de/anomic/data/bookmarksDB.java
+++ b/source/de/anomic/data/bookmarksDB.java
@@ -89,7 +89,7 @@ import de.anomic.yacy.yacyURL;
public class bookmarksDB {
// ------------------------------------
- // Declacration of Class-Attributes
+ // Declaration of Class-Attributes
// ------------------------------------
final static int SORT_ALPHA = 1;
@@ -98,7 +98,6 @@ public class bookmarksDB {
// bookmarks
kelondroObjects bookmarksTable; // kelondroMap bookmarksTable;
- HashMap bookmarkCache;
// tags
kelondroMapObjects tagsTable;
@@ -115,7 +114,6 @@ public class bookmarksDB {
public bookmarksDB(File bookmarksFile, File tagsFile, File datesFile, long preloadTime) {
// bookmarks
tagCache=new HashMap<String, Tag>();
- bookmarkCache=new HashMap();
bookmarksFile.getParentFile().mkdirs();
//this.bookmarksTable = new kelondroMap(kelondroDyn.open(bookmarksFile, bufferkb * 1024, preloadTime, 12, 256, '_', true, false));
this.bookmarksTable = new kelondroObjects(new kelondroDyn(bookmarksFile, true, true, preloadTime, 12, 256, '_', kelondroNaturalOrder.naturalOrder, true, false, false), 1000);
@@ -240,6 +238,7 @@ public class bookmarksDB {
return bookmark.getUrlHash();
}
+
public Bookmark getBookmark(String urlHash){
try {
kelondroObjectsMapEntry map = (kelondroObjectsMapEntry)bookmarksTable.get(urlHash);
@@ -250,14 +249,15 @@ public class bookmarksDB {
return null;
}
}
+
public boolean removeBookmark(String urlHash){
Bookmark bookmark = getBookmark(urlHash);
if(bookmark == null) return false; //does not exist
- Set tags = bookmark.getTags();
+ Set<String> tags = bookmark.getTags();
bookmarksDB.Tag tag=null;
- Iterator it=tags.iterator();
+ Iterator<String> it=tags.iterator();
while(it.hasNext()){
- tag=getTag( tagHash((String) it.next()) );
+ tag=getTag(tagHash(it.next()));
if(tag!=null){
tag.delete(urlHash);
saveTag(tag);
@@ -272,19 +272,18 @@ public class bookmarksDB {
}
return b != null;
}
- public Iterator bookmarkIterator(boolean up){
-
+
+ public Iterator<Bookmark> bookmarkIterator(boolean up){
try {
return new bookmarkIterator(up);
} catch (IOException e) {
- return new HashSet().iterator();
+ return new HashSet<Bookmark>().iterator();
}
-
-
}
+
public Iterator<String> getBookmarksIterator(boolean priv){
TreeSet<String> set=new TreeSet<String>(new bookmarkComparator(true));
- Iterator it=bookmarkIterator(true);
+ Iterator<Bookmark> it=bookmarkIterator(true);
Bookmark bm;
while(it.hasNext()){
bm=(Bookmark)it.next();
@@ -861,7 +860,7 @@ public class bookmarksDB {
public String getDateString(){
return date;
}
- public ArrayList getBookmarkList(){
+ public ArrayList<String> getBookmarkList(){
return listManager.string2arraylist(this.mem.get(URL_HASHES));
}
public int size(){
diff --git a/source/de/anomic/index/indexRWIEntry.java b/source/de/anomic/index/indexRWIEntry.java
index b8429aa59..7f1c4b2db 100644
--- a/source/de/anomic/index/indexRWIEntry.java
+++ b/source/de/anomic/index/indexRWIEntry.java
@@ -83,6 +83,8 @@ public interface indexRWIEntry {
public kelondroBitfield flags();
+ public double termFrequency();
+
public String toString();
public void combineDistance(indexRWIEntry oe);
diff --git a/source/de/anomic/index/indexRWIEntryOrder.java b/source/de/anomic/index/indexRWIEntryOrder.java
index 9dbf05145..9e8b5b05e 100644
--- a/source/de/anomic/index/indexRWIEntryOrder.java
+++ b/source/de/anomic/index/indexRWIEntryOrder.java
@@ -115,10 +115,6 @@ public class indexRWIEntryOrder extends kelondroAbstractOrder<indexRWIVarEntry>
return cardinal(new indexRWIVarEntry(new indexRWIRowEntry(key)));
}
- public static final double termFrequency(indexRWIEntry t) {
- return (((double) t.hitcount()) / ((double) (t.wordsintext() + t.wordsintitle() + 1)));
- }
-
public long cardinal(indexRWIVarEntry t) {
//return Long.MAX_VALUE - preRanking(ranking, iEntry, this.entryMin, this.entryMax, this.searchWords);
// the normalizedEntry must be a normalized indexEntry
diff --git a/source/de/anomic/index/indexRWIRowEntry.java b/source/de/anomic/index/indexRWIRowEntry.java
index 05362d063..3211b887f 100644
--- a/source/de/anomic/index/indexRWIRowEntry.java
+++ b/source/de/anomic/index/indexRWIRowEntry.java
@@ -255,6 +255,10 @@ public final class indexRWIRowEntry implements indexRWIEntry {
return new kelondroBitfield(this.entry.getColBytes(col_flags));
}
+ public double termFrequency() {
+ return (((double) this.hitcount()) / ((double) (this.wordsintext() + this.wordsintitle() + 1)));
+ }
+
public String toString() {
return toPropertyForm();
}
diff --git a/source/de/anomic/index/indexRWIVarEntry.java b/source/de/anomic/index/indexRWIVarEntry.java
index ac8b8c701..838591ba0 100644
--- a/source/de/anomic/index/indexRWIVarEntry.java
+++ b/source/de/anomic/index/indexRWIVarEntry.java
@@ -62,7 +62,7 @@ public class indexRWIVarEntry implements indexRWIEntry {
this.worddistance = e.worddistance();
this.wordsintext = e.wordsintext();
this.wordsintitle = e.wordsintitle();
- this.termFrequency = ((double) e.hitcount()) / ((double) (e.wordsintext() + e.wordsintitle() + 1));
+ this.termFrequency = e.termFrequency();
}
public void combineDistance(indexRWIEntry oe) {
@@ -175,6 +175,7 @@ public class indexRWIVarEntry implements indexRWIEntry {
public static final void min(indexRWIVarEntry t, indexRWIEntry other) {
int v;
long w;
+ double d;
if (t.hitcount() > (v = other.hitcount())) t.hitcount = v;
if (t.llocal() > (v = other.llocal())) t.llocal = v;
if (t.lother() > (v = other.lother())) t.lother = v;
@@ -191,14 +192,13 @@ public class indexRWIVarEntry implements indexRWIEntry {
if (t.urllength() > (v = other.urllength())) t.urllength = v;
if (t.urlcomps() > (v = other.urlcomps())) t.urlcomps = v;
if (t.wordsintitle() > (v = other.wordsintitle())) t.wordsintitle = v;
- double tf = (other instanceof indexRWIVarEntry) ? ((indexRWIVarEntry) other).termFrequency : indexRWIEntryOrder.termFrequency(other);
- if (t.termFrequency > tf) t.termFrequency = tf;
-
+ if (t.termFrequency > (d = other.termFrequency())) t.termFrequency = d;
}
public static final void max(indexRWIVarEntry t, indexRWIEntry other) {
int v;
long w;
+ double d;
if (t.hitcount() < (v = other.hitcount())) t.hitcount = v;
if (t.llocal() < (v = other.llocal())) t.llocal = v;
if (t.lother() < (v = other.lother())) t.lother = v;
@@ -215,8 +215,7 @@ public class indexRWIVarEntry implements indexRWIEntry {
if (t.urllength() < (v = other.urllength())) t.urllength = v;
if (t.urlcomps() < (v = other.urlcomps())) t.urlcomps = v;
if (t.wordsintitle() < (v = other.wordsintitle())) t.wordsintitle = v;
- double tf = (other instanceof indexRWIVarEntry) ? ((indexRWIVarEntry) other).termFrequency : indexRWIEntryOrder.termFrequency(other);
- if (t.termFrequency < tf) t.termFrequency = tf;
+ if (t.termFrequency < (d = other.termFrequency())) t.termFrequency = d;
}
}
diff --git a/source/de/anomic/plasma/plasmaSearchAPI.java b/source/de/anomic/plasma/plasmaSearchAPI.java
index daf5c8c94..c2b17f3a7 100644
--- a/source/de/anomic/plasma/plasmaSearchAPI.java
+++ b/source/de/anomic/plasma/plasmaSearchAPI.java
@@ -33,7 +33,6 @@ import java.util.Iterator;
import de.anomic.data.listManager;
import de.anomic.index.indexRWIEntry;
-import de.anomic.index.indexRWIEntryOrder;
import de.anomic.index.indexURLEntry;
import de.anomic.kelondro.kelondroBitfield;
import de.anomic.plasma.urlPattern.plasmaURLPattern;
@@ -150,7 +149,7 @@ public class plasmaSearchAPI {
prop.putNum("genUrlList_urlList_"+i+"_urlExists_ranking", (entry.ranking() - rn));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_domlength", yacyURL.domLengthEstimation(entry.hash()));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_ybr", plasmaSearchRankingProcess.ybr(entry.hash()));
- prop.putNum("genUrlList_urlList_"+i+"_urlExists_tf", indexRWIEntryOrder.termFrequency(entry.word()));
+ prop.putNum("genUrlList_urlList_"+i+"_urlExists_tf", 1000.0 * entry.word().termFrequency());
prop.putNum("genUrlList_urlList_"+i+"_urlExists_authority", (ranked.getOrder() == null) ? -1 : ranked.getOrder().authority(entry.hash()));
prop.put("genUrlList_urlList_"+i+"_urlExists_date", serverDate.formatShortDay(new Date(entry.word().lastModified())));
prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintitle", entry.word().wordsintitle());
diff --git a/source/de/anomic/plasma/plasmaSearchRankingProfile.java b/source/de/anomic/plasma/plasmaSearchRankingProfile.java
index c40915647..6ca7c850e 100644
--- a/source/de/anomic/plasma/plasmaSearchRankingProfile.java
+++ b/source/de/anomic/plasma/plasmaSearchRankingProfile.java
@@ -97,7 +97,7 @@ public class plasmaSearchRankingProfile {
public plasmaSearchRankingProfile(int mediatype) {
// set default-values
- coeff_domlength = 8;
+ coeff_domlength = 11;
coeff_ybr = 9;
coeff_date = 4;
coeff_wordsintitle = 4;
@@ -105,20 +105,20 @@ public class plasmaSearchRankingProfile {
coeff_phrasesintext = 3;
coeff_llocal = 2;
coeff_lother = 3;
- coeff_urllength = 13;
- coeff_urlcomps = 13;
- coeff_hitcount = 4;
+ coeff_urllength = 12;
+ coeff_urlcomps = 12;
+ coeff_hitcount = 9;
coeff_posintext = 10;
- coeff_posofphrase = 9;
+ coeff_posofphrase = 8;
coeff_posinphrase = 1;
- coeff_authority = 12;
- coeff_worddistance = 13;
+ coeff_authority = 11;
+ coeff_worddistance = 12;
coeff_appurl = 13;
- coeff_appdescr = 11;
- coeff_appauthor = 12;
+ coeff_appdescr = 10;
+ coeff_appauthor = 11;
coeff_apptags = 8;
- coeff_appref = 8;
- coeff_appemph = 11;
+ coeff_appref = 7;
+ coeff_appemph = 10;
coeff_catindexof = (mediatype == plasmaSearchQuery.CONTENTDOM_TEXT) ? 0 : 15;
coeff_cathasimage = (mediatype == plasmaSearchQuery.CONTENTDOM_IMAGE) ? 15 : 0;
coeff_cathasaudio = (mediatype == plasmaSearchQuery.CONTENTDOM_AUDIO) ? 15 : 0;
@@ -127,7 +127,7 @@ public class plasmaSearchRankingProfile {
coeff_termfrequency = 14;
coeff_urlcompintoplist = 3;
coeff_descrcompintoplist = 2;
- coeff_prefer = 13;
+ coeff_prefer = 12;
}
public plasmaSearchRankingProfile(String prefix, String profile) {