[Schmitzm-commits] r1992 - in trunk: schmitzm-adresses/src/main/java/de/schmitzm/adresses schmitzm-adresses/src/test/java/de/schmitzm/adresses schmitzm-core/src/main/java/de/schmitzm/lang schmitzm-core/src/main/java/de/schmitzm/swing

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri May 11 19:34:50 CEST 2012


Author: alfonx
Date: 2012-05-11 19:34:50 +0200 (Fri, 11 May 2012)
New Revision: 1992

Modified:
   trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
   trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsDialog.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java
Log:
oadr_str in immobrain und Orga Imports in schmirtzm

Modified: trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
===================================================================
--- trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2012-05-10 23:10:18 UTC (rev 1991)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2012-05-11 17:34:50 UTC (rev 1992)
@@ -572,15 +572,22 @@
 	}
 
 	static public String saeubereStrassenname(String orginal) {
-		String strasse = LangUtil.removeTags(orginal);
+		String strasse = LangUtil.removeTags(orginal).toLowerCase();
+
+		strasse = strasse.replaceAll("str\\.ße", "str.");
+		
 		strasse = strasse.replaceAll("\\+", " ");
 		strasse = strasse.replaceAll("\\s\\s+", " ");
 		strasse = strasse.replaceAll("(\\d)\\s", "$1");
-		strasse = strasse.replaceAll("\\s+-\\s+", "-");
+		strasse = strasse.replaceAll("-\\s+", "-");
+		strasse = strasse.replaceAll("\\s+-", "-");
+		strasse = strasse.replaceAll("tra(ss|ß)e( |\\d)", "tr.$2");
 		strasse = strasse.replaceAll("tra(ss|ß)e\\b", "tr.");
-		strasse = strasse.replaceAll("str[^\\.]", "str.");
+		strasse = strasse.replaceAll("str[^\\.]\\b", "str.");
 		strasse = strasse.replaceAll("([^\\d^\\s])(\\d)", "$1 $2");
 		strasse = strasse.replaceAll("str$", "str.");
+		
+		strasse = strasse.replaceAll("^Str\\.$", "");
 
 		{
 			// Großschreibung aller Anfangsbuchstaben, AUSSER in den Hausnummerzusätzen
@@ -609,6 +616,9 @@
 			strasse = WordUtils.capitalize(strasse, new char[] { ' ', '-' });
 			strasse = strasse + s2;
 		}
+		
+		strasse = strasse.replaceAll(" Dem ", " dem ");
+		strasse = strasse.replaceAll(" Der ", " der ");
 
 		return strasse;
 	}

Modified: trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
===================================================================
--- trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2012-05-10 23:10:18 UTC (rev 1991)
+++ trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2012-05-11 17:34:50 UTC (rev 1992)
@@ -272,7 +272,7 @@
 		assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden in der OPf."));
 		assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden an d.OPf."));
 		assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden a.d.OPf."));
-		
+
 		assertEquals("frankfurtxxmain", AddrStringUtil.normalizeOrt("frankfurt (main)"));
 		assertEquals("hattersheimxxmain", AddrStringUtil.normalizeOrt("Hattersheim am Main, Stadt"));
 		assertEquals("hattersheimxxmain", AddrStringUtil.normalizeOrt("Hattersheim am Main, Markt"));
@@ -285,7 +285,7 @@
 
 		assertEquals("emmerichxxrhein", AddrStringUtil.normalizeOrt("emmerich"));
 		assertEquals("emmerichxxrhein", AddrStringUtil.normalizeOrt("emmerich am rhein"));
-		
+
 		assertEquals("sanktaugustin", AddrStringUtil.normalizeOrt("St. Augustin"));
 		assertEquals("freiburgxxbreisgau", AddrStringUtil.normalizeOrt("Freiburg im Breisgau"));
 		assertEquals("freiburgxxbreisgau", AddrStringUtil.normalizeOrt("Freiburg i. Breisgau"));
@@ -293,13 +293,12 @@
 		assertEquals("freiburgxxbreisgau", AddrStringUtil.normalizeOrt("Freiburg i Breisgau"));
 		assertEquals("idarobarstein", AddrStringUtil.normalizeOrt("Idar-Obarstein"));
 		assertEquals("hamburg", AddrStringUtil.normalizeOrt("Hamburg, Hansestadt"));
