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
javadoc
[jalview.git]
/
src
/
jalview
/
datamodel
/
SequenceGroup.java
diff --git
a/src/jalview/datamodel/SequenceGroup.java
b/src/jalview/datamodel/SequenceGroup.java
index
d12f81b
..
49f270d
100755
(executable)
--- a/
src/jalview/datamodel/SequenceGroup.java
+++ b/
src/jalview/datamodel/SequenceGroup.java
@@
-691,11
+691,12
@@
public class SequenceGroup
/**
*
/**
*
- * returns the sequences in the group ordered by the ordering given by al
- *
+ * returns the sequences in the group ordered by the ordering given by al.
+ * this used to return an array with null entries regardless, new behaviour is below.
+ * TODO: verify that this does not affect use in applet or application
* @param al
* Alignment
* @param al
* Alignment
- * @return SequenceI[]
+ * @return SequenceI[] intersection of sequences in group with al, ordered by al, or null if group does not intersect with al
*/
public SequenceI[] getSequencesInOrder(AlignmentI al)
{
*/
public SequenceI[] getSequencesInOrder(AlignmentI al)
{
@@
-712,7
+713,20
@@
public class SequenceGroup
seqs[index++] = al.getSequenceAt(i);
}
}
seqs[index++] = al.getSequenceAt(i);
}
}
-
+ if (index==0)
+ {
+ return null;
+ }
+ if (index<seqs.length)
+ {
+ SequenceI[] dummy = seqs;
+ seqs = new SequenceI[index];
+ while (--index>=0)
+ {
+ seqs[index] = dummy[index];
+ dummy[index] = null;
+ }
+ }
return seqs;
}
return seqs;
}