Strabon
changeset 1307:ee7b409db8d2
Changed indexOf to lastIndexOf when searching for the STRDF_SRID_DELIM (;). lastIndexOf starts searching from the end of a String, so this takes less time when we have strdf geometries with srid and the same time for all the other cases.
author | Panayiotis Smeros <psmeros@di.uoa.gr> |
---|---|
date | Fri Jan 31 12:50:49 2014 +0200 (2014-01-31) |
parents | 704a516daff8 |
children | d89f0d5b3c89 |
files | evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java |
line diff
1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java Fri Dec 06 05:56:24 2013 +0200 1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java Fri Jan 31 12:50:49 2014 +0200 1.3 @@ -24,6 +24,7 @@ 1.4 * might not be valid. 1.5 * 1.6 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 1.7 + * @author Panayiotis Smeros <psmeros@di.uoa.gr> 1.8 */ 1.9 public class AbstractWKT { 1.10 1.11 @@ -94,7 +95,7 @@ 1.12 public AbstractWKT(String literalValue) { 1.13 datatype = null; 1.14 1.15 - if (literalValue.indexOf(WKTHelper.STRDF_SRID_DELIM) > 0) { // strdf:WKT 1.16 + if (literalValue.lastIndexOf(WKTHelper.STRDF_SRID_DELIM) > 0) { // strdf:WKT 1.17 datatype = GeoConstants.WKT; 1.18 1.19 isstRDFWKT = true;
2.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Fri Dec 06 05:56:24 2013 +0200 2.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Fri Jan 31 12:50:49 2014 +0200 2.3 @@ -18,6 +18,7 @@ 2.4 /** 2.5 * 2.6 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 2.7 + * @author Panayiotis Smeros <psmeros@di.uoa.gr> 2.8 * 2.9 */ 2.10 public class WKTHelper { 2.11 @@ -37,7 +38,7 @@ 2.12 public static String getWithoutSRID(String wkt) { 2.13 if (wkt == null) return wkt; 2.14 2.15 - int pos = wkt.indexOf(STRDF_SRID_DELIM); 2.16 + int pos = wkt.lastIndexOf(STRDF_SRID_DELIM); 2.17 if (pos != -1) { 2.18 return wkt.substring(0, pos); 2.19 2.20 @@ -59,7 +60,7 @@ 2.21 2.22 if (wkt == null) return srid; 2.23 2.24 - int pos = wkt.indexOf(STRDF_SRID_DELIM); 2.25 + int pos = wkt.lastIndexOf(STRDF_SRID_DELIM); 2.26 if (pos != -1) { 2.27 try { 2.28 srid = Integer.parseInt(wkt.substring(wkt.lastIndexOf(CUT_DELIM) + 1).replace(URI_ENDING, ""));