Author: orbiter
Date: 2008-02-17 13:36:43 +0100 (Sun, 17 Feb 2008)
New Revision: 4491
Modified:
trunk/source/de/anomic/tools/crypt.java
trunk/source/de/anomic/yacy/yacySeed.java
Log:
- tested successfully z-presentation of yacy seed encoding
- added alternative switch that takes shortest representation as yacy seed
string encoding
Modified: trunk/source/de/anomic/tools/crypt.java
===================================================================
--- trunk/source/de/anomic/tools/crypt.java 2008-02-17 00:06:15 UTC (rev
4490)
+++ trunk/source/de/anomic/tools/crypt.java 2008-02-17 12:36:43 UTC (rev
4491)
@@ -129,4 +129,10 @@
}
}
+ public static void main(String[] args) {
+ String
teststring="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ System.out.println("Teststring = " + teststring);
+ System.out.println("enc-b result = " +
simpleDecode(simpleEncode(teststring, null, 'b'), null));
+ System.out.println("enc-z result = " +
simpleDecode(simpleEncode(teststring, null, 'z'), null));
+ }
}
\ No newline at end of file
Modified: trunk/source/de/anomic/yacy/yacySeed.java
===================================================================
--- trunk/source/de/anomic/yacy/yacySeed.java 2008-02-17 00:06:15 UTC (rev
4490)
+++ trunk/source/de/anomic/yacy/yacySeed.java 2008-02-17 12:36:43 UTC (rev
4491)
@@ -818,7 +818,11 @@
public final String genSeedStr(String key) {
// use a default encoding
- return this.genSeedStr('z', key);
+ String z = this.genSeedStr('z', key);
+ String b = this.genSeedStr('b', key);
+ // the compressed string may be longer that the uncompressed if there
is too much overhead for compression meta-info
+ // take simply that string that is shorter
+ if (b.length() < z.length()) return b; else return z;
}
public final synchronized String genSeedStr(char method, String key) {
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn