JAL-1382 @mungo TODO done: use StringUtils for delete chars
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 10 Feb 2015 14:56:36 +0000 (14:56 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 10 Feb 2015 14:56:36 +0000 (14:56 +0000)
src/jalview/datamodel/Sequence.java

index 963a7cf..fb559eb 100755 (executable)
@@ -21,6 +21,7 @@
 package jalview.datamodel;
 
 import jalview.analysis.AlignSeq;
+import jalview.util.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Enumeration;
@@ -725,22 +726,8 @@ public class Sequence implements SequenceI
     {
       return;
     }
-    // TODO use StringUtils.deleteChars
 
-    char[] tmp;
-
-    if (j >= sequence.length)
-    {
-      tmp = new char[i];
-      System.arraycopy(sequence, 0, tmp, 0, i);
-      j = sequence.length;
-    }
-    else
-    {
-      tmp = new char[sequence.length - j + i];
-      System.arraycopy(sequence, 0, tmp, 0, i);
-      System.arraycopy(sequence, j, tmp, i, sequence.length - j);
-    }
+    char[] tmp = StringUtils.deleteChars(sequence, i, j);
     boolean createNewDs = false;
     // TODO: take a look at the new dataset creation validation method below -
     // this could become time comsuming for large sequences - consider making it