git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-3878 Add char[] constructor to Sequence
[jalview.git]
/
src
/
jalview
/
datamodel
/
Alignment.java
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
d124960
..
3a79ac6
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-195,6
+195,7
@@
public class Alignment implements AlignmentI, AutoCloseable
{
synchronized (sequences)
{
{
synchronized (sequences)
{
+
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
@@
-616,15
+617,17
@@
public class Alignment implements AlignmentI, AutoCloseable
@Override
public SequenceI findName(SequenceI startAfter, String token, boolean b)
{
@Override
public SequenceI findName(SequenceI startAfter, String token, boolean b)
{
-
+ if (token == null)
+ return null;
int i = 0;
SequenceI sq = null;
String sqname = null;
int i = 0;
SequenceI sq = null;
String sqname = null;
+ int nseq = sequences.size();
if (startAfter != null)
{
// try to find the sequence in the alignment
boolean matched = false;
if (startAfter != null)
{
// try to find the sequence in the alignment
boolean matched = false;
- while (i < sequences.size())
+ while (i < nseq)
{
if (getSequenceAt(i++) == startAfter)
{
{
if (getSequenceAt(i++) == startAfter)
{
@@
-637,7
+640,7
@@
public class Alignment implements AlignmentI, AutoCloseable
i = 0;
}
}
i = 0;
}
}
- while (i < sequences.size())
+ while (i < nseq)
{
sq = getSequenceAt(i);
sqname = sq.getName();
{
sq = getSequenceAt(i);
sqname = sq.getName();
@@
-1219,7
+1222,8
@@
public class Alignment implements AlignmentI, AutoCloseable
int maxLength = -1;
SequenceI current;
int maxLength = -1;
SequenceI current;
- for (int i = 0; i < sequences.size(); i++)
+ int nseq = sequences.size();
+ for (int i = 0; i < nseq; i++)
{
current = getSequenceAt(i);
for (int j = current.getLength(); j > maxLength; j--)
{
current = getSequenceAt(i);
for (int j = current.getLength(); j > maxLength; j--)
@@
-1236,7
+1240,7
@@
public class Alignment implements AlignmentI, AutoCloseable
maxLength++;
int cLength;
maxLength++;
int cLength;
- for (int i = 0; i < sequences.size(); i++)
+ for (int i = 0; i < nseq; i++)
{
current = getSequenceAt(i);
cLength = current.getLength();
{
current = getSequenceAt(i);
cLength = current.getLength();