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

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7460 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2011-02-01 23:49:11 +00:00
parent fe948abd84
commit eb12e15738
14 changed files with 65 additions and 65 deletions

View File

@ -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 Version
try {
thisVersion = Math.round(thisVersion*1000.0)/1000.0;
thisVersion = (float) (Math.round(thisVersion*1000.0)/1000.0);
} catch (final NumberFormatException e) {}

View File

@ -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);

View File

@ -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 config

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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); }

View File

@ -142,7 +142,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
return "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;

View File

@ -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) {

View File

@ -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));
}

View File

@ -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 - relation
private 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 fields
this.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 map
if (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 sortCluster
if (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();
}
@Override

View File

@ -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;

View File

@ -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 */ }