sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1425582 - in /sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis: measure/AngleFormat.java util/CharSequences.java
Date Mon, 24 Dec 2012 03:27:37 GMT
Author: desruisseaux
Date: Mon Dec 24 03:27:37 2012
New Revision: 1425582

URL: http://svn.apache.org/viewvc?rev=1425582&view=rev
Log:
Replace a few call to 'regionMatches' by the simpler 'startsWith' from String API.

Modified:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1425582&r1=1425581&r2=1425582&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java Mon
Dec 24 03:27:37 2012
@@ -1102,11 +1102,10 @@ scan:   for (int i=0; i<length;) {
                 default: throw new AssertionError(field);
             }
             if (toSkip != null) {
-                final int toSkipLength = toSkip.length();
                 int c;
                 do {
-                    if (source.regionMatches(index, toSkip, 0, toSkipLength)) {
-                        pos.setIndex(index + toSkipLength);
+                    if (source.startsWith(toSkip, index)) {
+                        pos.setIndex(index + toSkip.length());
                         return field;
                     }
                     if (index >= length) break;

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1425582&r1=1425581&r2=1425582&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java Mon
Dec 24 03:27:37 2012
@@ -1698,7 +1698,7 @@ cmp:    while (ia < lga) {
     public static boolean regionMatches(final CharSequence text, final int fromIndex, final
CharSequence part) {
         if (text instanceof String && part instanceof String) {
             // It is okay to delegate to String implementation since we do not ignore cases.
-            return ((String) text).regionMatches(fromIndex, (String) part, 0, part.length());
+            return ((String) text).startsWith((String) part, fromIndex);
         }
         final int length;
         if (fromIndex < 0 || fromIndex + (length = part.length()) > text.length())
{



Mime
View raw message