Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
moved all Double values to Float values because of http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/ YaCy does not really need double-precision floating point computation anywhere, so this should not affect any feature
orbitereb12e15738f8
diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.javaindex 03aa9c018..a5a81217c 100644--- a/htroot/ConfigUpdate_p.java+++ b/htroot/ConfigUpdate_p.java@@ -156,10 +156,10 @@ public class ConfigUpdate_p {final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();prop.putHTML("candeploy_versionpp", versionstring);final boolean devenvironment = new File(sb.getAppPath(), ".svn").exists();- double thisVersion = Double.parseDouble(yacyBuildProperties.getVersion());+ float thisVersion = Float.parseFloat(yacyBuildProperties.getVersion());// cut off the SVN Rev in the Versiontry {- thisVersion = Math.round(thisVersion*1000.0)/1000.0;+ thisVersion = (float) (Math.round(thisVersion*1000.0)/1000.0);} catch (final NumberFormatException e) {}diff --git a/htroot/Network.java b/htroot/Network.javaindex 50ea93f8e..3590cad0f 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -145,7 +145,7 @@ public class Network {prop.putNum("table_my-qph-publocal", Math.round(6000d * sb.averageQPMPublicLocal()) / 100d);prop.putNum("table_my-qph-pubremote", Math.round(6000d * sb.averageQPMGlobal()) / 100d);prop.putNum("table_my-seeds", Long.parseLong(seed.get(yacySeed.SCOUNT, "0")));- prop.putNum("table_my-connects", Double.parseDouble(seed.get(yacySeed.CCOUNT, "0")));+ prop.putNum("table_my-connects", Float.parseFloat(seed.get(yacySeed.CCOUNT, "0")));prop.put("table_my-url", seed.get(yacySeed.SEEDLISTURL, ""));// generating the location string@@ -383,7 +383,7 @@ public class Network {prop.put(STR_TABLE_LIST + conCount + "_complete_hash", seed.hash);prop.put(STR_TABLE_LIST + conCount + "_complete_age", seed.getAge());prop.putNum(STR_TABLE_LIST + conCount + "_complete_seeds", Long.parseLong(seed.get(yacySeed.SCOUNT, "0")));- prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", Double.parseDouble(seed.get(yacySeed.CCOUNT, "0")));+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", Float.parseFloat(seed.get(yacySeed.CCOUNT, "0")));prop.putHTML(STR_TABLE_LIST + conCount + "_complete_userAgent", userAgent);} else {prop.put(STR_TABLE_LIST + conCount + "_complete", 0);diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.javaindex 25855cf1b..2201e0c04 100644--- a/htroot/PerformanceQueues_p.java+++ b/htroot/PerformanceQueues_p.java@@ -139,7 +139,7 @@ public class PerformanceQueues_p {int c = 0;long idleCycles, busyCycles, memshortageCycles;// set profile?- final double multiplier = (post != null) && post.containsKey("profileSpeed") ? 100.0 / post.getDouble("profileSpeed", 100.0) : 1.0;+ final double multiplier = (post != null) && post.containsKey("profileSpeed") ? 100.0 / post.getFloat("profileSpeed", 100.0f) : 1.0;final boolean setProfile = (post != null && post.containsKey("submitdefault"));final boolean setDelay = (post != null) && (post.containsKey("submitdelay"));// save used settings file to configdiff --git a/htroot/osm.java b/htroot/osm.javaindex f663ac56f..3ae2371ea 100644--- a/htroot/osm.java+++ b/htroot/osm.java@@ -15,15 +15,15 @@ public class osm {public static RasterPlotter respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {int zoom = 10;- double lat = 50.11670d;- double lon = 8.68333d;+ float lat = 50.11670f;+ float lon = 8.68333f;int width = 3;int height = 3;if (post != null) {zoom = post.getInt("zoom", zoom);- lat = post.getDouble("lat", lat);- lon = post.getDouble("lon", lon);+ lat = post.getFloat("lat", lat);+ lon = post.getFloat("lon", lon);width = post.getInt("width", width);height = post.getInt("height", height);}diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.javaindex f0cb692e2..254d29573 100644--- a/source/de/anomic/server/serverObjects.java+++ b/source/de/anomic/server/serverObjects.java@@ -290,11 +290,11 @@ public class serverObjects extends HashMap<String, String> implements Cloneable}}- public double getDouble(final String key, final double dflt) {+ public float getFloat(final String key, final float dflt) {final String s = removeBOM(super.get(key));if (s == null) return dflt;try {- return Double.parseDouble(s);+ return Float.parseFloat(s);} catch (final NumberFormatException e) {return dflt;}diff --git a/source/de/anomic/server/serverSwitch.java b/source/de/anomic/server/serverSwitch.javaindex 2117f4ec5..43c5cff34 100644--- a/source/de/anomic/server/serverSwitch.java+++ b/source/de/anomic/server/serverSwitch.java@@ -271,9 +271,9 @@ public class serverSwitch {}}- public double getConfigDouble(final String key, final double dflt) {+ public double getConfigFloat(final String key, final float dflt) {try {- return Double.parseDouble(getConfig(key, Double.toString(dflt)));+ return Float.parseFloat(getConfig(key, Float.toString(dflt)));} catch (final NumberFormatException e) {return dflt;}diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.javaindex 4c46c5951..33c6d5a49 100644--- a/source/de/anomic/yacy/yacySeed.java+++ b/source/de/anomic/yacy/yacySeed.java@@ -549,11 +549,11 @@ public class yacySeed implements Cloneable {}}- public double getQPM() {+ public float getQPM() {try {- return Double.parseDouble(get(yacySeed.RSPEED, yacySeed.ZERO));+ return Float.parseFloat(get(yacySeed.RSPEED, yacySeed.ZERO));} catch (final NumberFormatException e) {- return 0d;+ return 0f;}}diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.javaindex 64d230154..e726a35b7 100644--- a/source/de/anomic/yacy/yacySeedDB.java+++ b/source/de/anomic/yacy/yacySeedDB.java@@ -457,7 +457,7 @@ public final class yacySeedDB implements AlternativeDomainNames {public long countActiveURL() { return seedActiveDB.getLongAcc(yacySeed.LCOUNT); }public long countActiveRWI() { return seedActiveDB.getLongAcc(yacySeed.ICOUNT); }public long countActivePPM() { return seedActiveDB.getLongAcc(yacySeed.ISPEED); }- public double countActiveQPM() { return seedActiveDB.getDoubleAcc(yacySeed.RSPEED); }+ public float countActiveQPM() { return seedActiveDB.getFloatAcc(yacySeed.RSPEED); }public long countPassiveURL() { return seedPassiveDB.getLongAcc(yacySeed.LCOUNT); }public long countPassiveRWI() { return seedPassiveDB.getLongAcc(yacySeed.ICOUNT); }public long countPotentialURL() { return seedPotentialDB.getLongAcc(yacySeed.LCOUNT); }diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.javaindex c3cf2ff36..4606ffd25 100644--- a/source/de/anomic/yacy/yacyVersion.java+++ b/source/de/anomic/yacy/yacyVersion.java@@ -142,7 +142,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersreturn "dev/00000";}- final String mainversion = (Double.parseDouble(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));+ final String mainversion = (Float.parseFloat(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));String revision = matcher.group(2);for(int i=revision.length();i<5;++i) revision += "0";return mainversion+"/"+revision;diff --git a/source/net/yacy/document/geolocalization/GeonamesLocalization.java b/source/net/yacy/document/geolocalization/GeonamesLocalization.javaindex 9fab02eaa..8cdc78610 100644--- a/source/net/yacy/document/geolocalization/GeonamesLocalization.java+++ b/source/net/yacy/document/geolocalization/GeonamesLocalization.java@@ -112,7 +112,7 @@ public class GeonamesLocalization implements Localization {locnames.add(fields[1]);locnames.add(fields[2]);for (String s: fields[3].split(",")) locnames.add(s);- Location c = new Location(Double.parseDouble(fields[5]), Double.parseDouble(fields[4]), fields[1]);+ Location c = new Location(Float.parseFloat(fields[5]), Float.parseFloat(fields[4]), fields[1]);c.setPopulation((int) Long.parseLong(fields[14]));this.id2loc.put(id, c);for (String name: locnames) {diff --git a/source/net/yacy/document/geolocalization/OpenGeoDBLocalization.java b/source/net/yacy/document/geolocalization/OpenGeoDBLocalization.javaindex 9ee90401c..8a05de5d7 100644--- a/source/net/yacy/document/geolocalization/OpenGeoDBLocalization.java+++ b/source/net/yacy/document/geolocalization/OpenGeoDBLocalization.java@@ -108,11 +108,11 @@ public class OpenGeoDBLocalization implements Localization {line = line.substring(18 + 7);v = line.split(",");v = line.split(",");if (lonlat) {- lon = Double.parseDouble(v[2]);- lat = Double.parseDouble(v[3]);+ lon = Float.parseFloat(v[2]);+ lat = Float.parseFloat(v[3]);} else {- lat = Double.parseDouble(v[2]);- lon = Double.parseDouble(v[3]);+ lat = Float.parseFloat(v[2]);+ lon = Float.parseFloat(v[3]);}id2loc.put(Integer.parseInt(v[0]), new Location(lon, lat));}diff --git a/source/net/yacy/kelondro/blob/MapDataMining.java b/source/net/yacy/kelondro/blob/MapDataMining.javaindex 2fb2ad4ca..5814179e3 100644--- a/source/net/yacy/kelondro/blob/MapDataMining.java+++ b/source/net/yacy/kelondro/blob/MapDataMining.java@@ -46,12 +46,12 @@ import net.yacy.kelondro.util.LookAheadIterator;public class MapDataMining extends MapHeap {private final static Long LONG0 = Long.valueOf(0);- private final static Double DOUBLE0 = Double.valueOf(0.0);+ private final static Float FLOAT0 = Float.valueOf(0.0f);- private final String[] sortfields, longaccfields, doubleaccfields;+ private final String[] sortfields, longaccfields, floataccfields;private Map<String, StaticScore<String>> sortClusterMap; // a String-kelondroMScoreCluster - relationprivate Map<String, Long> accLong; // to store accumulations of Long cells- private Map<String, Double> accDouble; // to store accumulations of Double cells+ private Map<String, Float> accFloat; // to store accumulations of Float cells@SuppressWarnings("unchecked")public MapDataMining(final File heapFile,@@ -61,14 +61,14 @@ public class MapDataMining extends MapHeap {final int cachesize,final String[] sortfields,final String[] longaccfields,- final String[] doubleaccfields,+ final String[] floataccfields,final Object externalHandler) throws IOException {super(heapFile, keylength, ordering, buffermax, cachesize, '_');// create fast ordering clusters and acc fieldsthis.sortfields = sortfields;this.longaccfields = longaccfields;- this.doubleaccfields = doubleaccfields;+ this.floataccfields = floataccfields;ScoreCluster<String>[] cluster = null;if (sortfields == null) sortClusterMap = null; else {@@ -80,7 +80,7 @@ public class MapDataMining extends MapHeap {}Long[] longaccumulator = null;- Double[] doubleaccumulator = null;+ Float[] floataccumulator = null;if (longaccfields == null) {accLong = null;} else {@@ -90,23 +90,23 @@ public class MapDataMining extends MapHeap {longaccumulator[i] = LONG0;}}- if (doubleaccfields == null) {- accDouble = null;+ if (floataccfields == null) {+ accFloat = null;} else {- accDouble = new ConcurrentHashMap<String, Double>();- doubleaccumulator = new Double[doubleaccfields.length];- for (int i = 0; i < doubleaccfields.length; i++) {- doubleaccumulator[i] = DOUBLE0;+ accFloat = new ConcurrentHashMap<String, Float>();+ floataccumulator = new Float[floataccfields.length];+ for (int i = 0; i < floataccfields.length; i++) {+ floataccumulator[i] = FLOAT0;}}// fill cluster and accumulator with values- if ((sortfields != null) || (longaccfields != null) || (doubleaccfields != null)) try {+ if ((sortfields != null) || (longaccfields != null) || (floataccfields != null)) try {final CloneableIterator<byte[]> it = super.keys(true, false);byte[] mapnameb;String cell;long valuel;- double valued;+ float valued;Map<String, String> map;while (it.hasNext()) {mapnameb = it.next();@@ -132,12 +132,12 @@ public class MapDataMining extends MapHeap {} catch (final NumberFormatException e) {}}- if (doubleaccfields != null && doubleaccumulator != null) for (int i = 0; i < doubleaccfields.length; i++) {- cell = map.get(doubleaccfields[i]);- valued = 0d;+ if (floataccfields != null && floataccumulator != null) for (int i = 0; i < floataccfields.length; i++) {+ cell = map.get(floataccfields[i]);+ valued = 0f;if (cell != null) try {- valued = Double.parseDouble(cell);- doubleaccumulator[i] = new Double(doubleaccumulator[i].doubleValue() + valued);+ valued = Float.parseFloat(cell);+ floataccumulator[i] = new Float(floataccumulator[i].floatValue() + valued);} catch (final NumberFormatException e) {}}}@@ -148,7 +148,7 @@ public class MapDataMining extends MapHeap {// fill acc mapif (longaccfields != null && longaccumulator != null) for (int i = 0; i < longaccfields.length; i++) accLong.put(longaccfields[i], longaccumulator[i]);- if (doubleaccfields != null && doubleaccumulator != null) for (int i = 0; i < doubleaccfields.length; i++) accDouble.put(doubleaccfields[i], doubleaccumulator[i]);+ if (floataccfields != null && floataccumulator != null) for (int i = 0; i < floataccfields.length; i++) accFloat.put(floataccfields[i], floataccumulator[i]);}@Override@@ -169,12 +169,12 @@ public class MapDataMining extends MapHeap {accLong.put(longaccfields[i], LONG0);}}- if (doubleaccfields == null) {- accDouble = null;+ if (floataccfields == null) {+ accFloat = null;} else {- accDouble = new HashMap<String, Double>();- for (int i = 0; i < doubleaccfields.length; i++) {- accDouble.put(doubleaccfields[i], DOUBLE0);+ accFloat = new HashMap<String, Float>();+ for (int i = 0; i < floataccfields.length; i++) {+ accFloat.put(floataccfields[i], FLOAT0);}}}@@ -186,7 +186,7 @@ public class MapDataMining extends MapHeap {assert (newMap != null);// update elementCount- if ((longaccfields != null) || (doubleaccfields != null)) {+ if ((longaccfields != null) || (floataccfields != null)) {final Map<String, String> oldMap = super.get(key, false);if (oldMap != null) {// element exists, update acc@@ -206,9 +206,9 @@ public class MapDataMining extends MapHeap {private void updateAcc(final Map<String, String> map, final boolean add) {String value;long valuel;- double valued;+ float valued;Long longaccumulator;- Double doubleaccumulator;+ Float floataccumulator;if (longaccfields != null) for (int i = 0; i < longaccfields.length; i++) {value = map.get(longaccfields[i]);if (value != null) {@@ -223,16 +223,16 @@ public class MapDataMining extends MapHeap {} catch (final NumberFormatException e) {}}}- if (doubleaccfields != null) for (int i = 0; i < doubleaccfields.length; i++) {- value = map.get(doubleaccfields[i]);+ if (floataccfields != null) for (int i = 0; i < floataccfields.length; i++) {+ value = map.get(floataccfields[i]);if (value != null) {try {- valued = Double.parseDouble(value);- doubleaccumulator = accDouble.get(doubleaccfields[i]);+ valued = Float.parseFloat(value);+ floataccumulator = accFloat.get(floataccfields[i]);if (add) {- accDouble.put(doubleaccfields[i], Double.valueOf(doubleaccumulator.doubleValue() + valued));+ accFloat.put(floataccfields[i], Float.valueOf(floataccumulator.floatValue() + valued));} else {- accDouble.put(doubleaccfields[i], Double.valueOf(doubleaccumulator.doubleValue() - valued));+ accFloat.put(floataccfields[i], Float.valueOf(floataccumulator.floatValue() - valued));}} catch (final NumberFormatException e) {}}@@ -257,14 +257,14 @@ public class MapDataMining extends MapHeap {if (key == null) return;// update elementCount- if ((sortfields != null) || (longaccfields != null) || (doubleaccfields != null)) {+ if ((sortfields != null) || (longaccfields != null) || (floataccfields != null)) {Map<String, String> map;try {map = super.get(key);if (map != null) {// update accumulators (subtract)- if ((longaccfields != null) || (doubleaccfields != null)) updateAcc(map, false);+ if ((longaccfields != null) || (floataccfields != null)) updateAcc(map, false);// remove from sortClusterif (sortfields != null) deleteSortCluster(new String(key));@@ -338,10 +338,10 @@ public class MapDataMining extends MapHeap {return accumulator.longValue();}- public synchronized double getDoubleAcc(final String field) {- final Double accumulator = accDouble.get(field);+ public synchronized float getFloatAcc(final String field) {+ final Float accumulator = accFloat.get(field);if (accumulator == null) return -1;- return accumulator.doubleValue();+ return accumulator.floatValue();}@Overridediff --git a/source/net/yacy/kelondro/logging/LogParser.java b/source/net/yacy/kelondro/logging/LogParser.javaindex 96051f0a4..1f55b6c62 100644--- a/source/net/yacy/kelondro/logging/LogParser.java+++ b/source/net/yacy/kelondro/logging/LogParser.java@@ -331,8 +331,8 @@ public final class LogParser {m = i8.matcher (logLine);if (m.find () && m.groupCount() >= 2) {- DHTSelectionWordsCount += Double.parseDouble(m.group(1));- DHTSelectionWordsTimeCount += Double.parseDouble(m.group(2));+ DHTSelectionWordsCount += Float.parseFloat(m.group(1));+ DHTSelectionWordsTimeCount += Float.parseFloat(m.group(2));totalParserTime += (System.currentTimeMillis() - start);totalParserRuns++;return 0;diff --git a/source/net/yacy/kelondro/util/Formatter.java b/source/net/yacy/kelondro/util/Formatter.javaindex 208cfbc25..3c1125fc9 100644--- a/source/net/yacy/kelondro/util/Formatter.java+++ b/source/net/yacy/kelondro/util/Formatter.java@@ -100,7 +100,7 @@ public final class Formatter {if (s.indexOf('.') == -1) {ret = number(Long.parseLong(s));} else {- ret = number(Double.parseDouble(s));+ ret = number(Float.parseFloat(s));}} catch (final NumberFormatException e) { /* empty */ }