From 264a82eec87cb145b9aff9e3a22d0f05c21fa420 Mon Sep 17 00:00:00 2001 From: karlchenofhell Date: Thu, 8 Mar 2007 22:04:15 +0000 Subject: [PATCH] - fix for http://www.yacy-forum.de/viewtopic.php?t=3657 - fix for http://www.yacy-forum.de/viewtopic.php?p=32758#32758 - Diff takes any objects now, not only strings git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3455 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Settings_p.java | 10 ++---- htroot/index.java | 5 +-- source/de/anomic/data/Diff.java | 57 +++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java index b3d993396..92d1bb580 100644 --- a/htroot/Settings_p.java +++ b/htroot/Settings_p.java @@ -68,10 +68,7 @@ public final class Settings_p { String page = (post == null) ? "general" : post.get("page", "general"); - if (page.equals("general")) { - prop.put("settingsTables", "Settings_General.inc"); - } - else if (page.equals("ProxyAccess")) { + if (page.equals("ProxyAccess")) { prop.put("settingsTables", "Settings_ProxyAccess.inc"); } else if (page.equals("http")) { @@ -100,9 +97,8 @@ public final class Settings_p { } else if (page.equals("crawler")) { prop.put("settingsTables", "Settings_Crawler.inc"); - } - else { - prop.put("settingsTables", "Settings_General.inc"); + } else { + prop.put("settingsTables", ""); } prop.put("port", env.getConfig("port", "8080")); diff --git a/htroot/index.java b/htroot/index.java index 831906e3b..a75451960 100644 --- a/htroot/index.java +++ b/htroot/index.java @@ -93,10 +93,11 @@ public class index { if (cds.equals("image")) contentdom = plasmaSearchQuery.CONTENTDOM_IMAGE; if (cds.equals("app")) contentdom = plasmaSearchQuery.CONTENTDOM_APP; + long mylinks = 0; try { - prop.put("links", groupDigits(Long.parseLong(yacyCore.seedDB.mySeed.get(yacySeed.LCOUNT, "0")))); + prop.put("links", groupDigits(mylinks = Long.parseLong(yacyCore.seedDB.mySeed.get(yacySeed.LCOUNT, "0")))); } catch (NumberFormatException e) { prop.put("links", "0"); } - prop.put("total-links", groupDigits(yacyCore.seedDB.countActiveURL())); + prop.put("total-links", groupDigits(mylinks + yacyCore.seedDB.countActiveURL())); // we create empty entries for template strings String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", ""); diff --git a/source/de/anomic/data/Diff.java b/source/de/anomic/data/Diff.java index c37f81ee8..67d44a7c4 100644 --- a/source/de/anomic/data/Diff.java +++ b/source/de/anomic/data/Diff.java @@ -55,8 +55,8 @@ import java.util.ArrayList; public class Diff { private final ArrayList /* of Part */ parts = new ArrayList(); - private final String o; - private final String n; + private final Object[] o; + private final Object[] n; /** * @param o the original String @@ -64,10 +64,7 @@ public class Diff { * @throws NullPointerException if one of the arguments is null */ public Diff(String o, String n) { - if (o == null || n == null) throw new NullPointerException("neither o nor n must be null"); - this.o = o; - this.n = n; - parse(1); + this(o, n, 1); } /** @@ -80,6 +77,17 @@ public class Diff { * null */ public Diff(String o, String n, int minConsecutive) { + if (o == null || n == null) throw new NullPointerException("neither o nor n must be null"); + this.o = new Comparable[o.length()]; + for (int i=0; i 0) ? minConsecutive : 1); + } + + public Diff(Object[] o, Object[] n, int minConsecutive) { if (o == null || n == null) throw new NullPointerException("neither o nor n must be null"); this.o = o; this.n = n; @@ -108,22 +116,21 @@ public class Diff { * E| | |#| | | | | | | | |#| | |#| | |#| * N| | | | | | | | | | | | |#| | |#| | | * C| | | | | | | | | | | | | | | | |#| | - * E| | |#| | | | | | | | | |#| | |#| |#| + * E| | |#| | | | | | | | |#| | |#| | |#| */ - boolean[][] matrix = new boolean[this.n.length()][this.o.length()]; - for (int y=0; yString passed to this class on instantiation + * @return the original Object[] passed to this class on instantiation */ - public String getOriginal() { return this.o; } + public Object[] getOriginal() { return this.o; } /** - * @return the new String passed to this class on instantiation + * @return the new Object[] passed to this class on instantiation */ - public String getNew() { return this.n; } + public Object[] getNew() { return this.n; } /** * A diff is composed of different parts. Each of these parts stands for an @@ -225,7 +234,15 @@ public class Diff { * @return the plain string this diff-part cares about */ public String getString() { - return ((this.action == ADDED) ? Diff.this.n : Diff.this.o).substring(this.posOld, this.posNew); + final StringBuffer sb = new StringBuffer(this.posNew - this.posOld); + if (this.action == ADDED) { + for (int i=this.posOld; i