|
|
@ -9,11 +9,11 @@ import net.yacy.search.Switchboard;
|
|
|
|
|
|
|
|
|
|
|
|
public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersion> {
|
|
|
|
public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersion> {
|
|
|
|
|
|
|
|
|
|
|
|
public static final float YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383;
|
|
|
|
public static final double YACY_SUPPORTS_PORT_FORWARDING = (float) 0.383;
|
|
|
|
public static final float YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED = (float) 0.58204761;
|
|
|
|
public static final double YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED = (float) 0.58204761;
|
|
|
|
public static final float YACY_HANDLES_COLLECTION_INDEX = (float) 0.486;
|
|
|
|
public static final double YACY_HANDLES_COLLECTION_INDEX = (float) 0.486;
|
|
|
|
public static final float YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550;
|
|
|
|
public static final double YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550;
|
|
|
|
public static final float YACY_STANDARDREL_IS_PRO = (float) 0.557;
|
|
|
|
public static final double YACY_STANDARDREL_IS_PRO = (float) 0.557;
|
|
|
|
private static yacyVersion thisVersion = null;
|
|
|
|
private static yacyVersion thisVersion = null;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -99,6 +99,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
|
|
|
* returns 0 if this object is equal to the obj, -1 if this is smaller
|
|
|
|
* returns 0 if this object is equal to the obj, -1 if this is smaller
|
|
|
|
* than obj and 1 if this is greater than obj
|
|
|
|
* than obj and 1 if this is greater than obj
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int compareTo(final yacyVersion obj) {
|
|
|
|
public int compareTo(final yacyVersion obj) {
|
|
|
|
return compare(this, obj);
|
|
|
|
return compare(this, obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -108,6 +109,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
|
|
|
* must be implemented to make it possible to put this object into
|
|
|
|
* must be implemented to make it possible to put this object into
|
|
|
|
* a ordered structure, like TreeSet or TreeMap
|
|
|
|
* a ordered structure, like TreeSet or TreeMap
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int compare(final yacyVersion v0, final yacyVersion v1) {
|
|
|
|
public int compare(final yacyVersion v0, final yacyVersion v1) {
|
|
|
|
int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr()));
|
|
|
|
int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr()));
|
|
|
|
if (r != 0) return r;
|
|
|
|
if (r != 0) return r;
|
|
|
@ -116,6 +118,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
|
|
|
return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn()));
|
|
|
|
return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(final Object obj) {
|
|
|
|
public boolean equals(final Object obj) {
|
|
|
|
if (obj instanceof yacyVersion) {
|
|
|
|
if (obj instanceof yacyVersion) {
|
|
|
|
final yacyVersion v = (yacyVersion) obj;
|
|
|
|
final yacyVersion v = (yacyVersion) obj;
|
|
|
@ -124,6 +127,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
public int hashCode() {
|
|
|
|
return getName().hashCode();
|
|
|
|
return getName().hashCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -137,21 +141,21 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
|
|
|
* If the major version is >= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>
|
|
|
|
* If the major version is >= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>
|
|
|
|
* "dev/00000" - If the input does not matcht the regular expression above
|
|
|
|
* "dev/00000" - If the input does not matcht the regular expression above
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static String combined2prettyVersion(final String ver) {
|
|
|
|
public static String[] combined2prettyVersion(final String ver) {
|
|
|
|
return combined2prettyVersion(ver, "");
|
|
|
|
return combined2prettyVersion(ver, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String combined2prettyVersion(final String ver, final String computerName) {
|
|
|
|
public static String[] combined2prettyVersion(final String ver, final String computerName) {
|
|
|
|
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
|
|
|
|
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
|
|
|
|
if (!matcher.find()) {
|
|
|
|
if (!matcher.find()) {
|
|
|
|
Log.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");
|
|
|
|
Log.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");
|
|
|
|
return "dev/00000";
|
|
|
|
return new String[]{"dev", "0000"};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final String mainversion = (Float.parseFloat(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);
|
|
|
|
String revision = matcher.group(2);
|
|
|
|
for(int i=revision.length();i<5;++i) revision += "0";
|
|
|
|
for(int i=revision.length();i<5;++i) revision += "0";
|
|
|
|
return mainversion+"/"+revision;
|
|
|
|
return new String[]{mainversion, revision};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static int revision(final String ver) {
|
|
|
|
public static int revision(final String ver) {
|
|
|
|