-		
+
 		assertEquals("bergenxxruegen", AddrStringUtil.normalizeOrt("Bergen auf Rügen"));
 		assertEquals("marktscheuren", AddrStringUtil.normalizeOrt("Markt Scheuren"));
 		assertEquals("markt", AddrStringUtil.normalizeOrt("Markt"));
 		assertEquals("berbu", AddrStringUtil.normalizeOrt("Berbu Markt"));
-		
-		
+
 	}
 
 	@Test
@@ -356,6 +355,9 @@
 
 	@Test
 	public void testSaeubereStrassenname() {
+		assertEquals("Taubenstr. 45", AddrStringUtil.saeubereStrassenname("Taubenstraße45"));
+		assertEquals("Taubenstr. 45", AddrStringUtil.saeubereStrassenname("Taubenstr.ße 45"));
+		
 		assertEquals("", AddrStringUtil.saeubereStrassenname(""));
 		assertEquals("", AddrStringUtil.saeubereStrassenname("     "));
 		assertEquals("112233", AddrStringUtil.saeubereStrassenname(" 112233    "));
@@ -372,6 +374,10 @@
 		assertEquals("Knobelsdorfstr. 6a-d", AddrStringUtil.saeubereStrassenname("Knobelsdorfstr. 6  a- d"));
 		assertEquals("Knobelsdorfstr. 6a-d", AddrStringUtil.saeubereStrassenname("Knobelsdorfstr. 6a- D"));
 		assertEquals("78er-Str. 45a-d", AddrStringUtil.saeubereStrassenname("78 er - Straße   45 A - d"));
+
+		assertEquals("Bettinastr.", AddrStringUtil.saeubereStrassenname("BETTINASTR."));
+		assertEquals("Franz-Mehring-Str.", AddrStringUtil.saeubereStrassenname("Franz- Mehring- Straße"));
+		assertEquals("Auf dem Glockenberg 30", AddrStringUtil.saeubereStrassenname("Auf Dem Glockenberg 30"));
 	}
 
 }

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2012-05-10 23:10:18 UTC (rev 1991)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2012-05-11 17:34:50 UTC (rev 1992)
@@ -2289,6 +2289,8 @@
 	 * Die Methode basiert auf RegEx. Es wird also kein valides oder wellformed-XML erwartet.
 	 */
 	public static String removeTags(String withTags) {
+		if (withTags == null) return null;
+		
 		String withoutTags = withTags;
 
 		String re1 = "\\s*<[^>]*>\\s*";

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsDialog.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsDialog.java	2012-05-10 23:10:18 UTC (rev 1991)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsDialog.java	2012-05-11 17:34:50 UTC (rev 1992)
@@ -31,15 +31,9 @@
 
 import java.awt.BorderLayout;
 import java.awt.Dialog;
-import java.awt.Dimension;
 import java.awt.Frame;
 import java.net.Proxy;
-import java.net.URL;
-import java.util.List;
 
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
 /**
  * Dialog to specify proxy settings.
  * @author Martin O.J. Schmitz

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java	2012-05-10 23:10:18 UTC (rev 1991)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java	2012-05-11 17:34:50 UTC (rev 1992)
@@ -33,9 +33,10 @@
 
 import javax.swing.JLabel;
 
+import net.miginfocom.swing.MigLayout;
+
 import org.apache.log4j.Logger;
 
-import net.miginfocom.swing.MigLayout;
 import de.schmitzm.io.IOUtil;
 import de.schmitzm.lang.LangUtil;
 import de.schmitzm.swing.input.InputOption;

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java	2012-05-10 23:10:18 UTC (rev 1991)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java	2012-05-11 17:34:50 UTC (rev 1992)
@@ -34,7 +34,6 @@
 import javax.swing.JProgressBar;
 import javax.swing.SwingUtilities;
 
-import de.schmitzm.lang.LangUtil;
 import de.schmitzm.lang.WorkingThread;
 
 /**



More information about the Schmitzm-commits mailing list