replaced more appearance of double values by float values

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7461 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent eb12e15738
commit 0cdfb82963

@ -393,7 +393,7 @@ public class Bookmarks {
}
} else {
// font-size is pseudo-rounded to 2 decimals
prop.put("display_"+id+"_"+count+"_size", Math.round((1.1+Math.log(tag.size())/4)*100)/100.);
prop.put("display_"+id+"_"+count+"_size", Math.round((1.1f+Math.log(tag.size())/4f)*100.0f)/100.0f);
}
count++;
}

@ -257,7 +257,7 @@ public class ConfigUpdate_p {
prop.putASIS("hintVersionDownload_versionResMain", (yacyVersion.latestMainRelease == null) ? "-" : yacyVersion.latestMainRelease.toAnchor());
prop.putASIS("hintVersionDownload_versionResDev", (yacyVersion.latestDevRelease == null) ? "-" : yacyVersion.latestDevRelease.toAnchor());
prop.put("hintVersionAvailable_latestVersion", Double.toString(yacyVersion.latestRelease));
prop.put("hintVersionAvailable_latestVersion", Float.toString(yacyVersion.latestRelease));
*/
return prop;

@ -586,8 +586,8 @@ public class yacysearch {
} else {
int i = 0;
for (Location c: coordinates) {
prop.put("geoinfo_loc_" + i + "_lon", Math.round(c.lon() * 10000.0) / 10000.0);
prop.put("geoinfo_loc_" + i + "_lat", Math.round(c.lat() * 10000.0) / 10000.0);
prop.put("geoinfo_loc_" + i + "_lon", Math.round(c.lon() * 10000.0f) / 10000.0f);
prop.put("geoinfo_loc_" + i + "_lat", Math.round(c.lat() * 10000.0f) / 10000.0f);
prop.put("geoinfo_loc_" + i + "_name", c.getName());
i++;
if (i >= 10) break;

@ -218,7 +218,7 @@ public final class Switchboard extends serverSwitch {
public long indexedPages = 0;
public int searchQueriesRobinsonFromLocal = 0; // absolute counter of all local queries submitted on this peer from a local or autheticated used
public int searchQueriesRobinsonFromRemote = 0; // absolute counter of all local queries submitted on this peer from a remote IP without authentication
public double searchQueriesGlobal = 0d; // partial counter of remote queries (1/number-of-requested-peers)
public float searchQueriesGlobal = 0f; // partial counter of remote queries (1/number-of-requested-peers)
public SortedMap<byte[], String> clusterhashes; // map of peerhash(String)/alternative-local-address as ip:port or only ip (String) or null if address in seed should be used
public URLLicense licensedURLs;
public List<Pattern> networkWhitelist, networkBlacklist;
@ -2393,21 +2393,21 @@ public final class Switchboard extends serverSwitch {
return EventTracker.countEvents(EventTracker.EClass.INDEX, 20000) * 3;
}
public double averageQPM() {
public float averageQPM() {
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
return (this.searchQueriesRobinsonFromRemote + this.searchQueriesGlobal) * 60d / Math.max(uptime, 1d);
return (this.searchQueriesRobinsonFromRemote + this.searchQueriesGlobal) * 60f / Math.max(uptime, 1f);
}
public double averageQPMGlobal() {
public float averageQPMGlobal() {
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
return (this.searchQueriesGlobal) * 60d / Math.max(uptime, 1d);
return (this.searchQueriesGlobal) * 60f / Math.max(uptime, 1f);
}
public double averageQPMPrivateLocal() {
public float averageQPMPrivateLocal() {
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
return (this.searchQueriesRobinsonFromLocal) * 60d / Math.max(uptime, 1d);
return (this.searchQueriesRobinsonFromLocal) * 60f / Math.max(uptime, 1f);
}
public double averageQPMPublicLocal() {
public float averageQPMPublicLocal() {
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
return (this.searchQueriesRobinsonFromRemote) * 60d / Math.max(uptime, 1d);
return (this.searchQueriesRobinsonFromRemote) * 60f / Math.max(uptime, 1f);
}
public void updateMySeed() {
@ -2416,14 +2416,14 @@ public final class Switchboard extends serverSwitch {
//the speed of indexing (pages/minute) of the peer
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
peers.mySeed().put(yacySeed.ISPEED, Integer.toString(currentPPM()));
peers.mySeed().put(yacySeed.RSPEED, Double.toString(averageQPM()));
peers.mySeed().put(yacySeed.RSPEED, Float.toString(averageQPM()));
peers.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)
peers.mySeed().put(yacySeed.LCOUNT, Long.toString(indexSegments.URLCount())); // the number of links that the peer has stored (LURL's)
peers.mySeed().put(yacySeed.NCOUNT, Integer.toString(crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)
peers.mySeed().put(yacySeed.RCOUNT, Integer.toString(crawlQueues.noticeURL.stackSize(NoticedURL.StackType.LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)
peers.mySeed().put(yacySeed.ICOUNT, Long.toString(indexSegments.RWICount())); // the minimum number of words that the peer has indexed (as it says)
peers.mySeed().put(yacySeed.SCOUNT, Integer.toString(peers.sizeConnected())); // the number of seeds that the peer has stored
peers.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((peers.sizeConnected() + peers.sizeDisconnected() + peers.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)
peers.mySeed().put(yacySeed.CCOUNT, Float.toString(((int) ((peers.sizeConnected() + peers.sizeDisconnected() + peers.sizePotential()) * 60.0f / (uptime + 1.01f)) * 100.0f) / 100.0f)); // the number of clients that the peer connects (as connects/hour)
peers.mySeed().put(yacySeed.VERSION, yacyBuildProperties.getLongVersion());
peers.mySeed().setFlagDirectConnect(true);
peers.mySeed().setLastSeenUTC();

@ -137,9 +137,9 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
* @param value value as double/float.
* @return value as it was added to the map or <code>NaN</code> if an error occured.
*/
public double put(final String key, final double value) {
if (null == this.put(key, Double.toString(value))) {
return Double.NaN;
public double put(final String key, final float value) {
if (null == this.put(key, Float.toString(value))) {
return Float.NaN;
}
return value;
}

@ -197,8 +197,8 @@ public class serverSwitch {
setConfig(key, Long.toString(value));
}
public void setConfig(final String key, final double value) {
setConfig(key, Double.toString(value));
public void setConfig(final String key, final float value) {
setConfig(key, Float.toString(value));
}
public void setConfig(final String key, final String value) {

@ -35,7 +35,7 @@ public final class yacyBuildProperties {
* returns the long version String (e. g. 0.9106712)
*/
public static String getLongVersion() {
return String.format(Locale.US, "%.3f%05d", Double.valueOf(getVersion()), Integer.valueOf(getSVNRevision()));
return String.format(Locale.US, "%.3f%05d", Float.valueOf(getVersion()), Integer.valueOf(getSVNRevision()));
}
/**

@ -216,19 +216,19 @@ public class JSONArray {
}
/**
* Get the double value associated with an index.
* Get the float value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException If the key is not found or if the value cannot
* be converted to a number.
*/
public double getDouble(int index) throws JSONException {
public double getFloat(int index) throws JSONException {
Object o = get(index);
try {
return o instanceof Number ?
((Number)o).doubleValue() :
Double.valueOf((String)o).doubleValue();
Float.valueOf((String)o).floatValue();
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
@ -246,7 +246,7 @@ public class JSONArray {
public int getInt(int index) throws JSONException {
Object o = get(index);
return o instanceof Number ?
((Number)o).intValue() : (int) getDouble(index);
((Number)o).intValue() : (int) getFloat(index);
}
/**
@ -260,7 +260,7 @@ public class JSONArray {
public long getLong(int index) throws JSONException {
Object o = get(index);
return o instanceof Number ?
((Number)o).longValue() : (long) getDouble(index);
((Number)o).longValue() : (long) getFloat(index);
}

@ -377,14 +377,14 @@ public class JSONObject {
* @param d A double.
* @return A String.
*/
static public String doubleToString(double d) {
static public String floatToString(float d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
String s = Float.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
while (s.endsWith("0")) {
s = s.substring(0, s.length() - 1);
@ -439,18 +439,18 @@ public class JSONObject {
/**
* Get the double value associated with a key.
* Get the float value associated with a key.
* @param key A key string.
* @return The numeric value.
* @throws JSONException if the key is not found or
* if the value is not a Number object and cannot be converted to a number.
*/
public double getDouble(String key) throws JSONException {
public float getFloat(String key) throws JSONException {
Object o = get(key);
try {
return o instanceof Number ?
((Number)o).doubleValue() :
Double.valueOf((String)o).doubleValue();
((Number)o).floatValue() :
Float.valueOf((String)o).floatValue();
} catch (Exception e) {
throw new JSONException("JSONObject[" + quote(key) +
"] is not a number.");
@ -1223,7 +1223,7 @@ public class JSONObject {
try {
if (s.indexOf('.') > -1 ||
s.indexOf('e') > -1 || s.indexOf('E') > -1) {
return Double.valueOf(s);
return Float.valueOf(s);
} else {
Long myLong = new Long(s);
if (myLong.longValue() == myLong.intValue()) {

@ -24,20 +24,20 @@ package net.yacy.document.geolocalization;
public class Coordinates {
private static final double tenmeter = 90.0 / 1.0e6;
private static final float tenmeter = 90.0f / 1.0e6f;
private final double lon, lat;
private final float lon, lat;
public Coordinates(double lon, double lat) {
public Coordinates(float lon, float lat) {
this.lon = lon;
this.lat = lat;
}
public double lon() {
public float lon() {
return this.lon;
}
public double lat() {
public float lat() {
return this.lat;
}

@ -30,13 +30,13 @@ public class Location extends Coordinates implements Comparable<Location>, Compa
private String name;
private int population;
public Location(double lon, double lat) {
public Location(float lon, float lat) {
super(lon, lat);
this.name = null;
this.population = 0;
}
public Location(double lon, double lat, String name) {
public Location(float lon, float lat, String name) {
super(lon, lat);
this.name = name;
}

@ -97,7 +97,7 @@ public class OpenGeoDBLocalization implements Localization {
String[] v;
Integer id;
String h;
double lon, lat;
float lon, lat;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (!line.startsWith("INSERT INTO ")) continue;

@ -163,7 +163,7 @@ public final class LogParser {
public static final String TOTAL_PARSER_RUNS = "totalParserRuns";
private static final double parserVersion = 0.1;
private static final float parserVersion = 0.1f;
private static final String parserType = "PLASMA";
//RegExp for LogLevel I
@ -435,7 +435,7 @@ public final class LogParser {
public final Hashtable<String, Object> getResults() {
final Hashtable<String, Object> results = new Hashtable<String, Object>();
results.put(PARSER_VERSION , Double.valueOf(parserVersion));
results.put(PARSER_VERSION , Float.valueOf(parserVersion));
results.put(URLS_RECEIVED , Integer.valueOf(urlSum));
results.put(URLS_REQUESTED , Integer.valueOf(urlReqSum));
results.put(URLS_BLOCKED , Integer.valueOf(blockedURLSum));

@ -413,18 +413,6 @@ public class ActionMessage {
return setInputParameter( parameterName, Float.toString( parameterValue ) );
}
/**
* Set the value of an input parameter before a message service call
* @param parameterName the parameter name
* @param parameterValue the double parameter value
* @return the current ActionMessage object instance
* @throws IllegalArgumentException if the provided parameterName is not valid for this message
* or if no input parameters are required for this message
*/
public ActionMessage setInputParameter( String parameterName, double parameterValue ) throws IllegalArgumentException {
return setInputParameter( parameterName, Double.toString( parameterValue ) );
}
/**
* Input params class container
*/

@ -127,7 +127,7 @@ public final class yacy {
// static objects
public static final String vString = yacyBuildProperties.getVersion();
public static double version = 0.1;
public static float version = 0.1f;
public static final String vDATE = yacyBuildProperties.getBuildDate();
public static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]";
@ -233,11 +233,6 @@ public final class yacy {
}
int newRev = Integer.parseInt(yacyBuildProperties.getSVNRevision());
sb.setConfig("svnRevision", yacyBuildProperties.getSVNRevision());
// TODO: remove!
//sb.setConfig("version", Double.toString(version));
//sb.setConfig("vString", yacyVersion.combined2prettyVersion(Double.toString(version)));
//sb.setConfig("vdate", (vDATE.startsWith("@")) ? DateFormatter.formatShortDay() : vDATE);
sb.setConfig("applicationRoot", appHome.toString());
sb.setConfig("dataRoot", dataHome.toString());
yacyVersion.latestRelease = version;
@ -289,7 +284,7 @@ public final class yacy {
yacyRelease.deleteOldDownloads(sb.releasePath, deleteOldDownloadsAfterDays );
// set user-agent
final String userAgent = "yacy/" + Double.toString(version) + " (www.yacy.net; "
final String userAgent = "yacy/" + Float.toString(version) + " (www.yacy.net; "
+ MultiProtocolURI.systemOST + ")";
HTTPClient.setDefaultUserAgent(userAgent);

Loading…
Cancel
Save