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-3383 JAL-3253-applet Java8 switches to clarify ViewportRanges
[jalview.git]
/
src
/
jalview
/
datamodel
/
Alignment.java
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
93ad332
..
91b29da
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-125,8
+125,7
@@
public class Alignment implements AlignmentI
/**
* Make a new alignment from an array of SeqCigars
*
/**
* Make a new alignment from an array of SeqCigars
*
- * @param seqs
- * SeqCigar[]
+ * @param alseqs
*/
public Alignment(SeqCigar[] alseqs)
{
*/
public Alignment(SeqCigar[] alseqs)
{
@@
-195,6
+194,7
@@
public class Alignment implements AlignmentI
{
synchronized (sequences)
{
{
synchronized (sequences)
{
+
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
if (i > -1 && i < sequences.size())
{
return sequences.get(i);
@@
-398,6
+398,10
@@
public class Alignment implements AlignmentI
return null;
}
return null;
}
+ private static final SequenceGroup[] noGroups = new SequenceGroup[0];
+
+ private ArrayList<SequenceGroup> temp = new ArrayList<>();
+
/*
* (non-Javadoc)
*
/*
* (non-Javadoc)
*
@@
-407,11
+411,15
@@
public class Alignment implements AlignmentI
@Override
public SequenceGroup[] findAllGroups(SequenceI s)
{
@Override
public SequenceGroup[] findAllGroups(SequenceI s)
{
- ArrayList<SequenceGroup> temp = new ArrayList<>();
synchronized (groups)
{
synchronized (groups)
{
+ temp.clear();
int gSize = groups.size();
int gSize = groups.size();
+ if (gSize == 0)
+ {
+ return noGroups;
+ }
for (int i = 0; i < gSize; i++)
{
SequenceGroup sg = groups.get(i);
for (int i = 0; i < gSize; i++)
{
SequenceGroup sg = groups.get(i);
@@
-589,11
+597,12
@@
public class Alignment implements AlignmentI
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)
{
@@
-606,7
+615,7
@@
public class Alignment implements AlignmentI
i = 0;
}
}
i = 0;
}
}
- while (i < sequences.size())
+ while (i < nseq)
{
sq = getSequenceAt(i);
sqname = sq.getName();
{
sq = getSequenceAt(i);
sqname = sq.getName();
@@
-717,6
+726,17
@@
public class Alignment implements AlignmentI
return maxLength;
}
return maxLength;
}
+ @Override
+ public int getVisibleWidth()
+ {
+ int w = getWidth();
+ if (hiddenCols != null)
+ {
+ w -= hiddenCols.getSize();
+ }
+ return w;
+ }
+
/**
* DOCUMENT ME!
*
/**
* DOCUMENT ME!
*
@@
-1177,7
+1197,8
@@
public class Alignment implements AlignmentI
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--)
@@
-1194,7
+1215,7
@@
public class Alignment implements AlignmentI
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();
@@
-1893,9
+1914,12
@@
public class Alignment implements AlignmentI
}
@Override
}
@Override
- public void setHiddenColumns(HiddenColumns cols)
+ public boolean setHiddenColumns(HiddenColumns cols)
{
{
+ boolean changed = cols == null ? hiddenCols != null
+ : !cols.equals(hiddenCols);
hiddenCols = cols;
hiddenCols = cols;
+ return changed;
}
@Override
}
@Override